Changeset 170
- Timestamp:
- 09/14/08 20:26:02 (4 months ago)
- Files:
-
- branches/RB-0.91/wp-infocard/pw-config.php (modified) (1 diff)
- branches/RB-0.91/wp-infocard/wp-infocard.php (modified) (1 diff)
- branches/RB-0.91/wp-infocard/wp/admin.pw.php (modified) (4 diffs)
- branches/RB-0.91/wp-infocard/wp/cardforms.pw.php (added)
- branches/RB-0.91/wp-infocard/wp/interface (added)
- branches/RB-0.91/wp-infocard/wp/interface/infocard-menu.php (added)
- branches/RB-0.91/wp-infocard/wp/interface/infocard-newcard.php (added)
- branches/RB-0.91/wp-infocard/wp/interface/infocard-userprofile.php (added)
- branches/RB-0.91/wp-infocard/wp/interface/pw-menu.css (added)
- branches/RB-0.91/wp-infocard/wp/interface/register.css (added)
- branches/RB-0.91/wp-infocard/wp/login/login.pw.php (modified) (1 diff)
- branches/RB-0.91/wp-infocard/wp/processing.pw.php (modified) (3 diffs)
- branches/RB-0.91/wp-infocard/wp/triggerobject.pw.php (added)
- branches/RB-0.91/wp-infocard/wp/userdata.pw.php (modified) (5 diffs)
- branches/RB-0.91/wp-infocard/wp/utils.pw.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/RB-0.91/wp-infocard/pw-config.php
r161 r170 8 8 define ('PW_PLUGINPATH', '/wp-content/plugins/wp-infocard'); 9 9 define ('PW_VERSION', 'v0.91'); 10 define ('PW_VERSION_DATE', '0 3/09/08');10 define ('PW_VERSION_DATE', '09/13/08'); 11 11 define ('PW_DB_VERSION', 'DB v3'); 12 12 define ('PW_USECAPTCHAS', false ); branches/RB-0.91/wp-infocard/wp-infocard.php
r154 r170 3 3 Plugin Name: PamelaWare Information Card Login 4 4 Plugin URI: http://code.pamelaproject.com/wiki 5 Description: This plugin adds functionality to register and login with "information cards", part of the Identity Metasystem web services framework. Once it is activated, go to the " Options" menu and click on "Information Cards" to see what to do next.5 Description: This plugin adds functionality to register and login with "information cards", part of the Identity Metasystem web services framework. Once it is activated, go to the "Settings" menu and click on "Information Cards" to see what to do next. We strongly recommend that you use this plugin with Wordpress version 2.6.1 or later. 6 6 Version: v0.91 7 7 Author: K. Cameron, P. Dingle, and more branches/RB-0.91/wp-infocard/wp/admin.pw.php
r162 r170 330 330 331 331 } 332 333 function checkFrameworkRegistrationSetting() 334 { 335 $comment_reg = get_settings('comment_registration'); 336 if ((bool)$comment_reg) 337 return "Wordpress basic user registration is: enabled"; 338 else 339 return "Wordpress basic user registration is: disabled"; 340 } //end function checkFrameworkRegistrationSetting 332 341 333 342 function pwAdminScreen() … … 336 345 $opts = pw_admin::updateAdminOptions(); 337 346 // write submitted changes if this page reload shows a submit 338 if (pw_utils::databaseUpToDate()) 339 { 340 echo "<p>Plugin Version: ". PW_VERSION . " " . PW_VERSION_DATE 341 . " (" . $opts['pw_db_version'] . ")</p>"; 342 } 343 else 347 if (!pw_utils::databaseUpToDate()) 344 348 { 345 349 ?> … … 359 363 <table border="0"><tr><th valign="bottom" colspan="2" align="left"> 360 364 <tr><td colspan="4"> </td></tr> 361 362 <tr><th colspan="4" align="left">Information Card Configuration</td></tr> 363 <tr><td valign="top"> 364 <label for="securesiteurl" title="Secure Site URL"> 365 <?php pw_utils::screenPrint('Secure Site URL'); ?> 366 </label> 367 </td><td colspan="3"> 368 <input type="text" name="pw_securesiteurl" id="pw_securesiteurl" size="50" value="<?php print $opts['pw_securesiteurl']; ?>" /> 369 </td></tr> 370 371 <tr><td valign="top"> 372 <label for="pw_infocard_key" title="SSL Private Key"> 373 <?php pw_utils::screenPrint('SSL Private Key'); ?> 374 </label> 375 </td><td colspan="3"> 376 <textarea cols="60" rows="4" name="pw_infocard_key" id="pw_infocard_key"><?php print $opts['pw_infocard_key']; ?></textarea> 377 </td></tr> 378 <tr><td> 379 <label for="pw_infocard_opener" title="SSL Passphrase"> 380 <?php pw_utils::screenPrint('SSL Passphrase'); ?> 381 </label> 382 </td><td colspan="3"> 383 <input type="text" name="pw_infocard_opener" id="pw_infocard_opener" size="50" value="<?php print $opts['pw_infocard_opener']; ?>" /> 384 <?php /* 385 </td></tr> 386 <tr><td colspan="2"> 387 <input name="pw_enable_pass" type="checkbox" id="pw_enable_pass" value="1" <?php checked('1', ($opts['pw_enable_pass'])); ?> /> 388 <?php pw_utils::screenPrint('Use Username/Password in addition to Information Cards'); ?> 389 </td></tr> 390 */ ?> 365 <?php echo pw_admin::getPWAdminConfigurationSettings( $opts ); 366 ?> 391 367 <tr><td colspan="4"> </td></tr> 392 <tr><th colspan="4" align="left">To Enable Information Card User Login</td></tr>393 <tr><td colspan="4"><?php pw_utils::screenPrint('The following changes will result in a login form with the option "Use an Information Card". Please make a copy of the wp-login.php file before you begin, so that you can revert to that original file in case of difficulties.'); ?></td></tr> <tr><td colspan="2" id="code">394 368 <?php 395 369 pw_admin::printInstallData(); … … 571 545 572 546 /* 547 Function: cardManagementUrl 548 Description: returns out the URL to manage cards 549 Input: none 550 Output: URL 551 Side-Effects: none 552 */ 553 function cardManagementUrl() 554 { 555 return PW_SECURESITEURL 556 . "/wp-admin/profile.php"; 557 }//end function cardManagementUrl 558 559 /* 573 560 Function: getCurrentUserCardProfile 574 561 Description: Returns a string with code for maintaining branches/RB-0.91/wp-infocard/wp/login/login.pw.php
r158 r170 7 7 class pw_login extends pwlib_login 8 8 { 9 10 function getRegistrationUrl() 11 { 12 return PW_SECURESITEURL 13 . "/index.php?option=com_pwjos"; 14 } 15 16 function getAttachmentUrl() 17 { 18 return PW_SECURESITEURL 19 . "/index.php?option=com_pwjos"; 20 } 9 21 10 22 function printPostLoginRedirect() branches/RB-0.91/wp-infocard/wp/processing.pw.php
r163 r170 170 170 } //addIdentityRecord 171 171 172 /* 173 Function: updateIdentityLastUsed 174 Description: updates the identity table with a new lastused date 175 Input: none 176 Output: none 177 Side-Effect: updates infocard_identities table 178 */ 179 function updateIdentityLastUsed($cardhash, $cardhandle, $accountid) 180 { 181 if (!$cardhash || !$cardhandle || !$accountid) 182 return FALSE; 183 $today = date('c'); 184 global $wpdb; 185 186 $query = "UPDATE `" . PW_TABLE_PREFIX . "infocard_identities` SET " 187 . "lastused = '$today' WHERE accountid = '$accountid' AND cardhash = '$cardhash'"; 188 $wpdb->query( $query ); 189 //pw_utils::printDebug( ' Updated Last Used Date to ' . $today . ' for account ' . $accountid . ', card ' . $cardhandle . '<br/>' ); 190 }//end function updateIdentityLastUsed 191 172 192 /* 173 193 Function: deleteIdentityRecords … … 185 205 return $wpdb->query( $query ); 186 206 } //end function deleteIdentityRecords 207 208 /* 209 Function: addCard 210 Description: adds a single card 211 Input: datamap 212 Output: returns an error if an error was encountered 213 Side-Effect: updates infocard_identities table 214 */ 215 function addCard($datamap) 216 { 217 if (!$datamap['ID']->new_value) 218 { 219 pw_utils::printDebug('ERROR: no ID value in datamap for updateIdentityData<br />'); 220 return 'INTERNALERROR'; 221 } 222 global $wpdb; 223 $acct = $datamap['ID']->new_value; 224 $cardhash = $datamap['cardhash']->new_value; 225 $cardhandle = $datamap['cardhandle']->new_value; 226 $today = date('c'); 227 228 $query = "SELECT * FROM " . PW_TABLE_PREFIX 229 . "infocard_identities WHERE cardHash = " 230 . "'$cardhash'"; 231 232 $results = $wpdb->get_results( $query, OBJECT ); 233 234 switch ( count($results) ) 235 { 236 case 0: 237 pw_processing::addIdentityRecord($datamap['cardhash']->new_value, $datamap['cardhandle']->new_value, $datamap['ID']->new_value); 238 break; 239 case 1: 240 if (!pw_utils::dataCompare($results[0]->accountid, $acct, 'Account ID')) 241 { 242 pw_utils::printDebug( ' Card used for another account<br/>' ); 243 return 'CARDINUSE'; 244 245 } 246 break; 247 248 default: 249 // should never happen 250 return 'MULTIPLECARDERROR'; 251 } 252 253 return FALSE; // no error, life is good 254 }//end function addCard 187 255 188 256 /* … … 203 271 }//end function deleteCard 204 272 273 function mapFormElements($datamap, $postdetails) 274 { 275 $user_login = pw_utils::sanitizeData($postdetails['pwchosenloginid']); 276 $user_pwd = pw_utils::sanitizeData($postdetails['pwchosenpwd']); 277 $user_pwdconfirm = pw_utils::sanitizeData($postdetails['pwchosenpwdconfirm']); 278 if ($user_login) 279 { 280 pw_utils::printDebug("User Chosen Login: " . $user_login . "<br/>", 3); 281 $datamap['loginid']->new_value == $user_login; 282 } 283 if (($user_pwd) && ($user_pwd == $user_pwdconfirm)) 284 { 285 pw_utils::printDebug("User Chosen Password: " . $user_pwd . "<br/>", 3); 286 $datamap['pwd']->new_value == $user_pwd; 287 } 288 } //end function mapFormElements 205 289 } // end class pw_processing 206 290 ?> branches/RB-0.91/wp-infocard/wp/userdata.pw.php
r163 r170 253 253 } // end function updateIdentityData 254 254 255 /* 256 Function: getAuthenticatedUserRecord 257 Description: returns a user entry in a standardized format 258 which may not match the database name 259 Input: none 260 Output: - accountid: the user accountid 261 - loginid: the user login name 262 - name: the display name 263 Side-Effects: none 264 */ 265 function getAuthenticatedUserRecord() 266 { 267 $user = wp_get_current_user(); 268 if ( $user->ID ) 269 { 270 $returnuser->accountid = $user->ID; 271 $returnuser->name = $user->display_name; 272 $returnuser->loginid = $user->username; 273 $returnuser->email = $user->email; 274 275 return $returnuser; 276 } 277 else 278 { 279 return false; 280 } 281 } //end getAuthenticatedUserRecord 282 255 283 // Function: Perform user login functions 256 284 // Description: set whatever cookie &/or session information needed … … 444 472 return $results; 445 473 } 446 474 475 /* DEPRECATED AS OF V0.91 447 476 function updateUserInfoFromEmail($email) 448 477 { … … 490 519 return $results; 491 520 } 492 521 */ 522 // DEPRECATED 523 /* 493 524 function updateCardInfoFromAccountID($accountID) 494 525 { … … 528 559 return $results; 529 560 }//end function updateCardInfoFromAccountID 530 561 */ 531 562 function checkEmailAddress($claimslist, $datamap) 532 563 { … … 584 615 } //end function updateLegacyCardHash 585 616 617 /* 618 Function: loginIDisUnique 619 Description: returns TRUE if loginID is unique, FALSE otherwise 620 */ 621 function loginIDisUnique($loginid) 622 { 623 global $wpdb; 624 $query = "SELECT COUNT(*) FROM `" . PW_TABLE_PREFIX 625 . "users` WHERE user_login = '" 626 . $loginid . "'"; 627 628 if ($wpdb->get_results( $query, OBJECT )) 629 return FALSE; 630 else 631 return TRUE; 632 } 633 634 /* 635 Function: emailIsUnique 636 Description: returns TRUE if email is unique 637 returns TRUE if uniqueness doesn't matter 638 returns FALSE otherwise 639 */ 640 function emailIsUnique($email) 641 { 642 $email_unique = pw_admin::getOption('pw_email_unique'); 643 if (!$email_unique) 644 return TRUE; 645 646 global $wpdb; 647 $query = "SELECT COUNT(*) FROM `" . PW_TABLE_PREFIX 648 . "users` WHERE user_email = '" . $email . "'"; 649 650 if ($wpdb->get_results( $query, OBJECT )) 651 return FALSE; 652 else 653 return TRUE; 654 } 586 655 } // end class pw_userdata 587 656 ?> branches/RB-0.91/wp-infocard/wp/utils.pw.php
r158 r170 250 250 } 251 251 252 function showClaimList($claimslist) 253 { 254 pw_utils::printDebug('<br/>Requested Claims:<br/>'); 252 /* 253 Function: showClaimList 254 Description: Returns html describing claims in the claimslist 255 Note: items in the claims list with no schemaURI 256 are not shown (eg: modulus) 257 */ 258 function showClaimList() 259 { 260 $claimslist =& PWClaimInfo::getInstance()->claimslist; 261 $output = '<br/>Requested Claims:<br/>'; 255 262 foreach ($claimslist as $claim) 256 263 { 257 264 if ($claim->schemaURI) 258 265 { 259 pw_utils::printDebug( ' ' . $claim->displayname . (($claim->required)?' (required)':' (optional)') . '<br/>'); 260 //pw_utils::printDebug($claim->displayname); 261 } 262 } 263 pw_utils::printDebug('<br/>'); 264 } 266 $output .= ' ' . $claim->displayname 267 . (($claim->required)?' (required)':' (optional)') . '<br/>'; 268 // $output .= $claim->displayname; 269 } 270 } 271 $output .= '<br/>'; 272 273 return $output; 274 }//end function showClaimList 265 275 266 276 function showDataMap($datamap) … … 332 342 } 333 343 344 function matchLinkProtocol($string) 345 { 346 if (strpos(get_settings('siteurl'), "https")) 347 { 348 return PW_PLUGINURL . $string; 349 } 350 else 351 { 352 return PW_SECUREPLUGINURL . $string; 353 } 354 }// end function matchLinkProtocol 334 355 } // end class pw_utils 335 356 ?>
