Produced by Araxis Merge on 4/5/2017 4:21:38 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | C:\working_scrub\Unredacted\Direct Code Base\DSM_Bld2_Source_Code_CIF_2017-02-14\api_build02-sprint01\application\libraries | DAAS_Form_validation.php | Fri Oct 21 18:32:42 2016 UTC |
| 2 | eHX-CIF.zip\eHX-CIF\Direct Code Base\DSM_Bld2_Source_Code_CIF_2017-02-14\api_build02-sprint01\application\libraries | DAAS_Form_validation.php | Mon Apr 3 13:53:24 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 192 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | <?php defi ned('BASEP ATH') OR e xit('No di rect scrip t access a llowed'); | |
| 2 | ||
| 3 | /** | |
| 4 | * @package direct-as -a-service | |
| 5 | * @subpack age librar ies | |
| 6 | *//** */ | |
| 7 | ||
| 8 | ||
| 9 | /** | |
| 10 | * DaaS Cod eIgniter F orm valida tion Exten sion | |
| 11 | * | |
| 12 | * @author Adam Bell, Shawn Wil liams | |
| 13 | * @package direct-as -a-service | |
| 14 | * @subpack age librar ies | |
| 15 | */ | |
| 16 | class DAAS _Form_vali dation ext ends VLER_ Form_valid ation { | |
| 17 | ||
| 18 | /* | |
| 19 | Note to d evelopers - this cla ss is an e xtension o f the Code igniter fo rm validat ion class, and Codei gniter wil l automati cally use it when | |
| 20 | you load the form v alidation library. There is n o need to load the f orm valida tion libra ry from wi thin this class or t ry to call | |
| 21 | $CI->form _validatio n->set_mes sage() ins tead of $t his->set_m essage(), it just in curs addit ional over head. If you're not familiar with | |
| 22 | Codeignit er's syste m for exte nding libr aries, see the "Exte nding Nati ve Librari es" sectio n of the d ocs: http: //ellislab .com/codei gniter/use r-guide/ge neral/crea ting_libra ries.html. -MG 2014 -06-26 | |
| 23 | */ | |
| 24 | ||
| 25 | pu blic funct ion allowe d_mailbox_ characters ($name) { | |
| 26 | $val id = (preg _match('/[ ^A-Za-z0-9 ._-]/', $n ame) === 1 ) ? FALSE : TRUE; | |
| 27 | if($ valid) { r eturn TRUE ; } | |
| 28 | $thi s->set_mes sage('allo wed_mailbo x_characte rs', 'The %s field m ay only co ntain alph a-numeric characters (A-Z, a-z , 0-9), un derscores, periods, and dashes .'); | |
| 29 | retu rn FALSE; | |
| 30 | } | |
| 31 | ||
| 32 | /* * | |
| 33 | * Validates that there isn't a u ser with t his org id in our da tabase. | |
| 34 | * | |
| 35 | * @param str ing | |
| 36 | * @return bo olean True if the us er org id is not yet in use | |
| 37 | */ | |
| 38 | pu blic funct ion unique _user_org_ id($user_o rg_id) { | |
| 39 | if(! User::exis ts(compact ('user_org _id'))) re turn true; | |
| 40 | $thi s->set_mes sage('uniq ue_user_or g_id', 'Th e ID alrea dy exists in the sys tem.'); | |
| 41 | retu rn false; | |
| 42 | } | |
| 43 | ||
| 44 | /* * | |
| 45 | * Validates that there isn't a u ser with t his userna me in our database. | |
| 46 | * | |
| 47 | * @param str ing | |
| 48 | * @return bo olean True if the us ername is not in use | |
| 49 | */ | |
| 50 | pu blic funct ion unique _username( $username) { | |
| 51 | if(M ailbox::na me_is_avai lable($use rname)) re turn true; | |
| 52 | $thi s->set_mes sage('uniq ue_usernam e', 'This user name is not ava ilable.'); | |
| 53 | retu rn false; | |
| 54 | } | |
| 55 | ||
| 56 | pu blic funct ion va_ema il($email) { | |
| 57 | $val id = (preg _match("/^ ([a-z0-9\+ _\-]+)(\.[ a-z0-9\+_\ -]+)*@+((. *(\.va\.go v))|va\.go v)$/ix", $ email)) ? TRUE : FAL SE; | |
| 58 | if($ valid) { r eturn TRUE ; } | |
| 59 | $this->set _message(' va_email', 'The %s f ield must contain a valid DNS email addr ess.'); | |
| 60 | retu rn FALSE; | |
| 61 | } | |
| 62 | pu blic funct ion valid_ facility($ facility_i d){ | |
| 63 | $CI =& get_ins tance(); | |
| 64 | $C I->load->m odel('faci litymodel' ); | |
| 65 | $res ult = $CI- >facilitym odel->get_ facility($ facility_i d); | |
| 66 | if($ result && $result->n um_rows() > 0){ | |
| 67 | return true; | |
| 68 | } | |
| 69 | $thi s->set_mes sage('vali d_facility ', 'The Fa cility fie ld is inva lid.'); | |
| 70 | retu rn false; | |
| 71 | } | |
| 72 | ||
| 73 | pu blic funct ion valid_ url($url){ | |
| 74 | $pattern = '/' . '^( https?:\/\ /)[^\s]+$' . '/'; | |
| 75 | preg_match ($pattern, $url, $ma tches); | |
| 76 | $this->set _message(' valid_url' , "The url must star t with htt p:// or ht tps:// and contain n o spaces") ; | |
| 77 | return (em pty($match es)) ? FAL SE : TRUE; | |
| 78 | } | |
| 79 | ||
| 80 | /* | |
| 81 | * phone val idation ch ecks that the passed value is a valid ph one number | |
| 82 | */ | |
| 83 | pu blic funct ion valida te_phone($ phone){ | |
| 84 | //if the phone number is null or n ot set ret urn true | |
| 85 | if ( !isset($ph one) || $p hone === ' '){ | |
| 86 | return true; | |
| 87 | } | |
| 88 | //ch eck if the phone num ber follow s standard format | |
| 89 | if ( preg_match ('/^(?:\(( \+?\d+)?\) |\+?\d+) ? \d*(-?\d{2 ,3} ?){0,4 }$/', $pho ne)){ | |
| 90 | return true; | |
| 91 | }els e{ | |
| 92 | $this- >set_messa ge('valida te_phone', 'The %s f ield must be a valid phone num ber.'); | |
| 93 | return false; | |
| 94 | } | |
| 95 | } | |
| 96 | ||
| 97 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.