Changeset 86
- Timestamp:
- 07/09/07 11:35:17 (1 year ago)
- Files:
-
- trunk/wp-infocard/pwlib/claimtypes.pwlib.php (modified) (6 diffs)
- trunk/wp-infocard/pwlib/utils.pwlib.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-infocard/pwlib/claimtypes.pwlib.php
r56 r86 7 7 var $displayname = ''; 8 8 var $token_value; 9 9 10 /* 11 Function: pw_claimtype 12 Description: object constructor 13 Input Parameters: sch - sets schemaURI 14 han - sets handle 15 req - sets required 16 dn - sets displayname 17 Output: none 18 Side Effects: object is created 19 */ 10 20 function pw_claimtype( $sch, $han, $req, $dn ) 11 21 { … … 16 26 } //end function pw_claimtype 17 27 28 /* 29 Function: add_token_value 30 Description: updates the value that was returned for the claim 31 Input Parameters: val - the value returned for the claim 32 Output: none 33 Side Effects: none 34 */ 18 35 function add_token_value( $val ) 19 36 { … … 32 49 var $db_value; 33 50 var $description = ''; //to describe the mapping for others 34 51 52 /* 53 Function: pw_mapping 54 Description: object constructor 55 Input Parameters: dn: sets displayname 56 ma: sets mappingattribute 57 mt: sets mappingtable 58 mf: sets mappingfunction 59 desc: sets description 60 Output: none 61 Side Effects: object created 62 */ 35 63 function pw_mapping( $dn, $ma, $mt, $mf, $desc='' ) 36 64 { … … 42 70 $this->description = $desc; 43 71 } // end function pw_mapping 44 72 73 /* 74 Function: add_new_value 75 Description: add mapping function result to object 76 (result must be calculated separately) 77 Input Parameters: val -- new value to set 78 Output: none 79 Side Effects: none 80 */ 45 81 function add_new_value( $val ) 46 82 { … … 48 84 } // end function add_new_value 49 85 86 /* 87 Function: add_db_value 88 Description: add existing database value to object 89 Input Parameters: val -- db value to set 90 Output: none 91 Side Effects: none 92 */ 50 93 function add_db_value( $val ) 51 94 { … … 53 96 } 54 97 98 /* 99 Function: compare 100 Description: checks new_value against db_value; 101 Input Parameters: nodebug - set this to anything other than 102 an empty string if you want to silence debug 103 output. 104 Output: returns true if the values are identical 105 (using strcmp) 106 otherwise returns false 107 Side Effects: none 108 109 */ 55 110 function compare( $nodebug='' ) 56 111 { trunk/wp-infocard/pwlib/utils.pwlib.php
r73 r86 6 6 class pwlib_utils { 7 7 8 // Function: printCSSLink 9 // Description: prints the path to the CSS file 8 /* 9 Function: printCSSLink 10 Description: prints the path to the CSS file 11 Input Parameters: none 12 Output: CSS Link printed to page 13 Side Effects: alters output page 14 */ 10 15 function printCSSlink() 11 16 { … … 20 25 } // end function printCSSlink 21 26 27 /* 28 Function: printJqueryLocation 29 Description: prints path to the jquery javascript file 30 Input Parameters: none 31 Output: jsquery link printed to page 32 Side Effects: alters output page 33 */ 22 34 function printJqueryLocation() 23 35 { … … 30 42 print PW_SECUREPLUGINURL . "/vendor/jquery.js"; 31 43 } 32 } // end function print CSSlink44 } // end function printJqueryLocation 33 45 34 46 // Function: printPamelaProjectLink 35 47 // Description: prints a link to the Pamela Project Website 48 /* 49 Function: printPamelaProjectLink 50 Description: prints path to the PamelaProject Website 51 Input Parameters: none 52 Output: Pamela Project link printed to page 53 Side Effects: alters output page 54 */ 36 55 function printPamelaProjectLink() 37 56 { … … 43 62 } 44 63 45 // Function: checkTimeAhead 46 // Description: match RP server time against token times 47 // Input: $notbefore -- time data from token 48 // Output: returns false if there are no errors. 49 // returns an error detail string if there are errors. 50 // Side effect: none 51 64 /* 65 Function: checkTimeAhead 66 Description: match RP server time against token times 67 Input Parameters: notbefore -- time data from token 68 Output: returns false if there are no errors. 69 returns an error detail string if there are errors. 70 Side Effects: none 71 */ 52 72 function checkTimeAhead ( $NotBefore ){ 53 73 if (PW_TIMEVALIDATION_ON) … … 61 81 } 62 82 return false; 63 64 83 } // end funciton checkTimeAhead 65 84 66 // Function: checkTimeBehind 67 // Description: match RP server time against token times 68 // Input: $notonorafter -- time data from token 69 // Output: returns false if there are no errors. 70 // returns an error detail string if there are errors. 71 // Side effect: none 72 85 /* 86 Function: checkTimeBehind 87 Description: match RP server time against token times 88 Input Parameters: notonorafter -- time data from token 89 Output: returns false if there are no errors. 90 returns an error detail string if there are errors. 91 Side Effects: none 92 */ 73 93 function checkTimeBehind ( $NotOnOrAfter){ 74 94 if (PW_TIMEVALIDATION_ON) … … 84 104 } // end function checkTimeBehind 85 105 106 /* 107 Function: printBinary 108 Description: print a binary value to the screen in an easy 109 to read format 110 Input Parameters: title: an explanation of what the value is 111 binary: the value to print 112 Output: prints the binary value in HTML to std out 113 Side Effects: alters the output page 114 */ 86 115 87 116 function printBinary ($title, $binary) … … 133 162 134 163 135 // Function: dataCompare 136 // Description: compares the value of a given piece of user data between 137 // what came from the database and what was supplied in the token. 138 // Input: $db_item - item from the database 139 // $token_item - item given by the token 140 // $item_name - used for debugging statements 141 // Output: returns true if the two items match 142 // returns false otherwise 143 // Side effect: none 164 /* 165 Function: dataCompare 166 Description: compares the value of a given piece of user 167 data between what came from the database and 168 what was supplied in the token. 169 Input Parameters: db_item - item from the database 170 token_item - item given by the token 171 item_name - used for debugging statements 172 Output: returns true if the two items match 173 returns false otherwise 174 Side Effects: none 175 */ 144 176 function dataCompare($db_item, $token_item, $item_name) 145 177 { … … 157 189 158 190 159 // Function: printDebug 160 // Description: prints debug statements - note this function could be overridden 161 // Input: content - the thing to be written out 162 // Output: - content is printed to the screen if & only if debugging is on. 163 // Side Effects: none 191 /* 192 Function: printDebug 193 Description: prints debug statements - note this function 194 could be overridden 195 Input Parameters: content - the thing to be written out 196 Output: content is printed to the screen if & only 197 if debugging is on (PW_DEBUG_ON is true). 198 Side Effects: none 199 */ 164 200 function printDebug( $content ) 165 201 { … … 170 206 } // end function printDebug 171 207 208 /* 209 Function: displayPamelaProjectLogo 210 Description: writes the path to the logo to the screen 211 Input Parameters: none 212 Output: writes a path to the screen 213 Side Effects: alters the output page 214 */ 172 215 function displayPamelaProjectLogo() 173 216 { 174 217 echo PW_PLUGINURL . "/pwlib/images/pp-logo-bw-small.png"; 175 218 } 176 // Function: cleanInitialClaim 177 // Description: to remove the possibility of SQL injection or XSS 178 // attacks by properly escaping characters that could 179 // be used to turn a string into a command. 180 // Function & explanation found at: (many thanks) 181 // http://simon.net.nz/articles/protecting-mysql-sql-injection-attacks-using-php/ 182 // Input: - claimslist entry for the claim to be cleaned 183 // Output: cleaned string 184 // Side-effects: database object is requested from a plugin-specific routine 219 220 /* 221 Function: cleanInitialClaim 222 Description: to remove the possibility of SQL injection or XSS 223 attacks by properly escaping characters that could 224 be used to turn a string into a command. 225 Input Parameters: claim - claimslist entry for the claim to be cleaned 226 Output: cleaned string 227 Side-effects: none 228 */ 185 229 function cleanInitialClaim( $claim ) 186 230 {
