function verifyID(&$local, $varID, $enumVerifyType, $bRedirectOnFail = true) { /*--------------------------------------------------------------------- another way... Note that get_instance is a CI function, defined in system/core/CodeIgniter.php from http://stackoverflow.com/questions/4740430/explain-ci-get-instance $CI =& get_instance(); // use get_instance, it is less prone to failure in this context. ---------------------------------------------------------------------*/ $bValid = true; switch ($enumVerifyType) { case 'account ID': $bValid = vid_bGenericRecExists($local, $varID, 'gifts_accounts', 'ga_lKeyID', 'ga_bRetired'); break; case 'attributed to ID': $bValid = vid_bAttributedToIDExists($local, $varID); break; case 'auction ID': $bValid = vid_bGenericRecExists($local, $varID, 'gifts_auctions', 'auc_lKeyID', 'auc_bRetired'); break; case 'auction item ID': $bValid = vid_bGenericRecExists($local, $varID, 'gifts_auctions_items', 'ait_lKeyID', 'ait_bRetired'); break; case 'autocharge ID': $bValid = vid_bGenericRecExists($local, $varID, 'sponsor_autocharge_log', 'spcl_lKeyID', null); break; case 'bidsheet ID': $bValid = vid_bGenericRecExists($local, $varID, 'gifts_auctions_bidsheets', 'abs_lKeyID', 'abs_bRetired'); break; case 'business ID': $bValid = vid_bBizRecExists($local, $varID); break; case 'business contact ID': $bValid = vid_bBizConRecExists($local, $varID); break; case 'campaign ID': $bValid = vid_bGenericRecExists($local, $varID, 'gifts_campaigns', 'gc_lKeyID', 'gc_bRetired'); break; case 'client location ID': $bValid = vid_bGenericRecExists($local, $varID, 'client_location', 'cl_lKeyID', 'cl_bRetired'); break; case 'client ID': $bValid = vid_bGenericRecExists($local, $varID, 'client_records', 'cr_lKeyID', 'cr_bRetired'); break; case 'client program ID': $bValid = vid_bGenericRecExists($local, $varID, 'cprograms', 'cp_lKeyID', 'cp_bRetired'); break; case 'client vocabulary ID': $bValid = vid_bGenericRecExists($local, $varID, 'lists_client_vocab', 'cv_lKeyID', 'cv_bRetired'); break; case 'custom form ID': $bValid = vid_bGenericRecExists($local, $varID, 'custom_forms', 'cf_lKeyID', 'cf_bRetired'); break; case 'custom report ID': $bValid = vid_bGenericRecExists($local, $varID, 'creport_dir', 'crd_lKeyID', 'crd_bRetired'); break; case 'deposit ID': $bValid = vid_bGenericRecExists($local, $varID, 'deposit_log', 'dl_lKeyID', 'dl_bRetired'); break; case 'donation ID': $bValid = vid_bGiftExists($local, $varID); break; case 'event ID': $bValid = vid_bGenericRecExists($local, $varID, 'vol_events', 'vem_lKeyID', 'vem_bRetired'); break; case 'event date ID': $bValid = vid_bGenericRecExists($local, $varID, 'vol_events_dates', 'ved_lKeyID', null); break; case 'grant ID': $bValid = vid_bGenericRecExists($local, $varID, 'grants', 'gr_lKeyID', null); break; case 'group ID': $bValid = vid_bGenericRecExists($local, $varID, 'groups_parent', 'gp_lKeyID', null); break; case 'honorarium/memorial ID': $bValid = vid_bGenericRecExists($local, $varID, 'lists_hon_mem', 'ghm_lKeyID', 'ghm_bRetired'); break; case 'household ID': case 'people ID': $bValid = vid_bPeopleRecExists($local, $varID); break; case 'image/document ID': $bValid = vid_bGenericRecExists($local, $varID, 'docs_images', 'di_lKeyID', 'di_bRetired'); break; case 'inventory cat ID': $bValid = vid_bGenericRecExists($local, $varID, 'inv_cats', 'ivc_lKeyID', 'ivc_bRetired'); break; case 'inventory item ID': $bValid = vid_bGenericRecExists($local, $varID, 'inv_items', 'ivi_lKeyID', 'ivi_bRetired'); break; case 'organization ID': $bValid = vid_bGenericRecExists($local, $varID, 'admin_chapters', 'ch_lKeyID', 'ch_bRetired'); break; case 'package ID': $bValid = vid_bGenericRecExists($local, $varID, 'gifts_auctions_packages', 'ap_lKeyID', 'ap_bRetired'); break; case 'people/business ID': $bValid = vid_bPBRecExists($local, $varID, false, false); break; case 'pledge ID': $bValid = vid_bGenericRecExists($local, $varID, 'gifts_pledges', 'gp_lKeyID', 'gp_bRetired'); break; case 'pre/post test ID': $bValid = vid_bGenericRecExists($local, $varID, 'cpp_tests', 'cpp_lKeyID', 'cpp_bRetired'); break; case 'provider ID': $bValid = vid_bGenericRecExists($local, $varID, 'grant_providers', 'gpr_lKeyID', 'gpr_bRetired'); break; case 'relationship ID': $bValid = vid_bGenericRecExists($local, $varID, 'people_relationships', 'pr_lKeyID', 'pr_bRetired'); break; case 'relationship entry ID': $bValid = vid_bGenericRecExists($local, $varID, 'lists_people_relationships', 'lpr_lKeyID', 'lpr_bRetired'); break; case 'reminder ID': $bValid = vid_bReminderIDExists($local, $varID); break; case 'search term ID': $bValid = vid_bGenericRecExists($local, $varID, 'creport_search', 'crs_lKeyID', null); break; case 'shift ID': $bValid = vid_bGenericRecExists($local, $varID, 'vol_events_dates_shifts', 'vs_lKeyID', 'vs_bRetired'); break; case 'sponsor ID': $bValid = vid_bSponsorIDExists($local, $varID); break; case 'sponsorship charge ID': $bValid = vid_bGenericRecExists($local, $varID, 'sponsor_charges', 'spc_lKeyID', 'spc_bRetired'); break; case 'sponsor payment ID': $bValid = vid_bPaymentExists($local, $varID); break; case 'sponsorship program ID': $bValid = vid_bSponsorProgIDExists($local, $varID); break; case 'status category ID': $bValid = vid_bGenericRecExists($local, $varID, 'client_status_cats', 'csc_lKeyID', 'csc_bRetired'); break; case 'status ID': $bValid = vid_bGenericRecExists($local, $varID, 'lists_client_status_entries', 'cst_lKeyID', 'cst_bRetired'); break; case 'status entry ID': $bValid = vid_bGenericRecExists($local, $varID, 'client_status', 'csh_lKeyID', 'csh_bRetired'); break; case 'status entry list ID': $bValid = vid_bGenericRecExists($local, $varID, 'lists_client_status_entries', 'cst_lKeyID', 'cst_bRetired'); break; case 'user ID': $bValid = vid_bGenericRecExists($local, $varID, 'admin_users', 'us_lKeyID', null); break; case 'volunteer ID': $bValid = vid_bVolRecExists($local, $varID); break; case 'volunteer assignment ID': $bValid = vid_bGenericRecExists($local, $varID, 'vol_events_dates_shifts_assign', 'vsa_lKeyID', 'vsa_bRetired'); break; case 'vol. registration ID': $bValid = vid_bGenericRecExists($local, $varID, 'vol_reg', 'vreg_lKeyID', 'vreg_bRetired'); break; default: screamForHelp($enumVerifyType . ': invalid verify type<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } if ($bRedirectOnFail) { vid_bTestFail($local, $bValid, $enumVerifyType, $varID); } return $bValid; }
function run($idx, $strSearch) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- if (!bTestForURLHack('showSponsors')) { return; } $this->load->helper('dl_util/verify_id'); $idx = (int) $idx; $strSearch = trim(urldecode($strSearch)); switch ($idx) { case 1: // search sponsor ID $lSID = (int) $strSearch; if (vid_bSponsorIDExists($this, $lSID)) { redirect('sponsors/view_spon_rec/viewViaSponID/' . $lSID); } else { $this->session->set_flashdata('error', 'No sponsorship records match sponsorID <b>' . $lSID . '</b>'); redirect('sponsors/spon_search/opts'); } break; case 2: // search people/biz ID $lPID = (int) $strSearch; if (vid_bPeopleRecExists($this, $strSearch)) { redirect('sponsors/view_via_people_id/view/' . $lPID); } elseif (vid_bBizRecExists($this, $strSearch)) { redirect('sponsors/view_via_people_id/view/' . $lPID); } else { $this->session->set_flashdata('error', 'No people/business records match ID <b>' . $lPID . '</b>'); redirect('sponsors/spon_search/opts'); } break; case 3: // search first/last name $this->firstLastNameSearch($strSearch); break; default: screamForHelp($idx . ': invalid search type<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } }
function run($idx, $strSearch) { //--------------------------------------------------------------------- // //--------------------------------------------------------------------- $idx = (int) $idx; $strSearch = trim(urldecode($strSearch)); $strSafeSearch = strPrepStr($strSearch); $lLeftCnt = strlen($strSearch); switch ($idx) { case 1: // search people ID $this->load->helper('dl_util/verify_id'); if (vid_bPeopleRecExists($this, $strSearch)) { $lPID = (int) $strSearch; redirect('people/people_record/view/' . $lPID); } else { $this->session->set_flashdata('error', 'No people records match peopleID <b>' . htmlspecialchars($strSearch) . '</b>'); redirect('people/people_search/searchOpts'); } break; case 2: // search first/last name $strWhere = " AND ( (LEFT(pe_strFName, {$lLeftCnt})={$strSafeSearch})\n OR (LEFT(pe_strLName, {$lLeftCnt})={$strSafeSearch})) "; $strLabel = 'Searching for people whose <b>first or last name</b> begins with <b><i>"' . htmlspecialchars($strSearch) . '"</b></i><br>'; $this->peopleNameAddrSearch($strSearch, $strWhere, $strLabel); break; case 3: // search city $strWhere = " AND ( LEFT(pe_strCity, {$lLeftCnt})={$strSafeSearch}) "; $strLabel = 'Searching for people whose <b>city</b> begins with <b><i>"' . htmlspecialchars($strSearch) . '"</b></i><br>'; $this->peopleNameAddrSearch($strSearch, $strWhere, $strLabel); break; case 4: // search state $strWhere = " AND ( LEFT(pe_strState, {$lLeftCnt})={$strSafeSearch}) "; $strLabel = 'Searching for people whose <b>state</b> begins with <b><i>"' . htmlspecialchars($strSearch) . '"</b></i><br>'; $this->peopleNameAddrSearch($strSearch, $strWhere, $strLabel); break; case 5: // search country $strWhere = " AND ( LEFT(pe_strCountry, {$lLeftCnt})={$strSafeSearch}) "; $strLabel = 'Searching for people whose <b>country</b> begins with <b><i>"' . htmlspecialchars($strSearch) . '"</b></i><br>'; $this->peopleNameAddrSearch($strSearch, $strWhere, $strLabel); break; case 6: // search zip $strWhere = " AND ( LEFT(pe_strZip, {$lLeftCnt})={$strSafeSearch}) "; $strLabel = 'Searching for people whose <b>zip</b> begins with <b><i>"' . htmlspecialchars($strSearch) . '"</b></i><br>'; $this->peopleNameAddrSearch($strSearch, $strWhere, $strLabel); break; case 7: // search everything $strWhere = " AND ( (INSTR(pe_strFName, {$strSafeSearch})>0)\n OR (INSTR(pe_strLName, {$strSafeSearch})>0)\n OR (INSTR(pe_strMName, {$strSafeSearch})>0)\n OR (INSTR(pe_strAddr1, {$strSafeSearch})>0)\n OR (INSTR(pe_strAddr2, {$strSafeSearch})>0)\n OR (INSTR(pe_strCity, {$strSafeSearch})>0)\n OR (INSTR(pe_strState, {$strSafeSearch})>0)\n OR (INSTR(pe_strCountry, {$strSafeSearch})>0)\n OR (INSTR(pe_strZip, {$strSafeSearch})>0)\n ) "; $strLabel = 'Searching for people whose <b>name/address</b> contains <b><i>"' . htmlspecialchars($strSearch) . '"</b></i><br>'; $this->peopleNameAddrSearch($strSearch, $strWhere, $strLabel); break; default: screamForHelp($idx . ': invalid search type<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__); break; } }