53 function DataUserTableUpdate($pDbh, $pHbEnv, $pMc, $pUpdTable, $pAuditUser, $pAction, $pAppContext, $pCodeContext, $pAuditType, $pFullDesc, $pUserName, $pEmail, $pIp, $pSuppressAudit =
false,
54 $pAccountNumber =
"") {
92 $retSnapshot = array();
93 $updatedDataSnapShot = array();
99 if (!is_array($pUpdTable)) {
101 throw new exception(
'Update Table Not Defined', 900);
107 $tableCodeList = array_keys($pUpdTable);
109 if (count($tableCodeList) == 0) {
111 throw new exception(
'Update Table Empty', 901);
120 for ($updIdx = 0; $updIdx < count($tableCodeList); $updIdx++) {
126 $tableCode = $tableCodeList[$updIdx];
128 $recordAudit = (!$pSuppressAudit);
138 $saveBeforeDataSnapshot = GetDataSnapshot($pDbh, $pHbEnv, $pMc, $tableCode, $pUpdTable[$tableCode]);
140 $saveBeforeDataSnapshot =
false;
152 $savedRecords = $pUpdTable[$tableCode];
153 for ($rowIdx = 0; $rowIdx < count($savedRecords); $rowIdx++) {
160 $updTableResp = SetDataTableUpdate( $pDbh, $pHbEnv, $pMc, $tableCode, $savedRecords[$rowIdx]);
164 if ($updTableResp[
'code'] ==
'000') {
165 foreach($updTableResp[
'data'][
'row'] as $table => $rows)
167 $retSnapshot[$table]= isset($retSnapshot[$table]) ? array_merge($retSnapshot[$table], $rows) : $rows;
170 throw new exception (
'Data Update Error',
'902');
179 if ($saveBeforeDataSnapshot !==
false) {
191 if ($pAuditUser ==
null) {
194 $updTableResp_id = HCU_array_key_exists(
"user", $updTableResp[
'data'][
'row']) ? $updTableResp[
'data'][
'row'][
'user'][0][
'user_id'] :
null;
196 if (isset($updTableResp_id)) {
197 $pAuditUser = $updTableResp_id;
203 $dataAuditRecord = SetAuditRecord($pDbh, $pHbEnv, $pMc, $pAuditUser, $pAction, $pAppContext, $pCodeContext, $pAuditType, $pFullDesc, $pUserName, $pEmail, $pIp,
204 HCU_JsonEncode($saveBeforeDataSnapshot), HCU_JsonEncode($retSnapshot),
false, $pAccountNumber);
211 }
catch (exception $e) {
215 $retSnapshot =
false;
248 function DataAdminTableUpdate($pDbh, $pHbEnv, $pUpdTable, $pAuditUser, $pAction, $pCodeContext, $pAuditType, $pFullDesc, $pUserName, $pEmail, $pIp, $pSuppressAudit =
false)
250 $retSnapshot= array();
253 if (!is_array($pUpdTable))
254 throw new exception(
'Update Table Not Defined', 900);
255 if (count($pUpdTable) == 0)
256 throw new exception(
'Update Table Empty', 901);
258 foreach($pUpdTable as $table => $tableRecord)
260 $saveBeforeDataSnapshot = $pSuppressAudit ? false : GetDataSnapshot($pDbh, $pHbEnv,
null, $table, $tableRecord);
261 foreach($tableRecord as $rowRecord)
263 $results= SetDataTableUpdate($pDbh, $pHbEnv,
null, $table, $rowRecord);
264 if ($results[
"code"] !=
"000")
265 throw new exception (
'Data Update Error',
'902');
267 foreach($results[
'data'][
'row'] as $table => $rows)
269 $retSnapshot[$table]= isset($retSnapshot[$table]) ? array_merge($retSnapshot[$table], $rows) : $rows;
274 if ($saveBeforeDataSnapshot !==
false)
276 $dataAuditRecord = SetAdminAuditRecord($pDbh, $pHbEnv, $pAuditUser, $pAction, $pCodeContext, $pAuditType, $pFullDesc, $pUserName, $pEmail, $pIp,
277 HCU_JsonEncode($saveBeforeDataSnapshot), HCU_JsonEncode($retSnapshot) );
282 $retSnapshot =
false;
306 function GetDataSnapshot($pDbh, $pHbEnv, $pMc, $pTableCode, $pUpdRows) {
307 $retSnapShot = array();
313 if ($pTableCode ==
'') {
315 throw new exception(
'Update Table Not Defined', 900);
321 $tableCodeList = $pTableCode;
323 if (count($tableCodeList) ==
'') {
325 throw new exception(
'Update Table Empty', 901);
337 $tblSchemaList = GetTableDefinition ($pHbEnv, $tableCodeList);
339 if (!HCU_array_key_exists($tableCodeList, $tblSchemaList)) {
340 throw new exception(
'Update Table Empty', 902);
342 $tblSchema = $tblSchemaList[$tableCodeList];
343 if (HCU_array_key_value(
'_takesnapshot', $tblSchema)) {
349 $recordsToSave = $pUpdRows;
350 if (is_array($recordsToSave)) {
353 for ($recordIdx = 0; $recordIdx < count($recordsToSave); $recordIdx++) {
355 $singleRecord = $recordsToSave[$recordIdx];
356 if (HCU_array_key_value(
'_action', $singleRecord) ==
'create') {
358 $retSnapShot[$tableCodeList][] = array();
361 $sql = GetTableSelectSql($tblSchema, $singleRecord);
367 $getSingleDataRow = GetAllRowsFromSql($pDbh, $sql);
368 $retSnapShot[$tableCodeList][] = (is_array($getSingleDataRow) ? $getSingleDataRow[0] : Array());
377 $retSnapShot =
false;
380 }
catch (exception $e) {
382 $retSnapShot =
false;
398 function UpdateMemberFailedLogin($pDbh, $pCu, $pLogin, $pFailedType) {
400 $sql =
"SELECT hcumbrloginfailed('" . prep_save($pCu, 10).
"', '" . prep_save($pLogin, 50) .
"', " . intval($pFailedType) .
")";
402 $selRs = db_query($sql, $pDbh);
423 function UpdateMemberLoginTrack($pDbh, $pCu, $pLogin, $pFchange, $pLastPwdChg, $pLoginType, $pMfaQuest) {
427 $pFchange = ($pFchange ==
'Y' ?
'Y' :
'N');
429 $sql =
"SELECT hcumbrlogintrack('" . prep_save($pCu, 10).
"', '" . prep_save($pLogin, 50) .
"', '$pFchange', '" . prep_save($pLastPwdChg) .
"', '" . prep_save($pLoginType) .
"', '" . prep_save(PrepareMfaQuestString($pMfaQuest)) .
"');";
432 $selRs = db_query($sql, $pDbh);
458 function PrepareExpressionList ($pColumnListAry, $pValueListAry, $pAllValuesSet=
false) {
460 $retValueString =
'';
466 if (is_array($pColumnListAry) && is_array($pValueListAry)) {
468 if ($pAllValuesSet) {
470 $updateFieldsAry = $pColumnListAry;
473 $updateFieldsAry = array_intersect_key($pColumnListAry, $pValueListAry);
478 foreach ($updateFieldsAry as $fieldname => $fieldtype) {
481 switch (substr($fieldtype, 0, 1)) {
484 $maxlen = (intval(substr($fieldtype, 1)) > 0 ? intval(substr($fieldtype, 1)) : 0);
485 $retValueString .= ($retValueString !=
'' ?
"," :
"") .
"{$fieldname} " . (substr($fieldtype, 0, 1) ==
'S' ?
'ilike' :
'=') .
" '" . prep_save($pValueListAry[$fieldname], $maxlen) .
"'";
488 $retValueString .= ($retValueString !=
'' ?
"," :
"") .
"{$fieldname} = '" . intval($pValueListAry[$fieldname]) .
"'";
491 $retValueString .= ($retValueString !=
'' ?
"," :
"") .
"{$fieldname} = '" . floatval($pValueListAry[$fieldname]) .
"'";
499 throw new Exception(
'Validation Error',
'999');
502 }
catch (Exception $e) {
503 $retValueString =
'';
506 return $retValueString;
547 function GetTableDefinition ($pHbEnv, $pTableCode, $pTableVariables = array()) {
555 switch ($pTableCode){
557 case $pHbEnv[
'cu'] .
"group":
559 "_primary-columns" => array(
"group_id"),
560 "_tablename" => $pHbEnv[
'cu'] .
"group",
561 "_required-columns" => array(
"group_id",
"group_name",
"profile_id",
"contact"),
562 "_takesnapshot" =>
true,
564 "group_id" => array(
"type" => DBTYPE_SERIAL),
565 "group_name" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 50),
566 "profile_id" => array(
"type" => DBTYPE_INTEGER),
567 "contact" => array(
"type" => DBTYPE_INTEGER)
572 case $pHbEnv[
'cu'] .
"grouprights":
574 "_primary-columns" => array(
"group_id",
"feature_code"),
575 "_tablename" => $pHbEnv[
'cu'] .
"grouprights",
576 "_required-columns" => array(
"group_id",
"feature_code"),
577 "_takesnapshot" =>
true,
579 "group_id" => array(
"type" => DBTYPE_INTEGER),
580 "feature_code" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 10),
581 "amount_per_transaction" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
582 "amount_per_day" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
583 "amount_per_month" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
584 "amount_per_account_per_day" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
585 "count_per_day" => array(
"type" => DBTYPE_INTEGER),
586 "count_per_month" => array(
"type" => DBTYPE_INTEGER),
587 "count_per_account_per_day" => array(
"type" => DBTYPE_INTEGER),
588 "confirm_required" => array(
"type" => DBTYPE_BOOLEAN)
593 case $pHbEnv[
'cu'] .
'user':
595 "_primary-columns" => array(
"user_id"),
596 "_tablename" => $pHbEnv[
'cu'] .
'user',
597 "_required-columns" => array(
"user_id"),
598 "_takesnapshot" =>
true,
600 "user_id" => array(
"type" => DBTYPE_SERIAL,
"label" =>
"Login Id"),
601 "group_id" => array(
"type" => DBTYPE_INTEGER),
602 "user_name" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 50,
"label" =>
"User Name"),
603 "passwd" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 255,
"label" =>
"Password"),
604 "email" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 255,
"label" =>
"Email"),
605 "primary_account" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12,
"label" =>
"Primary Accnt #"),
606 "egenl_flag" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
607 "failedremain" => array(
"type" => DBTYPE_SMALLINT,
"label" =>
"Failed Tries Left"),
608 "forcechange" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1,
"label" =>
"Force Change?"),
609 "forceremain" => array(
"type" => DBTYPE_SMALLINT,
"label" =>
"Force Tries Left"),
610 "lastlogin" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 20,
"label" =>
"Last Login"),
611 "priorlogin" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 20,
"label" =>
"Prior Login"),
612 "failedlogin" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 20,
"label" =>
"Failed Login"),
613 "pwchange" => array(
"type" => DBTYPE_TIMESTAMPTZ,
"label" =>
"Password Change Date"),
614 "msg_tx" => array(
"type" => DBTYPE_SMALLINT,
"label" =>
"Message Code"),
615 "employee" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1,
"label" =>
"Employee?"),
616 "userflags" => array(
"type" => DBTYPE_INTEGER,
"label" =>
"User Options"),
617 "confidence" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 20,
"label" =>
"Confidence"),
618 "challenge_quest_id" => array(
"type" => DBTYPE_INTEGER),
619 "pkattempt" => array(
"type" => DBTYPE_BIGINT,
"label" =>
"Package Attempt"),
620 "other_rights" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 10,
"label" =>
"Other Rights"),
621 "is_group_primary" => array(
"type" => DBTYPE_BOOLEAN,
"label" =>
"Primary?"),
622 "name" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 100,
"label" =>
"Name"),
623 "contact" => array(
"type" => DBTYPE_INTEGER),
624 "schedule_code" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
625 "ip" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 255),
626 "mfaquest" => array(
"type" => DBTYPE_VARCHAR)
631 case $pHbEnv[
'cu'] .
'userrights':
632 $retTDAry= array(
"_label" =>
"User Rights",
633 "_primary-columns" => array(
"user_id",
"feature_code"),
634 "_tablename" => $pHbEnv[
'cu'] .
'userrights',
635 "_required-columns" => array(
"user_id",
"feature_code"),
636 "_takesnapshot" =>
true,
638 "user_id" => array(
"type" =>
"integer",
"label" =>
"Login Id"),
639 "feature_code" => array(
"type" =>
"char",
"maxlength" => 10,
"label" =>
"Feature"),
640 "amount_per_transaction" => array(
"type" =>
"numeric",
"precision" =>
"11,2",
"label" =>
"Amount Per Transaction",
"nullable" =>
true),
641 "amount_per_day" => array(
"type" =>
"numeric",
"precision" =>
"11,2",
"label" =>
"Amount Per Day",
"nullable" =>
true),
642 "amount_per_month" => array(
"type" =>
"numeric",
"precision" =>
"11,2",
"label" =>
"Amount Per Month",
"nullable" =>
true),
643 "amount_per_account_per_day" => array(
"type" =>
"numeric",
"percision" =>
"11,2",
"label" =>
"Amount Per Account Per Day",
"nullable" =>
true),
644 "deny_access" => array(
"type" =>
"boolean",
"label" =>
"Access?",
"nullable" =>
true),
645 "deny_create" => array(
"type" =>
"boolean",
"label" =>
"Create?",
"nullable" =>
true),
646 "deny_confirm" => array(
"type" =>
"boolean",
"label" =>
"Approve?",
"nullable" =>
true),
647 "deny_decline" => array(
"type" =>
"boolean",
"label" =>
"Reject?",
"nullable" =>
true),
648 "deny_report" => array(
"type" =>
"boolean",
"maxlength" => 1,
"label" =>
"Report Value",
"nullable" =>
true),
649 "confirm_required" => array(
"type" =>
"boolean",
"label" =>
"Confirm Required",
"nullable" =>
true),
650 "count_per_day" => array(
"type" =>
"integer",
"label" =>
"Count Per Day",
"nullable" =>
true),
651 "count_per_month" => array(
"type" =>
"integer",
"label" =>
"Count Per Month",
"nullable" =>
true),
652 "count_per_account_per_day" => array(
"type" =>
"integer",
"label" =>
"Count Per Account Per Day",
"nullable" =>
true)
658 case $pHbEnv[
'cu'] .
'useraccounts':
660 "_label" =>
"User Account",
661 "_primary-columns" => array(
"user_id",
"accountnumber",
"accounttype",
"certnumber",
"recordtype"),
662 "_tablename" => $pHbEnv[
'cu'] .
'useraccounts',
663 "_required-columns" => Array(
"user_id",
"accountnumber",
"accounttype",
"certnumber",
"recordtype"),
664 "_takesnapshot" =>
true,
666 "user_id" => array(
"type" => DBTYPE_INTEGER,
"label" =>
"User Id"),
667 "accountnumber" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12,
"label" =>
"Accnt #"),
668 "accounttype" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 25,
"label" =>
"Accnt Type"),
669 "certnumber" => array(
"type" => DBTYPE_INTEGER,
"label" =>
"Cert Number"),
670 "recordtype" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1,
"label" =>
"Record Type"),
671 "display_name" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 255,
"label" =>
"Name"),
672 "view_balances" => array(
"type" => DBTYPE_BOOLEAN,
"label" =>
"View Balances?"),
673 "view_transactions" => array(
"type" => DBTYPE_BOOLEAN,
"label" =>
"View Transactions?"),
674 "int_deposit" => array(
"type" => DBTYPE_BOOLEAN,
"label" =>
"Internal Deposit?"),
675 "int_withdraw" => array(
"type" => DBTYPE_BOOLEAN,
"label" =>
"Internal Withdraw?"),
676 "ext_deposit" => array(
"type" => DBTYPE_BOOLEAN,
"label" =>
"External Deposit?"),
677 "ext_withdraw" => array(
"type" => DBTYPE_BOOLEAN,
"label" =>
"External Withdraw?"),
678 "display_order" => array(
"type" => DBTYPE_SMALLINT,
"label" =>
"Display Order"),
679 "display_qty" => array(
"type" => DBTYPE_SMALLINT,
"label" =>
"Display Quantity"),
680 "display_qty_type" => array(
"type" => DBTYPE_CHAR,
"label" =>
"Display Quantity Type")
687 "_primary-columns" => array(
"id"),
689 "_tablename" =>
"cu_alerts",
690 "_takesnapshot" =>
true,
692 "id" => array(
"type" => DBTYPE_SERIAL),
693 "alerttype" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
694 "cu" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 10),
695 "user_id" => array(
"type" => DBTYPE_INTEGER),
696 "accountnumber" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
697 "accounttype" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 25),
698 "certnumber" => array(
"type" => DBTYPE_INTEGER),
699 "emailtype" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
700 "notifyto" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 50),
701 "provider_id" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 35),
702 "notifymsg" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 255),
703 "incbal" => array(
"type" => DBTYPE_SMALLINT),
704 "incamt" => array(
"type" => DBTYPE_SMALLINT),
705 "inctransdesc" => array(
"type" => DBTYPE_SMALLINT),
706 "lastalert" => array(
"type" => DBTYPE_TIMESTAMPTZ),
707 "notifyamt" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"12"),
708 "useavailbal" => array(
"type" => DBTYPE_SMALLINT),
709 "notifyrange" => array(
"type" => DBTYPE_SMALLINT),
710 "notifyamtmin" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"12"),
711 "notifyamtmax" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"12"),
712 "notifydesc" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 90),
713 "notifytranstype" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
714 "notifychknum" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 8),
715 "notifyloandaysprior" => array(
"type" => DBTYPE_SMALLINT),
716 "alertstatus" => array(
"type" => DBTYPE_SMALLINT,
"label" =>
"Enabled?"),
717 "lasttrace" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 16)
721 case 'cu_scheduledtxn':
723 "_primary-columns" => array(
"id"),
724 "_label" =>
"Scheduled",
725 "_tablename" =>
"cu_scheduledtxn",
726 "_takesnapshot" =>
true,
728 "id" => array(
"type" => DBTYPE_INTEGER,
"nullable" =>
false),
729 "cu" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 10,
"nullable" =>
false),
730 "name" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 100),
731 "feature_code" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 10,
"nullable" =>
false),
732 "user_id" => array(
"type" => DBTYPE_INTEGER,
"nullable" =>
false),
733 "create_date" => array(
"type" => DBTYPE_TIMESTAMP),
734 "approved_by" => array(
"type" => DBTYPE_INTEGER),
735 "approved_date" => array(
"type" => DBTYPE_TIMESTAMP),
736 "last_edit_by" => array(
"type" => DBTYPE_INTEGER),
737 "last_edit_date" => array(
"type" => DBTYPE_DATE),
738 "start_date" => array(
"type" => DBTYPE_DATE),
739 "end_date" => array(
"type" => DBTYPE_DATE),
740 "next_trigger_date" => array(
"type" => DBTYPE_DATE),
741 "interval_count" => array(
"type" => DBTYPE_SMALLINT),
742 "failure_count" => array(
"type" => DBTYPE_SMALLINT),
743 "status" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
744 "repeating_parameters" => array(
"type" => DBTYPE_VARCHAR),
745 "txn_data" => array(
"type" => DBTYPE_VARCHAR),
746 "approved_status" => array(
"type" => DBTYPE_SMALLINT)
753 case $pHbEnv[
'cu'] .
'audituser':
755 "_primary-columns" => array(
"user_id",
"auditdate",
"auditaction",
"accountnumber"),
756 "_tablename" => $pHbEnv[
'cu'] .
'audituser',
757 "_required-columns" => Array(
"user_id",
"auditdate",
"auditaction",
"accountnumber"),
758 "_takesnapshot" =>
false,
760 "user_id" => array(
"type" => DBTYPE_INTEGER),
761 "auditdate" => array(
"type" => DBTYPE_TIMESTAMPTZ),
762 "auditaction" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 10),
763 "auditsrctype" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
764 "auditsrcuser_name" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 50),
765 "auditsrcemail" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 255),
766 "auditrecbefore" => array(
"type" => DBTYPE_VARCHAR),
767 "auditrecafter" => array(
"type" => DBTYPE_VARCHAR),
768 "auditsrcip" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 15),
769 "auditsrcapp_context" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 10),
770 "auditsrccode_context" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 20),
771 "auditfulldesc" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 255),
772 "accountnumber" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 12)
777 case $pHbEnv[
'cu'] .
"memberacct":
779 "_primary-columns" => array(
"accountnumber"),
780 "_tablename" => $pHbEnv[
'cu'] .
"memberacct",
781 "_required-columns" => array(
"primary_user",
"accountnumber",
"estmnt_flag"),
782 "_takesnapshot" =>
true,
784 "primary_user" => array(
"type" => DBTYPE_INTEGER),
785 "accountnumber" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
786 "estmnt_flag" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
787 "billpayid" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
788 "rdcsetting" => array(
"type" => DBTYPE_INTEGER,
"nullable" =>
true),
789 "restrictions" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1,
"nullable" =>
true),
790 "balance_stamp" => array(
"type" => DBTYPE_BIGINT,
"nullable" =>
true),
791 "balance_attempt" => array(
"type" => DBTYPE_BIGINT,
"nullable" =>
true),
792 "allowenroll" => array(
"type" => DBTYPE_BOOLEAN,
"nullable" =>
true)
798 "_primary-columns" => array(
"micrid"),
799 "_tablename" =>
"cuovermicr",
800 "_required-columns" => array(
"micrid",
"cu",
"accountnumber",
"accounttype",
"startcheck"),
801 "_takesnapshot" =>
true,
803 "micrid" => array(
"type" => DBTYPE_SERIAL),
804 "cu" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 10),
805 "accountnumber" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
806 "accounttype" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
807 "startcheck" => array(
"type" => DBTYPE_INTEGER),
808 "rt" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
809 "micraccount" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 17)
815 "_primary-columns" => array(
"cu",
"user_name",
"auditdate",
"auditaction"),
816 "_tablename" =>
'cuauditadmin',
817 "_required-columns" => array(
"cu",
"user_name",
"auditdate",
"auditaction"),
818 "_takesnapshot" =>
false,
820 "cu" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 10,
"defaultValue" => $pHbEnv[
'cu']),
821 "user_name" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 50),
822 "auditdate" => array(
"type" => DBTYPE_TIMESTAMPTZ),
823 "auditaction" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 10),
824 "auditsrctype" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
825 "auditsrcuser_name" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 50),
826 "auditsrcemail" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 255),
827 "auditrecbefore" => array(
"type" => DBTYPE_VARCHAR),
828 "auditrecafter" => array(
"type" => DBTYPE_VARCHAR),
829 "auditsrcip" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 15),
830 "auditsrccode_context" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 20),
831 "auditfulldesc" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 255)
837 "_primary-columns" => array(
"cu",
"user_name"),
838 "_tablename" =>
"cuadminusers",
839 "_required-columns" => array(
"cu",
"user_name",
"passwd",
"realname",
"failedremain",
"forcechange",
"forceremain"),
840 "_takesnapshot" =>
true,
842 "cu" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 10),
843 "user_name" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 50),
844 "passwd" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 255),
845 "realname" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 50),
846 "failedremain" => array(
"type" => DBTYPE_INTEGER),
847 "forcechange" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
848 "forceremain" => array(
"type" => DBTYPE_INTEGER),
849 "lastlogin" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 20),
850 "priorlogin" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 20),
851 "failedlogin" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 20),
852 "pwchange" => array(
"type" => DBTYPE_TIMESTAMP),
853 "email" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 50),
854 "userflags" => array(
"type" => DBTYPE_INTEGER),
855 "confidence" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 20),
856 "remoteip" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 15),
857 "usersms" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 40),
858 "userconfirm" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 50),
859 "mfaquest" => array(
"type" => DBTYPE_VARCHAR)
865 "_primary-columns" => array(
"cu",
"user_name",
"program"),
866 "_tablename" =>
"cuadminallow",
867 "_required-columns" => array(
"cu",
"user_name",
"program"),
868 "_takesnapshot" =>
true,
870 "cu" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 10),
871 "user_name" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 50),
872 "program" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 20)
876 case $pHbEnv[
'cu'] .
"memberacctrights":
877 case "memberacctrights":
879 "_primary-columns" => array(
"user_id",
"accountnumber",
"whichright"),
880 "_tablename" => $pHbEnv[
'cu'] .
"memberacctrights",
881 "_required-columns" => array(
"user_id",
"accountnumber",
"whichright",
"allowed"),
882 "_takesnapshot" =>
true,
884 "user_id" => array(
"type" => DBTYPE_INTEGER),
885 "accountnumber" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
886 "whichright" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 6),
887 "allowed" => array(
"type" => DBTYPE_BOOLEAN),
888 "platform" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 255)
892 case $pHbEnv[
'cu'] .
"accountbalance":
893 case "accountbalance":
895 "_primary-columns" => array(
"accountnumber",
"accounttype",
"certnumber"),
896 "_tablename" => $pHbEnv[
'cu'] .
"accountbalance",
897 "_required-columns" => array(
"accountnumber",
"accounttype",
"certnumber"),
898 "_takesnapshot" =>
false,
900 "accountnumber" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
901 "accounttype" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 25),
902 "certnumber" => array(
"type" => DBTYPE_INTEGER),
903 "deposittype" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
904 "description" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 255),
905 "amount" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
906 "ytdinterest" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
907 "available" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
908 "micraccount" => array(
"type" => DBTYPE_CHAR,
"maxlength" =>
"17"),
909 "may_deposit" => array(
"type" => DBTYPE_BOOLEAN),
910 "may_withdraw" => array(
"type" => DBTYPE_BOOLEAN),
911 "interestrate" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,4"),
912 "maturitydate" => array(
"type" => DBTYPE_TIMESTAMP),
913 "misc1" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 255),
914 "balance_stamp" => array(
"type" => DBTYPE_BIGINT),
915 "history_stamp" => array(
"type" => DBTYPE_BIGINT),
916 "balance_attempt" => array(
"type" => DBTYPE_BIGINT),
917 "history_attempt" => array(
"type" => DBTYPE_BIGINT),
918 "regdcount" => array(
"type" => DBTYPE_SMALLINT),
919 "lastyrinterest" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2")
924 case $pHbEnv[
'cu'] .
"accounthistory":
925 case "accounthistory":
927 "_primary-columns" => array(
"accountnumber",
"accounttype",
"certnumber",
"tracenumber"),
928 "_tablename" => $pHbEnv[
'cu'] .
"accounthistory",
929 "_required-columns" => array(
"accountnumber",
"accounttype",
"certnumber",
"tracenumber",
"date",
"amount",
"balance"),
930 "_takesnapshot" =>
true,
932 "accountnumber" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
933 "accounttype" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 25),
934 "certnumber" => array(
"type" => DBTYPE_INTEGER),
935 "tracenumber" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 20),
936 "checknumber" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 9),
937 "date" => array(
"type" => DBTYPE_TIMESTAMP),
938 "amount" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
939 "description" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 255),
940 "balance" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
941 "loaddate" => array(
"type" => DBTYPE_TIMESTAMP),
942 "sortkey" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 16)
946 case $pHbEnv[
'cu'] .
"loanbalance":
949 "_primary-columns" => array(
"accountnumber",
"loannumber"),
950 "_tablename" => $pHbEnv[
'cu'] .
"loanbalance",
951 "_required-columns" => array(
"accountnumber",
"loannumber"),
952 "_takesnapshot" =>
false,
954 "accountnumber" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
955 "loannumber" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 25),
956 "currentbalance" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
957 "payoff" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
958 "paymentamount" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
959 "nextduedate" => array(
"type" => DBTYPE_TIMESTAMP),
960 "description" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 255),
961 "interestrate" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,4"),
962 "creditlimit" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
963 "ytdinterest" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
964 "misc1" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 255),
965 "cbtype" => array(
"type" => DBTYPE_CHAR,
"maxlength" =>
"17"),
966 "lastpaymentdate" => array(
"type" => DBTYPE_TIMESTAMP),
967 "balance_stamp" => array(
"type" => DBTYPE_BIGINT),
968 "history_stamp" => array(
"type" => DBTYPE_BIGINT),
969 "balance_attempt" => array(
"type" => DBTYPE_BIGINT),
970 "history_attempt" => array(
"type" => DBTYPE_BIGINT),
971 "may_payment" => array(
"type" => DBTYPE_BOOLEAN),
972 "may_addon" => array(
"type" => DBTYPE_BOOLEAN),
973 "currentdue" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
974 "lastyrinterest" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
975 "unpaidinterest" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
976 "frequencyperyear" => array(
"type" => DBTYPE_SMALLINT),
977 "originalamount" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
978 "originaldate" => array(
"type" => DBTYPE_TIMESTAMP),
979 "term" => array(
"type" => DBTYPE_INTEGER),
980 "creditdisability" => array(
"type" => DBTYPE_CHAR,
"maxlength" =>
"1"),
981 "creditlife" => array(
"type" => DBTYPE_CHAR,
"maxlength" =>
"1")
985 case $pHbEnv[
'cu'] .
"loanhistory":
988 "_primary-columns" => array(
"accountnumber",
"loannumber",
"tracenumber"),
989 "_tablename" => $pHbEnv[
'cu'] .
"loanhistory",
990 "_required-columns" => array(
"accountnumber",
"loannumber",
"tracenumber",
"date",
"principleamount",
"interestamount"),
991 "_takesnapshot" =>
true,
993 "accountnumber" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
994 "loannumber" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 25),
995 "tracenumber" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 20),
996 "date" => array(
"type" => DBTYPE_TIMESTAMP),
997 "principleamount" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
998 "interestamount" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
999 "description" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 255),
1000 "balance" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
1001 "sortkey" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 16),
1002 "fee" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
1003 "escrow" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2")
1007 case $pHbEnv[
'cu'] .
"holds":
1010 "_primary-columns" => array(
"accountnumber",
"accounttype",
"certnumber",
"tracenumber"),
1011 "_tablename" => $pHbEnv[
'cu'] .
"loanhistory",
1012 "_required-columns" => array(
"accountnumber",
"accounttype",
"certnumber",
"holdtype",
"tracenumber",
"postdate",
"amount",
"description"),
1013 "_takesnapshot" =>
true,
1015 "accountnumber" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
1016 "accounttype" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 25),
1017 "certnumber" => array(
"type" => DBTYPE_INTEGER,),
1018 "holdtype" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
1019 "tracenumber" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 20),
1020 "postdate" => array(
"type" => DBTYPE_TIMESTAMPTZ),
1021 "expiredate" => array(
"type" => DBTYPE_TIMESTAMPTZ),
1022 "amount" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"11,2"),
1023 "description" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 255)
1028 case $pHbEnv[
'cu'] .
"crossaccounts":
1029 case "crossaccounts":
1031 "_primary-columns" => array(
"accountnumber",
"tomember",
"accounttype",
"deposittype"),
1032 "_tablename" => $pHbEnv[
'cu'] .
"crossaccounts",
1033 "_required-columns" => array(
"accountnumber",
"tomember",
"accounttype",
"deposittype"),
1034 "_takesnapshot" =>
true,
1036 "accountnumber" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
1037 "tomember" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
1038 "accounttype" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
1039 "deposittype" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
1040 "description" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 255),
1041 "misc1" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 255)
1047 "_primary-columns" => array(
"cu"),
1048 "_tablename" =>
"cuadmin",
1049 "_required-columns" => array(
"cu"),
1050 "_takesnapshot" =>
true,
1052 "cu" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 10),
1053 "user_name" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
1054 "passwd" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 255),
1055 "vendor" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 15),
1056 "nextbatch" => array(
"type" => DBTYPE_INTEGER),
1057 "fid" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 6),
1058 "t" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 3),
1059 "db" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
1060 "mtx" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
1061 "mxcu" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 36),
1062 "img" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 10),
1063 "rt" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
1064 "orgname" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 36),
1065 "livebatch" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
1066 "cc" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
1067 "pname" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 20),
1068 "liveport" => array(
"type" => DBTYPE_INTEGER),
1069 "livewait" => array(
"type" => DBTYPE_INTEGER),
1070 "lastupdate" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 30),
1071 "from_name" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 35),
1072 "from_email" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 50),
1073 "stmt_msg" => array(
"type" =>
"text"),
1074 "email_footer" => array(
"type" =>
"text"),
1075 "liveserver" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 100),
1076 "retrylimit" => array(
"type" => DBTYPE_INTEGER),
1077 "upllaststart" => array(
"type" => DBTYPE_TIMESTAMPTZ),
1078 "upllaststat" => array(
"type" => DBTYPE_INTEGER),
1079 "tranformat" => array(
"type" => DBTYPE_SMALLINT),
1080 "ahdropdays" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 4),
1081 "lhdropdays" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 4),
1082 "upllastend" => array(
"type" => DBTYPE_TIMESTAMPTZ),
1083 "trandropdays" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 4),
1084 "trandropbatches" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 4),
1085 "tz" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 25),
1086 "histtrunc" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
1087 "showavailable" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
1088 "gracelimit" => array(
"type" => DBTYPE_INTEGER),
1089 "pwdays" => array(
"type" => DBTYPE_INTEGER),
1090 "flagset" => array(
"type" => DBTYPE_BIGINT),
1091 "histdays" => array(
"type" => DBTYPE_INTEGER),
1092 "surveyintro" => array(
"type" => DBTYPE_VARCHAR),
1093 "tranfldsep" => array(
"type" => DBTYPE_INTEGER),
1094 "traneol" => array(
"type" => DBTYPE_INTEGER),
1095 "bp_cuid" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 9),
1096 "bp_secret" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 255),
1097 "flagset2" => array(
"type" => DBTYPE_BIGINT),
1098 "dep_exp_days" => array(
"type" => DBTYPE_SMALLINT),
1099 "ccinfourl" => array(
"type" => DBTYPE_VARCHAR),
1100 "min_chlng_qst" => array(
"type" => DBTYPE_SMALLINT),
1101 "cookie_ver" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
1102 "loginscript" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 50),
1103 "offlinestat" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
1104 "offlineblurb" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 255),
1105 "bp_vendor" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 10),
1106 "ssovendor" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 10),
1107 "ckhexkey" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 50),
1108 "ckorgid" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 20),
1109 "ckurl" => array(
"type" => DBTYPE_VARCHAR),
1110 "trmemomaxlen" => array(
"type" => DBTYPE_SMALLINT),
1111 "flagset3" => array(
"type" => DBTYPE_BIGINT),
1112 "livesetup" => array(
"type" => DBTYPE_BIGINT),
1113 "pwdconfig" => array(
"type" => DBTYPE_VARCHAR),
1114 "ip_acl" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 500),
1115 "maskconfig" => array(
"type" => DBTYPE_VARCHAR)
1119 case "cuadmemailtmpl":
1121 "_primary-columns" => array(
"tmpl_id"),
1122 "_tablename" =>
"cuadmemailtmpl",
1123 "_required-columns" => array(
"tmpl_id"),
1124 "_takesnapshot" =>
true,
1126 "tmpl_id" => array(
"type" => DBTYPE_SERIAL),
1127 "tmpl_name" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 50),
1128 "tmpl_email" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 100),
1129 "tmpl_email_name" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 100),
1130 "tmpl_subject" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 255),
1131 "tmpl_message" => array(
"type" => DBTYPE_VARCHAR),
1132 "tmpl_opt_mailto" => array(
"type" => DBTYPE_SMALLINT),
1133 "tmpl_opt_mbr" => array(
"type" => DBTYPE_SMALLINT),
1134 "tmpl_lastmodified" => array(
"type" => DBTYPE_TIMESTAMPTZ),
1135 "tmpl_lastused" => array(
"type" => DBTYPE_TIMESTAMPTZ),
1136 "cu" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 10)
1142 "_primary-columns" => array(
"cu",
"role"),
1143 "_tablename" =>
"cuadmnotify",
1144 "_required-columns" => array(
"cu",
"role"),
1145 "_takesnapshot" =>
true,
1147 "cu" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 10),
1148 "role" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 15),
1149 "email" => array(
"type" => DBTYPE_VARCHAR)
1155 "_primary-columns" => array(
"contactid"),
1156 "_tablename" =>
"cucontact",
1157 "_required-columns" => array(
"user_name",
"priority",
"contactid"),
1158 "_takesnapshot" =>
true,
1160 "user_name" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
1161 "priority" => array(
"type" => DBTYPE_SMALLINT),
1162 "name" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 35),
1163 "phone" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 15),
1164 "comments" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 255),
1165 "contactid" => array(
"type" => DBTYPE_SERIAL)
1170 case $pHbEnv[
'cu'] .
"usercontact":
1173 "_primary-columns" => array(
"contact_id"),
1174 "_tablename" => $pHbEnv[
'cu'] .
"usercontact",
1175 "_required-columns" => array(
"contact_id"),
1176 "_takesnapshot" =>
true,
1178 "contact_id" => array(
"type" => DBTYPE_SERIAL),
1179 "address1" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 100),
1180 "address2" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 100),
1181 "city" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 30),
1182 "state" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 30),
1183 "zip" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 9),
1184 "phones" => array(
"type" => DBTYPE_VARCHAR)
1192 "_primary-columns" => array(
""),
1193 "_tablename" =>
"cuusers",
1194 "_required-columns" => array(
"cu",
"user_name",
"passwd"),
1195 "_takesnapshot" =>
true,
1197 "cu" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 10),
1198 "user_name" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
1199 "passwd" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 34),
1200 "pktdate" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 30),
1201 "pktstamp" => array(
"type" => DBTYPE_BIGINT),
1202 "email" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 50),
1203 "estmt_flag" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
1204 "egenl_flag" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
1205 "failedremain" => array(
"type" => DBTYPE_INTEGER),
1206 "forcechange" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
1207 "forceremain" => array(
"type" => DBTYPE_INTEGER),
1208 "lastlogin" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 20),
1209 "priorlogin" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 20),
1210 "failedlogin" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 20),
1211 "pwchange" => array(
"type" => DBTYPE_TIMESTAMPTZ),
1212 "msg_tx" => array(
"type" => DBTYPE_SMALLINT),
1213 "billpayid" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
1214 "employee" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 1),
1215 "depositlimit" => array(
"type" => DBTYPE_NUMERIC,
"precision" =>
"12,2"),
1216 "userflags" => array(
"type" => DBTYPE_INTEGER),
1217 "confidence" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 20),
1218 "user_alias" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 50),
1219 "challenge_quest_id" => array(
"type" => DBTYPE_INTEGER),
1220 "pktattempt" => array(
"type" => DBTYPE_BIGINT),
1221 "txlist" => array(
"type" => DBTYPE_VARCHAR)
1226 case "cucorerequests":
1228 "_primary-columns" => array(
"id"),
1229 "_tablename" =>
"cucorerequests",
1230 "_required-columns" => array(
"id"),
1231 "_takesnapshot" =>
true,
1233 "id" => array(
"type" => DBTYPE_INTEGER),
1234 "cu" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
1235 "appliance_ip" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 100),
1236 "accountnumber" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 12),
1237 "request_type" => array(
"type" => DBTYPE_VARCHAR,
"maxlength" => 20),
1238 "request_url" => array(
"type" => DBTYPE_VARCHAR),
1239 "request_start" => array(
"type" => DBTYPE_TIMESTAMP),
1240 "request_end" => array(
"type" => DBTYPE_TIMESTAMP),
1241 # request_elapsed: actual type is integer, but we evaluate a
string 1242 # expression during the update to
get the value
for this column
1243 "request_elapsed" => array(
"type" => DBTYPE_CUSTOM_EXPRESSION),
1244 "request_status" => array(
"type" => DBTYPE_VARCHAR),
1245 "remote_ip" => array(
"type" => DBTYPE_CHAR,
"maxlength" => 15)
1252 if (count($pTableVariables) > 0)
1254 foreach($retTDAry[
"_cols"] as $col)
1256 if(!isset($retTDAry[
"_primary-columns"][$col]) && !isset($pTableVariables[$col]))
1257 unset($retTDAry[
"_cols"][$col]);
1261 $retTDAry= array($pTableCode => $retTDAry);
1276 function GetTableSelectSql($pTableSchema, $pValuesAry = array(), $pAllValues=
false) {
1282 $pValuesAry = (is_array($pValuesAry) ? $pValuesAry : array());
1284 if (HCU_array_key_exists(
'_cols', $pTableSchema) && HCU_array_key_value(
'_tablename', $pTableSchema) !=
'') {
1286 $primaryColumns = HCU_array_key_value(
'_primary-columns', $pTableSchema);
1287 $primaryColumns = is_array($primaryColumns) ? array_flip($primaryColumns) : array();
1289 foreach ($pTableSchema[
'_cols'] as $colName => $colAttr) {
1290 $sqlSelect .= ($sqlSelect !=
'' ?
', ' :
'') . $colName;
1295 if (HCU_array_key_value($colName, $pValuesAry) && (HCU_array_key_exists($colName, $primaryColumns) || $pAllValues))
1297 $colValue = $pValuesAry[$colName];
1303 $sqlWhere .= ($sqlWhere !=
'' ?
" AND " :
"") .
" $colName = " . db_build_expr_value($colValue, $colAttr);
1307 $retSql =
"SELECT $sqlSelect FROM {$pTableSchema['_tablename']} " . ($sqlWhere !=
'' ?
" WHERE $sqlWhere" :
"");
1325 function GetDataUpdatedColumnsOnly($pSingleRecord) {
1327 $ignoreList = array(
"_action");
1330 $retData = array_diff_key($pSingleRecord, array_flip($ignoreList));
1383 function SetAuditRecord ($pDbh, $pHbEnv, $pMc, $pAuditUser, $pAction, $pAppContext, $pCodeContext, $pAuditType, $pFullDesc, $pUserName, $pEmail, $pIp, $pRecBefore, $pRecAfter,
1384 $pBuildSqlOnly =
false, $pAccountNumber =
"") {
1389 $retVal = array(
"code" =>
"000",
1390 "errors" => array(),
1396 if (!HCU_array_key_exists(
'cu', $pHbEnv)) {
1397 throw new exception (
'Environment Config Error',
'900');
1398 }
else if (trim($pHbEnv[
'cu']) ==
'') {
1399 throw new exception (
'CU Config Error',
'901');
1402 $insAuditRec = array(
1403 "_action" =>
'create',
1404 "user_id" => $pAuditUser,
1405 "auditdate" => DBTIMESTAMP_USETS,
1406 "auditaction" => $pAction,
1407 "auditsrctype" => $pAuditType,
1408 "auditsrcuser_name" => $pUserName,
1409 "auditsrcemail" => $pEmail,
1410 "auditrecbefore" => $pRecBefore,
1411 "auditrecafter" => $pRecAfter,
1412 "auditsrcip" => $pIp,
1413 "auditsrcapp_context" => $pAppContext,
1414 "auditsrccode_context" => $pCodeContext,
1415 "auditfulldesc" => $pFullDesc,
1416 "accountnumber" => $pAccountNumber
1418 $updResult = SetDataTableUpdate($pDbh, $pHbEnv, $pMc,
"audituser", $insAuditRec, $pBuildSqlOnly);
1422 $retVal[
'data'][
'sql'] = HCU_array_key_value(
'sql', $updResult[
'data']);
1424 throw new exception (
'Audit Record Update Error',
'903');
1459 }
catch (exception $e){
1460 $retVal[
'code'] = $e->getCode();
1461 $retVal[
'error'][] = $e->getMessage();
1462 $retVal[
'data'] = array();
1500 function SetAdminAuditRecord ($pDbh, $pHbEnv, $pAuditUser, $pAction, $pCodeContext, $pAuditType, $pFullDesc, $pUserName, $pEmail, $pIp, $pRecBefore, $pRecAfter, $pBuildSqlOnly=
false)
1504 if (!HCU_array_key_exists(
'cu', $pHbEnv))
1505 throw new exception (
'Environment Config Error',
'900');
1506 if (trim($pHbEnv[
'cu']) ==
'')
1507 throw new exception (
'CU Config Error',
'901');
1509 $insAuditRec = array (
1510 "_action" =>
'create',
1511 "user_name" => $pAuditUser,
1512 "auditdate" => DBTIMESTAMP_USENOW,
1513 "auditaction" => $pAction,
1514 "auditsrctype" => $pAuditType,
1515 "auditsrcuser_name" => $pUserName,
1516 "auditsrcemail" => $pEmail,
1517 "auditrecbefore" => $pRecBefore,
1518 "auditrecafter" => $pRecAfter,
1519 "auditsrcip" => $pIp,
1520 "auditsrccode_context" => $pCodeContext,
1521 "auditfulldesc" => $pFullDesc
1524 $updResult = SetDataTableUpdate($pDbh, $pHbEnv,
null,
"auditadmin", $insAuditRec, $pBuildSqlOnly);
1527 throw new exception (
'Audit Record Update Error',
'903');
1529 catch (exception $e)
1531 return array(
"code" => $e->getCode(),
"error" => array($e->getMessage()),
"data" => array());
1534 return array(
"code" =>
"000",
"error" => array(),
"data" => array());
1567 function SetDataTableUpdate($pDbh, $pHbEnv, $pMC, $pUpdTableCode, $pUpdValues, $pBuildSqlOnly =
false) {
1572 $retVal = array(
"code" =>
"000",
1573 "errors" => array(),
1582 $tblSchemaList = GetTableDefinition($pHbEnv, $pUpdTableCode);
1583 if (!HCU_array_key_exists($pUpdTableCode, $tblSchemaList)) {
1585 throw new Exception(
"Table Schema Not Found",
'901');
1587 $tblSchema = $tblSchemaList[$pUpdTableCode];
1589 foreach($tblSchema[
"_cols"] as $col => $colInfo)
1591 if (isset($colInfo[
"defaultValue"]) && !isset($pUpdValues[$col]))
1592 $pUpdValues[$col]= $colInfo[
"defaultValue"];
1597 if (!HCU_array_key_exists(
'_action', $pUpdValues)) {
1598 throw new Exception (
"Unknown data action encountered",
"902");
1606 $reqColumns = HCU_array_key_value(
"_primary-columns", $tblSchema);
1607 if (count($reqColumns) !== count(array_intersect_key(array_flip($reqColumns), $pUpdValues))) {
1608 throw new Exception (
"Required Columns Missing",
"903");
1618 switch (strtolower($pUpdValues[
'_action'])) {
1632 foreach ( GetDataUpdatedColumnsOnly($pUpdValues) as $colName => $colValue) {
1638 $colAttr = HCU_array_key_value($colName, $tblSchema[
'_cols']);
1643 $sqlInsertCols .= ($sqlInsertCols !=
'' ?
', ' :
'') . $colName;
1644 $sqlInsertVals .= ($sqlInsertVals !=
'' ?
', ' :
'') . db_build_expr_value($colValue, $colAttr);
1647 $retSql =
"INSERT INTO {$tblSchema['_tablename']} ($sqlInsertCols) VALUES ($sqlInsertVals) RETURNING " . implode(
', ', array_keys(GetDataUpdatedColumnsOnly($pUpdValues))) .
"; ";
1659 foreach ( array_diff_key(GetDataUpdatedColumnsOnly($pUpdValues), array_flip(HCU_array_key_value(
"_primary-columns", $tblSchema))) as $colName => $colValue) {
1665 $colAttr = HCU_array_key_value($colName, $tblSchema[
'_cols']);
1670 $sqlUpdate .= ($sqlUpdate !=
'' ?
", " :
"") .
" $colName = " . db_build_expr_value($colValue, $colAttr);
1673 $primaryColumns = HCU_array_key_value(
'_primary-columns', $tblSchema);
1674 $primaryColumns = is_array($primaryColumns) ? array_flip($primaryColumns) : array();
1676 foreach (array_keys($primaryColumns) as $colName) {
1677 if (HCU_array_key_exists($colName, $primaryColumns)) {
1679 $colValue = $pUpdValues[$colName];
1680 $colAttr = HCU_array_key_value($colName, $tblSchema[
'_cols']);
1682 $sqlWhere .= ($sqlWhere !=
'' ?
" AND " :
"") .
" $colName = " . db_build_expr_value($colValue, $colAttr);
1689 $retSql =
"UPDATE {$tblSchema['_tablename']} SET $sqlUpdate WHERE $sqlWhere RETURNING " . implode(
', ', array_keys(GetDataUpdatedColumnsOnly($pUpdValues))) .
"; ";
1702 $primaryColumns = HCU_array_key_value(
'_primary-columns', $tblSchema);
1703 $primaryColumns = is_array($primaryColumns) ? array_flip($primaryColumns) : array();
1706 foreach (array_keys($primaryColumns) as $colName) {
1707 if (HCU_array_key_exists($colName, $primaryColumns)) {
1709 $colValue = $pUpdValues[$colName];
1710 $colAttr = HCU_array_key_value($colName, $tblSchema[
'_cols']);
1712 $sqlWhere .= ($sqlWhere !=
'' ?
" AND " :
"") .
" $colName = " . db_build_expr_value($colValue, $colAttr);
1719 $retSql =
"DELETE FROM {$tblSchema['_tablename']} WHERE $sqlWhere; ";
1723 throw new Exception (
"Unknown Data Action",
"904");
1726 if (!$pBuildSqlOnly) {
1728 if (strtolower($pUpdValues[
'_action']) ==
'delete') {
1730 if (db_query($retSql, $pDbh)) {
1731 $retVal[
'data'][
'row'][$pUpdTableCode][] = array();
1736 throw new exception (
'Database Query Failed',
'902');
1739 $retRows[$pUpdTableCode] = GetAllRowsFromSql($pDbh, $retSql);
1740 if ($retRows[$pUpdTableCode] !==
false) {
1741 $retVal[
'data'][
'row'] = $retRows;
1742 } elseif (db_last_error() !=
"") {
1746 throw new exception (
'Database Query Failed',
'902');
1749 $retVal[
'data'][
'row'] = $retRows;
1753 $retVal[
'data'][
'sql'] = $retSql;
1755 }
catch (exception $e){
1756 $retVal[
'code'] = $e->getCode();
1757 $retVal[
'errors'][] = $e->getMessage();
1776 function Update_User_Settings($p_dbh, $p_hb_env, $p_mc, $p_upd_fields, $p_transaction) {
1810 $retAry = Array(
"status" => Array (
"code" =>
"",
"severity" =>
"",
"errors" => Array()));
1812 $whatUpdated = array(
"email" =>
false,
"password" =>
false,
"questions" =>
false,
1813 "alias" =>
false,
"confidence" =>
false,
"old_email" =>
"",
1814 "new_email" =>
"" );
1816 $trans_failed =
false;
1818 $EMAIL_FLAG = GetMsgTxValue(
'MSGTX_FORCE_EM');
1841 $userDataRecordChanges = Array(
"_action" =>
"update",
1842 "user_id" => $p_hb_env[
'Uid'],
1843 "user_name" => $p_hb_env[
'Cn']
1847 HCU_array_key_exists(
"settings_contact", $p_upd_fields) ? $userDataRecordChanges[
"contact"] = $p_upd_fields[
"settings_contact"] :
null;
1850 HCU_array_key_exists(
"settings_mfadate", $p_upd_fields) ? $userDataRecordChanges[
"mfaquest"] = $p_upd_fields[
"settings_mfadate"] :
null;
1854 if (isset($p_upd_fields[
'settings_email']) && !$trans_failed) {
1858 if ( !$trans_failed && strcmp( $p_hb_env[
"Ml"], $p_upd_fields[
'settings_email'][
"email"] ) != 0 ) {
1859 $whatUpdated[
"email"] =
true;
1862 $whatUpdated[
"new_email"] = $p_upd_fields[
"settings_email"][
"email"];
1865 $whatUpdated[
"old_email"] = $p_hb_env[
"Ml"];
1875 $userDataRecordChanges[
'email'] = $p_upd_fields[
"settings_email"][
"email"];
1876 $userDataRecordChanges[
'egenl_flag'] = $p_upd_fields[
"settings_email"][
"egenl"];
1883 if (HCU_array_key_exists(
'verify', $p_upd_fields[
'settings_email'])) {
1888 $curEmail = $p_hb_env[
'Ml'];
1889 if (($curEmail != $p_upd_fields[
"settings_email"][
"email"]) || (HCU_array_key_value(
'valid', $p_upd_fields[
"settings_email"]) ==
"Y")) {
1891 $tmpVal = ~(~(int)$p_hb_env[
'Fmsg_tx'] | HCUTEMP_FLAGS);
1894 $tmpVal = ~(~$tmpVal | $EMAIL_FLAG);
1896 $userDataRecordChanges[
'msg_tx'] = $tmpVal;
1904 if (isset($p_upd_fields[
'settings_password']) && !$trans_failed) {
1909 if (HCU_array_key_exists(
'newpasswd', $p_upd_fields[
'settings_password'])) {
1910 $userDataRecordChanges[
'passwd'] = password_hash($p_upd_fields[
'settings_password'][
'newpasswd'], PASSWORD_DEFAULT);
1911 $userDataRecordChanges[
'forcechange'] =
'N';
1912 $userDataRecordChanges[
'pwchange'] = DBTIMESTAMP_USENOW;
1914 $whatUpdated[
"password"] =
true;
1921 if (isset($p_upd_fields[
'settings_alias']) && !$trans_failed) {
1922 $userDataRecordChanges[
'user_name'] = $p_upd_fields[
'settings_alias'][
'username'];
1924 $whatUpdated[
"alias"] =
true;
1930 if (isset($p_upd_fields[
'settings_confidence']) && !$trans_failed) {
1931 $userDataRecordChanges[
'confidence'] = $p_upd_fields[
'settings_confidence'][
'confword'];
1933 if (HCU_array_key_exists(
'userflags', $p_upd_fields[
'settings_confidence'])) {
1934 $userDataRecordChanges[
'userflags'] = $p_upd_fields[
'settings_confidence'][
'userflags'];
1937 $whatUpdated[
"confidence"] =
true;
1943 if (isset($p_upd_fields[
'settings_questions']) && !$trans_failed) {
1944 # note mfaquest array may contain Array("answers", "challenge", "authcode", "authexpires", "mfadate"); 1945 # this will throw away everything and only save the answers - and now I'm adding the mfadate 1946 $mfaAnswers = Array();
1947 if (is_array($p_upd_fields[
'settings_questions'])) {
1949 for ($qIdx = 0; $qIdx < count($p_upd_fields[
'settings_questions']); $qIdx++) {
1950 $mfaAnswers[$p_upd_fields[
'settings_questions'][$qIdx][
'cqid']] = $p_upd_fields[
'settings_questions'][$qIdx][
'display'];
1953 $mfaArray = Array(
"answers" => $mfaAnswers);
1954 $mfaArray[
'mfadate'] = time();
1955 $userDataRecordChanges[
'mfaquest'] = PrepareMfaQuestString($mfaArray);
1957 $whatUpdated[
"questions"] =
true;
1965 $updateTableArray = Array(
"user" => Array($userDataRecordChanges));
1968 if (!($trans_rs = db_query(
"begin transaction", $p_dbh))) {
1969 $trans_failed =
true;
1972 if ( !$trans_failed ) {
1975 $updateResults = DataUserTableUpdate($p_dbh, $p_hb_env, $p_mc, $updateTableArray, $p_hb_env[
'Uid'],
'U_UPD',
'U', $p_hb_env[
'currentscript'],
'U',
"Required Profile Update", $p_hb_env[
'Cn'], $p_hb_env[
'Ml'], $p_hb_env[
'remoteIp']);
1976 if ( !$updateResults ) {
1977 $trans_failed =
true;
1982 if ($trans_failed) {
1984 $upd_rs = db_query(
"rollback transaction", $p_dbh);
1986 $retAry[
'status'][
'code'] =
'999';
1987 $retAry[
'status'][
'severity'] =
'ERROR';
1988 $retAry[
'status'][
'errors'][] = $p_mc->msg(
"Error Occurred updating settings");
1991 if (!$upd_rs = db_query(
"commit transaction", $p_dbh)) {
1993 $retAry[
'status'][
'code'] =
'999';
1994 $retAry[
'status'][
'severity'] =
'ERROR';
1995 $retAry[
'status'][
'errors'][] = $p_mc->msg(
"Error Occurred updating settings");
1998 NotifyUserOfChange( $p_dbh, $p_hb_env, $whatUpdated, $p_mc );
2001 $retAry[
'status'][
'code'] =
'000';
2002 $retAry[
'status'][
'severity'] =
"SUCCESS";
2160 function Update_User_Security($p_dbh, $p_hb_env, $p_mc, &$p_upd_fields) {
2162 $securityPhones = HCU_JsonEncode($p_upd_fields[
'settings_phones']);
2163 $shones = prep_save($securityPhones);
2164 $shones = trim($securityPhones);
2168 $sql =
"SELECT contact, mfaquest FROM {$p_hb_env['Cu']}user WHERE user_name = '{$p_hb_env['Cn']}'";
2169 $sqlRs = db_query($sql, $p_dbh);
2171 throw new Exception(
"Error reading user security settings.", 100);
2174 $sqlData = db_fetch_assoc($sqlRs, 0);
2175 $sqlContact = intval($sqlData[
'contact']);
2176 $sqlMfaQuest = HCU_JsonDecode($sqlData[
'mfaquest']);
2179 $sqlMfaQuest[
'mfadate'] = time();
2180 $sqlMfaQuest = HCU_JsonEncode($sqlMfaQuest);
2182 $p_upd_fields [
"settings_mfadate"] = $sqlMfaQuest;
2184 $contactUpdate = array(
"phones" => $securityPhones);
2186 if ($sqlContact === 0) {
2187 $sql =
"select nextval('" . $p_hb_env[
'Cu'] .
"usercontact_contact_id_seq'::regclass)";
2188 $sth = db_query($sql, $p_dbh);
2190 throw new exception(
"Error getting next contact id.", 101);
2193 $sqlContact = db_fetch_row($sth, 0);
2194 $sqlContact = intval($sqlContact[0]);
2195 $contactUpdate[
"_action"] =
"insert";
2196 $contactUpdate[
"contact_id"] = $sqlContact;
2198 $contactUpdate[
"_action"] =
"update";
2199 $contactUpdate[
"contact_id"] = $sqlContact;
2202 $p_upd_fields [
"settings_contact"] = $sqlContact;
2204 $userUpdate = array(
"usercontact" => array($contactUpdate));
2206 if (!DataUserTableUpdate($p_dbh, $p_hb_env, $p_mc, $userUpdate, $p_hb_env[
'Uid'],
'U_UPD',
'U', $p_hb_env[
'currentscript'],
'U',
"Update User Security", $p_hb_env[
'Cn'],
2207 $p_hb_env[
'Ml'], $p_hb_env[
'remoteIp'])) {
2208 throw new exception(
"User Update Failed.", 103);
2212 $returnArray = array(
"status" => array(
"code" =>
"000",
"severity" =>
"SUCCESS",
"errors" => array()));
2213 }
catch (exception $e) {
2214 $returnArray = array(
"status" => array(
"code" =>
"999",
"severity" =>
"ERROR",
"errors" => array($e->getMessage())));
2217 return $returnArray;
2231 function DEPRECATED_Update_Settings($p_dbh, $p_hb_env, $p_upd_fields, $p_transaction, $p_mc) {
2266 $retAry = Array(
"status" => Array (
"code" =>
"",
"severity" =>
"",
"errors" => Array()));
2268 $whatUpdated = array(
"email" =>
false,
"password" =>
false,
"questions" =>
false,
2269 "alias" =>
false,
"confidence" =>
false,
"old_email" =>
"",
2270 "new_email" =>
"" );
2272 $trans_failed =
false;
2284 if ($time_rs = db_query(
"select now();", $p_dbh)) {
2285 list($chnow) = db_fetch_array($time_rs, 0);
2288 $trans_failed =
true;
2292 if ($p_transaction && !$trans_failed) {
2293 if (!($trans_rs = db_query(
"begin transaction", $p_dbh))) {
2294 $trans_failed =
true;
2299 $whatUpdated[
"old_email"] = $p_hb_env[
"Ml"];
2302 $trans_failed = Update_AuditMember($p_dbh, $p_hb_env, 0, $chnow, $p_transaction, $sBuildSql);
2306 if (isset($p_upd_fields[
'settings_email']) && !$trans_failed) {
2308 $trans_failed = Update_SettingsEmail($p_dbh, $p_hb_env, $p_upd_fields[
'settings_email'], $p_transaction, $sBuildSql);
2310 if ( !$trans_failed && strcmp( $p_hb_env[
"Ml"], $p_upd_fields[
'settings_email'][
"email"] ) != 0 ) {
2311 $whatUpdated[
"email"] =
true;
2314 $whatUpdated[
"new_email"] = $p_upd_fields[
"settings_email"][
"email"];
2319 if (isset($p_upd_fields[
'settings_password']) && !$trans_failed) {
2321 $trans_failed = Update_SettingsPassword($p_dbh, $p_hb_env, $p_upd_fields[
'settings_password'], $p_transaction, $sBuildSql);
2323 if ( !$trans_failed && array_key_exists(
'newpasswd', $p_upd_fields[
'settings_password']) ) {
2324 $whatUpdated[
"password"] =
true;
2330 if (isset($p_upd_fields[
'settings_alias']) && !$trans_failed) {
2331 $trans_failed = Update_SettingsAlias($p_dbh, $p_hb_env, $p_upd_fields[
'settings_alias'], $p_transaction, $sBuildSql);
2333 if ( !$trans_failed ) {
2334 $whatUpdated[
"alias"] =
true;
2339 if (isset($p_upd_fields[
'settings_confidence']) && !$trans_failed) {
2340 $trans_failed = Update_SettingsConfidence($p_dbh, $p_hb_env, $p_upd_fields[
'settings_confidence'], $p_transaction, $sBuildSql);
2342 if ( !$trans_failed ) {
2343 $whatUpdated[
"confidence"] =
true;
2348 if (isset($p_upd_fields[
'settings_questions']) && !$trans_failed) {
2350 $trans_failed = Update_SettingsChallenge($p_dbh, $p_hb_env, $p_upd_fields[
'settings_questions'], $p_transaction, $sBuildSql);
2352 if ( !$trans_failed ) {
2353 $whatUpdated[
"questions"] =
true;
2358 if (isset($p_upd_fields[
'settings_desc']) && !$trans_failed) {
2360 $trans_failed = Update_SettingsDesc($p_dbh, $p_hb_env, $p_upd_fields[
'settings_desc'], $p_transaction, $sBuildSql);
2366 $trans_failed = Update_AuditMember($p_dbh, $p_hb_env, 1, $chnow, $p_transaction, $sBuildSql);
2370 if ($p_transaction) {
2372 if ($trans_failed) {
2374 $upd_rs = db_query(
"rollback transaction", $p_dbh);
2376 $retAry[
'status'][
'code'] =
'999';
2377 $retAry[
'status'][
'severity'] =
'ERROR';
2378 $retAry[
'status'][
'errors'][] = $p_mc->msg(
"Error Occurred updating settings");
2381 if (!$upd_rs = db_query(
"commit transaction", $p_dbh)) {
2383 $retAry[
'status'][
'code'] =
'999';
2384 $retAry[
'status'][
'severity'] =
'ERROR';
2385 $retAry[
'status'][
'errors'][] = $p_mc->msg(
"Error Occurred updating settings");
2388 NotifyUserOfChange( $p_dbh, $p_hb_env, $whatUpdated, $p_mc );
2391 $retAry[
'status'][
'code'] =
'000';
2392 $retAry[
'status'][
'severity'] =
"SUCCESS";
2398 if ($upd_rs = db_query($sBuildSql, $p_dbh)) {
2400 NotifyUserOfChange( $p_dbh, $p_hb_env, $whatUpdated, $p_mc );
2403 $retAry[
'status'][
'code'] =
'000';
2404 $retAry[
'status'][
'severity'] =
"SUCCESS";
2407 $retAry[
'status'][
'code'] =
'999';
2408 $retAry[
'status'][
'severity'] =
'ERROR';
2409 $retAry[
'status'][
'errors'][] = $p_mc->msg(
"Error Occurred updating settings");
2422 function NotifyUserOfChange( $p_dbh, $p_hb_env, $whatUpdated, $p_mc ) {
2424 $email = $whatUpdated[
"old_email"];
2426 if ( strlen( $email ) > 0 ) {
2428 $Cu = $p_hb_env[
"Cu"];
2431 $sql=
"select email from cuadmnotify 2432 where role='securitychgfrom' and cu='$Cu'";
2433 $sth = db_query($sql,$p_dbh);
2434 list($admFrom) = db_fetch_array($sth,0);
2435 $admFrom = preg_replace(
"/ +$/",
"",$admFrom);
2436 $admFrom = trim( $admFrom );
2437 db_free_result($sth);
2439 if ( strlen( $admFrom ) > 0 ) {
2443 if ( $whatUpdated[
"email"] ) {
2444 $reasonString .=
"<li>{$p_mc->msg( "Email Address
" )}</li>\n";
2446 if ( $whatUpdated[
"password"] ) {
2447 $reasonString .=
"<li>{$p_mc->msg( "Password
" )}</li>\n";
2449 if ( $whatUpdated[
"questions"] ) {
2450 $reasonString .=
"<li>{$p_mc->msg( "Updated Questions
" )}</li>\n";
2452 if ( $whatUpdated[
"alias"] ) {
2453 $reasonString .=
"<li>{$p_mc->msg( "Username
" )}</li>\n";
2455 if ( $whatUpdated[
"confidence"] ) {
2456 $reasonString .=
"<li>{$p_mc->msg( "Updated Confidence
" )}</li>\n";
2459 if ( strlen( $reasonString ) > 0 ) {
2460 $reasonReply =
"<ul>$reasonString</ul>";
2462 $sql =
"select orgname, pname from cuadmin where cu='$Cu'";
2463 $sth = db_query($sql,$p_dbh);
2464 if($sth) { list( $orgName, $pName ) = db_fetch_array($sth,0); }
2465 $orgName = trim( $orgName );
2466 $pName = trim( $pName );
2469 $msgSubject = $p_mc->combo_msg(
"Updated Settings Subject", HCU_DISPLAY_AS_HTML,
"#ORGNAME#", $orgName );
2472 $searchArray = array(
"#ORGNAME#",
"#PRODNAME#",
"#REASON#" );
2473 $replaceArray = array(
"$orgName",
"$pName", $reasonReply );
2474 $msgBody = $p_mc->combo_msg(
"Updated Settings Message", HCU_DISPLAY_AS_HTML, $searchArray, $replaceArray );
2478 $notify->header =
"Content-type: text/html";
2479 $notify->mailto = $email;
2480 $notify->mailfromname = $orgName;
2481 $notify->replyto = $admFrom;
2482 $notify->subject = $msgSubject;
2483 $notify->msgbody =
"$msgBody";
2484 $notify->callingfunction = __FUNCTION__;
2485 $notify->file = __FILE__;
2488 $notify->SendMail();
2491 if ( $whatUpdated[
"email"] && strlen( $whatUpdated[
"new_email"] ) > 0 ) {
2492 $notify->mailto = $whatUpdated[
"new_email"];
2494 $notify->SendMail();
2514 function DEPRECATED_Update_SettingsEmail($p_dbh, $p_hb_env, $p_values, $p_transaction, &$p_build_sql) {
2516 $retFuncFailed =
false;
2518 $EMAIL_FLAG = GetMsgTxValue(
'MSGTX_FORCE_EM');
2521 if (array_key_exists(
'verify', $p_values)) {
2523 $sql =
"UPDATE cuusers 2524 SET msg_tx = (coalesce(msg_tx,0)::int # $EMAIL_FLAG)::int2 2525 WHERE cu = '{$p_hb_env['Cu']}' 2526 AND lower(user_name) = '" . strtolower($p_hb_env[
'Cn']) .
"' 2527 AND (coalesce(msg_tx, 0)::int & $EMAIL_FLAG)::int2 = $EMAIL_FLAG ";
2528 if ($p_values[
'valid'] !=
"Y") {
2529 $sql .=
" AND email <> '" . prep_save($p_values[
'email'], 50) .
"' ";
2533 if ($p_transaction) {
2535 if (!$trans_rs = db_query($sql, $p_dbh)) {
2536 $retFuncFailed =
true;
2539 $p_build_sql .= $sql;
2546 $sql .=
"UPDATE cuusers 2547 SET email='" . prep_save($p_values[
'email'], 50) .
"' ";
2548 if (array_key_exists(
'egenl', $p_values)) {
2549 $egenl = (strtoupper($p_values[
'egenl'])==
"Y" ?
"Y" :
"N");
2550 $sql .=
", egenl_flag = '$egenl' ";
2552 $sql .=
"WHERE user_name='{$p_hb_env['Cn']}' and cu='{$p_hb_env['Cu']}'; ";
2554 if ($p_transaction) {
2555 if (!$trans_rs = db_query($sql, $p_dbh)) {
2556 $retFuncFailed =
true;
2560 $p_build_sql .= $sql;
2563 return $retFuncFailed;
2579 function DEPRECATED_Update_SettingsPassword($p_dbh, $p_hb_env, $p_values, $p_transaction, &$p_build_sql) {
2581 $retFuncFailed =
false;
2585 if (array_key_exists(
'newpasswd', $p_values)) {
2587 $hash = crypt($p_values[
'newpasswd']);
2589 $sql =
"UPDATE cuusers 2590 SET passwd = '$hash', 2593 WHERE lower(user_name) = '" . strtolower($p_hb_env[
'Cn']) .
"' and cu = '{$p_hb_env['Cu']}'; ";
2595 if ($p_transaction) {
2596 if (!$trans_rs = db_query($sql, $p_dbh)) {
2597 $retFuncFailed =
true;
2601 $p_build_sql .= $sql;
2605 return $retFuncFailed;
2619 function DEPRECATED_Update_SettingsAlias($p_dbh, $p_hb_env, $p_values, $p_transaction, &$p_build_sql) {
2620 $retFuncFailed =
false;
2623 $sql =
"UPDATE cuusers 2624 SET user_alias='" . prep_save($p_values[
'username'], 50) .
"' 2625 WHERE user_name = '{$p_hb_env['Cn']}' and cu = '{$p_hb_env['Cu']}' 2627 (SELECT * FROM cuusers WHERE cu = '{$p_hb_env['Cu']}' 2628 and user_name <> '{$p_hb_env['Cn']}' 2629 and user_alias = '" . prep_save($p_values[
'username'], 50) .
"'); ";
2631 if ($p_transaction) {
2632 if(!$trans_rs = db_query($sql, $p_dbh)) {
2633 $retFuncFailed =
true;
2637 $p_build_sql .= $sql;
2640 return $retFuncFailed;
2654 function DEPRECATED_Update_SettingsConfidence($p_dbh, $p_hb_env, $p_values, $p_transaction, &$p_build_sql) {
2655 global $MEM_FORCE_RESET;
2657 $retFuncFailed =
false;
2664 $sql =
"UPDATE cuusers 2665 SET confidence = '" . prep_save($p_values[
'confword'], 20) .
"', 2666 userflags = coalesce(userflags - (userflags::int4 & {$MEM_FORCE_RESET}::int4), 0) 2668 WHERE user_name = '{$p_hb_env['Cn']}' and cu = '{$p_hb_env['Cu']}'; ";
2671 if ($p_transaction) {
2672 if(!$trans_rs = db_query($sql, $p_dbh)) {
2673 $retFuncFailed =
true;
2677 $p_build_sql .= $sql;
2680 return $retFuncFailed;
2693 function DEPRECATED_Update_SettingsChallenge($p_dbh, $p_hb_env, $p_values, $p_transaction, &$p_build_sql) {
2694 $retFuncFailed =
false;
2699 $sql =
"DELETE FROM cuquestselect 2700 WHERE accountnumber = '{$p_hb_env['Cn']}' and cu = '{$p_hb_env['Cu']}'; ";
2703 foreach ($p_values as $qst_info) {
2704 $qst_id = $qst_info[
'cqid'];
2705 $qst_value = $qst_info[
'display'];
2708 $sql .=
"INSERT INTO cuquestselect 2709 (cu, accountnumber, quest_id, answer) 2711 ('{$p_hb_env['Cu']}', 2712 '{$p_hb_env['Cn']}', 2713 '" . intval($qst_id) .
"', 2714 '" . prep_save($qst_value, 50) .
"'); ";
2718 if ($p_transaction) {
2719 if(!$trans_rs = db_query($sql, $p_dbh)) {
2720 $retFuncFailed =
true;
2724 $p_build_sql .= $sql;
2727 return $retFuncFailed;
2741 function DEPRECATED_Update_SettingsDesc($p_dbh, $p_hb_env, $p_values, $p_transaction, &$p_build_sql) {
2742 $retFuncFailed =
false;
2743 if ($p_hb_env[
'live']) {
2746 $cutx =
"cubatchtx";
2751 if (is_array($p_values[
'swaccts']) &&
sizeof($p_values[
'swaccts']) > 0) {
2752 foreach ($p_values[
'swaccts'] as $swacct) {
2753 $id = trim($swacct[0]);
2754 $description = trim($swacct[1]);
2757 $description = preg_replace(
'/[\\\]/',
"", $description);
2759 $sql .=
"update {$cutx} set description = '" . prep_save($description) .
"' 2760 where id = $id and cu = '{$p_hb_env['Cu']}' and accountnumber = '{$p_hb_env['Cn']}';";
2764 if (is_array($p_values[
'xaccts']) &&
sizeof($p_values[
'xaccts']) > 0) {
2765 foreach ($p_values[
'xaccts'] as $xacct) {
2766 $id = trim($xacct[0]);
2767 $description = trim($xacct[1]);
2770 $description = preg_replace(
'/[\\\]/',
"", $description);
2772 $sql .=
"update {$cutx} set description = '" . prep_save($description) .
"' 2773 where id = $id and cu = '{$p_hb_env['Cu']}' and accountnumber = '{$p_hb_env['Cn']}';";
2777 $set_myaccount = $p_values[
'set_myaccount'];
2778 $set_myaccount = preg_replace(
'/[;"\\\]/',
"", $set_myaccount);
2780 $sql .=
"delete from {$cutx} 2781 where cu = '{$p_hb_env['Cu']}' 2782 and accountnumber = '{$p_hb_env['Cn']}' 2783 and tomember = '{$p_hb_env['Cn']}';";
2786 $sql .=
"insert into {$cutx} (cu, accountnumber, 2787 tomember, accounttype, deposittype, description, misc1) 2788 values ('{$p_hb_env['Cu']}','{$p_hb_env['Cn']}', 2789 '{$p_hb_env['Cn']}','00','W','" . prep_save($set_myaccount) .
"',NULL);";
2791 if ($p_transaction) {
2792 if (!$trans_rs = db_query($sql, $p_dbh)) {
2793 $retFuncFailed =
true;
2797 $p_build_sql .= $sql;
2800 return $retFuncFailed;
2813 function Get_PwdRules($p_dbh, $p_hb_env) {
2815 $sql =
"select pwdconfig from cuadmin where cu='{$p_hb_env["cu
"]}'";
2816 $sth = db_query($sql,$p_dbh);
2818 $row = db_fetch_array($sth,0);
2820 $pwdConfigAry = json_decode( $row[
"pwdconfig"],
true );
2823 if ( $pwdConfigAry[
"use"] == 1 ) {
2825 unset( $pwdConfigAry[
"use"] );
2827 $pwdConfigAry = array(
"len" => 6,
"digit" => 1);
2830 return $pwdConfigAry;
2853 function Validate_PwdRules($p_dbh, $p_hb_env, $p_upd_fields, $p_mc) {
2854 $retAry = Array(
"status" => Array (
"code" =>
"",
"severity" =>
"",
"errors" => Array()));
2857 $sql =
"select pwdconfig from cuadmin where cu='{$p_hb_env["cu
"]}'";
2858 $sth = db_query($sql,$p_dbh);
2860 $row = db_fetch_array($sth,0);
2862 $pwdConfigAry = json_decode( $row[
"pwdconfig"],
true );
2863 db_free_result($sth);
2865 if ( count( $pwdConfigAry ) && $pwdConfigAry[
"use"] > 0 ) {
2867 if ( $pwdConfigAry[
"len"] > 0 &&
2868 strlen( $p_upd_fields[
'settings_password'][
'newpasswd'] ) < $pwdConfigAry[
"len"] ) {
2873 $specialCharAry = explode(
",", Get_PwdSpecialCharacters() );
2881 $testString = trim( $p_upd_fields[
'settings_password'][
'newpasswd'] );
2882 for ( $i = 0; $i < strlen( $testString ); $i++ ) {
2883 $testChar = substr( $testString, $i, 1 );
2884 if (preg_match(
"/[a-z]/", $testChar) ) {
2887 }
else if (preg_match(
"/[A-Z]/", $testChar) ) {
2890 }
else if (preg_match(
"/\d/", $testChar) ) {
2892 }
else if (in_array($testChar, $specialCharAry ) ) {
2898 if (HCU_array_key_value(
"len", $pwdConfigAry) > 0) {
2899 if ( strlen( $testString ) < $pwdConfigAry[
"len"] ) {
2903 if (HCU_array_key_value(
"upper", $pwdConfigAry) > 0) {
2904 if ( $countUpper < $pwdConfigAry[
"upper"] ) {
2908 if (HCU_array_key_value(
"lower", $pwdConfigAry) > 0) {
2909 if ( $countLower < $pwdConfigAry[
"lower"] ) {
2913 if (HCU_array_key_value(
"spec", $pwdConfigAry) > 0) {
2914 if ( $countSpecial < $pwdConfigAry[
"spec"] ) {
2918 if (HCU_array_key_value(
"digit", $pwdConfigAry) > 0) {
2919 if ( $countDigits < $pwdConfigAry[
"digit"] ) {
2925 if ( $pwdErrorCount > 0 ) {
2926 $retAry[
'status'][
'errors'][] = $p_mc->msg(
'Minimum password requirement not met');
2927 $FailedCurrPassword =
true;
2930 $FailedCurrPassword = Validate_SettingsPassword($p_dbh, $p_hb_env, $p_upd_fields[
'settings_password'], $retAry[
'status'][
'errors'], $p_mc);
2933 if (count($retAry[
'status'][
'errors']) > 0) {
2935 $retAry[
'status'][
'code'] =
'999';
2936 $retAry[
'status'][
'severity'] =
'ERRORS';
2938 if ( $FailedCurrPassword ) {
2939 $retAry[
'status'][
'failed_curr_pass'] = TRUE;
2943 $retAry[
'status'][
'code'] =
'000';
2944 $retAry[
'status'][
'severity'] =
'SUCCESS';
2965 function Validate_Settings($p_dbh, $p_hb_env, $p_upd_fields, $p_mc) {
2966 $retAry = Array(
"status" => Array (
"code" =>
"",
"severity" =>
"",
"errors" => Array()));
2970 $trans_failed =
false;
2974 if (isset($p_upd_fields[
'settings_email']) && !$trans_failed) {
2975 Validate_SettingsEmail($p_dbh, $p_hb_env, $p_upd_fields[
'settings_email'], $retAry[
'status'][
'errors'], $p_mc);
2979 if (isset($p_upd_fields[
'settings_password']) && !$trans_failed) {
2980 $FailedCurrPassword = Validate_SettingsPassword($p_dbh, $p_hb_env, $p_upd_fields[
'settings_password'], $retAry[
'status'][
'errors'], $p_mc);
2984 if (isset($p_upd_fields[
'settings_phones']) && !$trans_failed) {
2985 Validate_SettingsPhones($p_dbh, $p_hb_env, $p_upd_fields[
'settings_phones'], $retAry[
'status'][
'errors'], $p_mc);
2989 if (isset($p_upd_fields[
'settings_questions']) && !$trans_failed) {
2990 Validate_SettingsChallenge($p_dbh, $p_hb_env, $p_upd_fields[
'settings_questions'], $retAry[
'status'][
'errors'], $p_mc);
2994 if (isset($p_upd_fields[
'settings_alias']) && !$trans_failed) {
2995 Validate_SettingsAlias($p_dbh, $p_hb_env, $p_upd_fields[
'settings_alias'], $retAry[
'status'][
'errors'], $p_mc);
2999 if (isset($p_upd_fields[
'settings_confidence']) && !$trans_failed) {
3000 Validate_SettingsConfidence($p_dbh, $p_hb_env, $p_upd_fields[
'settings_confidence'], $retAry[
'status'][
'errors'], $p_mc);
3004 if (isset($p_upd_fields[
'settings_desc']) && !$trans_failed) {
3005 Validate_SettingsDesc($p_dbh, $p_hb_env, $p_upd_fields[
'settings_desc'], $retAry[
'status'][
'errors'], $p_mc);
3008 if (count($retAry[
'status'][
'errors']) > 0) {
3010 $retAry[
'status'][
'code'] =
'999';
3011 $retAry[
'status'][
'severity'] =
'ERRORS';
3014 if ( $FailedCurrPassword ) {
3015 $retAry[
'status'][
'failed_curr_pass'] = TRUE;
3019 $retAry[
'status'][
'code'] =
'000';
3020 $retAry[
'status'][
'severity'] =
'SUCCESS';
3041 function Validate_SettingsEmail($p_dbh, $p_hb_env, $p_values, &$p_errors_ary, $p_mc) {
3043 if (trim($p_values[
'email']) ==
'') {
3045 $p_errors_ary[] = $p_mc->msg(
'EMail Missing');
3047 if (!validateEmail($p_values[
'email'])) {
3048 $p_errors_ary[] = $p_mc->msg(
'Email appears invalid');
3067 function Validate_SettingsPassword($p_dbh, $p_hb_env, $p_values, &$p_errors_ary, $p_mc) {
3068 $FailedCurrPassword =
false;
3070 $pwd_maxlength = 20;
3072 if (array_key_exists(
'review_guidelines', $p_values)) {
3073 if ($p_values[
'review_guidelines'] !=
'Y') {
3074 $p_errors_ary[] = $p_mc->msg(
"Please review the password guidelines");
3079 $mbrPwd = GetUserInfo($p_dbh, $p_hb_env, $p_mc, Array(
"user_id" => $p_hb_env[
'Uid'],
"cu" => $p_hb_env[
'Cu']));
3081 if ($mbrPwd[
'status'][
'code'] !=
'000') {
3083 $p_errors_ary = array_merge($p_errors_ary, $mbrPwd[
'status'][
'errors']);
3085 $mbr_pwdhash = $mbrPwd[
'data'][
'cuusers_passwd'];
3088 if (array_key_exists(
'current', $p_values)) {
3090 $saved_passwd = preg_replace(
"/ +$/",
"", $mbr_pwdhash);
3091 $current_hashed = password_verify($p_values[
'current'], $saved_passwd);
3092 if (!$current_hashed) {
3093 $p_errors_ary[] = $p_mc->msg(
'Invalid login or password');
3095 $FailedCurrPassword =
true;
3099 if (array_key_exists(
'newpasswd', $p_values)) {
3100 if ($p_values[
'newpasswd'] == $p_values[
'current']) {
3101 $p_errors_ary[] = $p_mc->msg(
'New password and Current password cannot match');
3107 if (array_key_exists(
'newpasswd', $p_values)) {
3109 if ($p_values[
'newpasswd'] != $p_values[
'confpasswd']) {
3110 $p_errors_ary[] = $p_mc->msg(
"New passwords do not match");
3114 if (strlen($p_values[
'newpasswd']) < 6 || strlen($p_values[
'newpasswd']) > 20 ) {
3115 $p_errors_ary[] = $p_mc->combo_msg(
'NEW password must be X characters long', 0,
"#max#", $pwd_maxlength);
3119 if (preg_match(
"/['\"]/",$p_values[
'newpasswd'])){
3120 $p_errors_ary[] = $p_mc->msg(
"Invalid Characters in New password");
3123 if (strlen($p_values[
'newpasswd']) > 0 && !(preg_match(
"/\d/",$p_values[
'newpasswd']) && preg_match(
"/\D/",$p_values[
'newpasswd']))) {
3124 $p_errors_ary[] = $p_mc->msg(
"Password must contain both number and letter characters");
3129 return $FailedCurrPassword;
3145 function Validate_SettingsAlias($p_dbh, $p_hb_env, $p_values, &$p_errors_ary, $p_mc) {
3148 if (strlen($p_values[
'username']) == 0 && (($p_hb_env[
'Fset2'] & $GLOBALS[
'CU2_ALIAS_REQ']) == $GLOBALS[
'CU2_ALIAS_REQ'])) {
3149 $p_errors_ary[] = $p_mc->msg(
"Username Required");
3154 if (strlen($p_values[
'username']) > 0 && strlen($p_values[
'username']) < 6 ) {
3155 $p_errors_ary[] = $p_mc->msg(
'Username too short');
3158 if ($p_values[
'username'] != $p_values[
'username_confirm']) {
3159 $p_errors_ary[] = $p_mc->msg(
'Username nomatch');
3162 if (strlen($p_values[
'username']) > 5 && !check_alias_format($p_values[
'username'])) {
3163 $p_errors_ary[] = $p_mc->msg(
'Username appears invalid');
3168 if (count($p_errors_ary) == 0) {
3169 if (strlen($p_values[
'username']) > 5 && !check_alias_available($p_dbh, $p_hb_env, $p_values[
'username'])) {
3170 $p_errors_ary[] = $p_mc->msg(
'Username not available');
3192 function Validate_SettingsConfidence($p_dbh, $p_hb_env, $p_values, &$p_errors_ary, $p_mc) {
3195 if (strlen($p_values[
'confword']) == 0) {
3196 $p_errors_ary[] = $p_mc->msg(
"Set Config Enter Word");
3217 function Validate_SettingsPhones($p_dbh, $p_hb_env, $p_values, &$p_errors_ary, $p_mc) {
3219 if (is_array($p_values)) {
3220 foreach ($p_values as $type => $numbers) {
3221 if (is_array($numbers)) {
3222 for ($i = 0; $i < count($numbers); $i++) {
3223 $value = $numbers[$i];
3224 $valid = preg_match(
'/^[2-9]\d{2}-\d{3}-\d{4}$/', $value);
3226 $p_errors_ary[] = $p_mc->msg(
"Phone Invalid", HCU_DISPLAY_AS_JS);
3233 $valid = preg_match(
'/^[2-9]\d{2}-\d{3}-\d{4}$/', $value);
3235 $p_errors_ary[] = $p_mc->msg(
"Phone Invalid", HCU_DISPLAY_AS_JS);
3240 if (!$valid) {
break; }
3258 function Validate_SettingsChallenge($p_dbh, $p_hb_env, $p_values, &$p_errors_ary, $p_mc) {
3261 $selected_questions_list = Array();
3262 foreach ($p_values as $quest_info) {
3263 $qst_id = $quest_info[
'cqid'];
3264 $qst_resp = $quest_info[
'display'];
3270 if (intval($qst_id) == 0) {
3271 $p_errors_ary[] = $p_mc->combo_msg(
"Set Config Question Select", 0,
"#num#", $loop_idx);
3275 if (array_search(intval($qst_id), $selected_questions_list) !== False) {
3277 $p_errors_ary[] = $p_mc->combo_msg(
"Set Config Question Duplicate", 0,
"#num#", $loop_idx);
3280 $selected_questions_list[] = intval($qst_id);
3284 if (strlen($qst_resp) == 0) {
3285 $p_errors_ary[] = $p_mc->combo_msg(
"Set Config Question Blank", 0,
"#num#", $loop_idx);
3308 function Validate_SettingsDesc($p_dbh, $p_hb_env, $p_values, &$p_errors_ary, $p_mc) {
3310 $set_myaccount = trim($p_values[
'set_myaccount']);
3311 if ($set_myaccount ==
"") {
3312 $p_errors_ary[] = $p_mc->msg(
'Account Descriptions cannot be blank');
3315 # if we have switch accounts, validate the descriptions are unique 3316 if (is_array($p_values[
'swaccts']) &&
sizeof($p_values[
'swaccts']) > 0) {
3317 $membercnt = array(
"$set_myaccount" => 1);
3318 foreach ($p_values[
'swaccts'] as $swacct) {
3319 $description = trim($swacct[1]);
3320 $membercnt{$description} += 1;
3322 if (trim($description) !=
"" && $membercnt{$description} > 1) {
3323 $p_errors_ary[] = $p_mc->msg(
'Account Descriptions must be unique');
3325 if (trim($description) ==
"") {
3326 $p_errors_ary[] = $p_mc->msg(
'Account Descriptions cannot be blank');
3331 # if we have cross accounts, validate the descriptions are unique 3332 if (is_array($p_values[
'xaccts']) &&
sizeof($p_values[
'xaccts']) > 0) {
3333 $membercnt = array(
"$set_myaccount" => 1);
3334 foreach ($p_values[
'xaccts'] as $xacct) {
3335 $description = trim($xacct[1]);
3336 $membercnt{$description} += 1;
3338 if (trim($description) !=
"" && $membercnt{$description} > 1) {
3339 $p_errors_ary[] = $p_mc->msg(
'Account Descriptions must be unique');
3341 if (trim($description) ==
"") {
3342 $p_errors_ary[] = $p_mc->msg(
'Account Descriptions cannot be blank');