Changeset 35

Show
Ignore:
Timestamp:
05/10/07 13:11:00 (2 years ago)
Author:
pdingle
Message:

Added pwlib from latest pwjos plugin

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-infocard/pwlib/error/class.error.php

    r34 r35  
    11<?php 
    22//defined( '_VALID_IC' ) or die( 'Direct Access to this location is not allowed.'); 
    3 include_once( dirname(__FILE__) . '../../pw-config.php'); 
     3include_once( dirname(__FILE__) . '/../../pw-config.php'); 
    44//////////////////// 
    55// Class InfoCardError 
     
    1919class InfocardError { 
    2020        function printErrorName( $error_code, $lang='en-us' ){ 
    21                 $error_file = $lang 
    22                         . '/wp-infocard-errornames.php'; 
    23                         
     21                $error_file = PW_PATH . '/pwlib/error/' . $lang 
     22                        . '/infocard-errornames.php'; 
     23         
    2424                if ( file_exists( $error_file ) ) { 
    2525                        include_once( $error_file ); 
     
    2727                                print $errorname[$error_code]; 
    2828                        } else { 
    29                                 _e('Unknown Error','wp-infocard'); 
     29                                pw_utils::screenPrint('Unknown Error: '.$error_code); 
    3030                        } 
    3131                } else { 
    32                         _e('Missing Error','wp-infocard'); 
     32                        pw_utils::screenPrint('Missing Error'); 
    3333                } 
    3434        } 
     
    3636        function printErrorDescription ( $error_code, $lang='en-us' ) { 
    3737 
    38                 $error_file = $lang  
     38                $error_file = PW_PATH . '/pwlib/error/' . $lang 
    3939                        . '/ErrorDescriptions/wp-infocard-description.' 
    4040                        . $error_code . '.html'; 
     
    4242                        include_once( $error_file ); 
    4343                } else { 
    44                         _e('You have encountered an error with the code: <b>' 
    45                         . $error_code . '</b>. There is no specific user ' 
    46                         . 'information available for this error.','wp-infocard'); 
     44                        pw_utils::screenPrint('You have encountered an error ' 
     45                        . 'with the code: <b>' . $error_code  
     46                        . '</b>. There is no specific user information ' 
     47                        . 'available for this error.'); 
    4748                } 
    4849        } 
  • trunk/wp-infocard/pwlib/error/error.php

    r34 r35  
    33        define( '_VALID_IC', 1 );  
    44        include_once( dirname(__FILE__) . '/../../pw-config.php');  
    5         include_once('class.error.php');  
    6         include_once( dirname(__FILE__) . '/../../' . PW_PLUGIN . 'utils.pw.php');  
    7          
     5        include_once( dirname(__FILE__) . '/class.error.php');  
     6        include_once( dirname(__FILE__) . '/../../' . PW_PLUGIN . '/utils.pw.php');  
     7 
    88        $code = $_REQUEST['error_code']; 
    99        $details = $_REQUEST['error_details']; 
     
    1111<html xmlns="http://www.w3.org/1999/xhtml"> 
    1212<head> 
    13         <title><?php pw_utils::printTitle(); ?> &rsaquo; <?php _e('Error', 'wp-infocard'); ?></title> 
     13        <title><?php pw_utils::printTitle(); ?> &rsaquo; <?php pw_utils::screenPrint('Error'); ?></title> 
    1414        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    1515        <link rel="stylesheet" href="<?php pw_utils::printCSSlink(); ?>" type="text/css" /> 
     
    1818 
    1919<div id="error_background"> 
    20         <p class="error"><?php _e('An error has occured during Information Card login', 'wp-infocard'); ?></p> 
    21         <p class="error_name"><?php InfocardError::printErrorName( $code ); ?></p> 
     20        <p class="error"><?php pw_utils::screenPrint('An error has occured during Information Card login'); ?></p> 
     21        <p class="error_name"><?php InfocardError::printErrorName( $code, pw_utils::getDefaultLang() ); ?></p> 
    2222 
    2323  <div id="error_description"> 
    2424                <?php InfocardError::printErrorDescription( $code );  
    25                       InfocardError::printErrorDetails($details); 
     25                      InfocardError::printErrorDetails( $details ); 
    2626                ?> 
    2727  </div> 
    2828  <div id="error_footer"> 
    2929        <ul> 
    30         <li id="footer"><?php pw_utils::printUserMessageLinks(); pw_utils::printPamelaProjectLink(); ?></li> 
     30        <li id="footer"><?php pw_utils::printUserMessageLinks( $code ); pw_utils::printPamelaProjectLink(); ?></li> 
    3131        </ul> 
    3232  </div> 
  • trunk/wp-infocard/pwlib/login/infocard-submit.php

    r34 r35  
    1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    21<?php 
    32 
     
    2423define( '_VALID_IC', 1 );  
    2524include_once( dirname(__FILE__) . '/../../pw-config.php'); 
    26 include_once( dirname(__FILE__) . '/../../' . PW_PLUGIN . 'utils.pw.php'); 
     25include_once( dirname(__FILE__) . '/../../' . PW_PLUGIN . '/utils.pw.php'); 
    2726include_once( dirname(__FILE__) . '/../../' . PW_PLUGIN . '/login/class.infocard-login.php'); 
    2827 
    2928// this only happens in the case of account validation. 
    30 $clickback = $_SERVER['QUERY_STRING']; 
     29$clickback = $_REQUEST['clickbackID']; 
    3130 
    32 $netAgent = InfocardLogin::getNetAgent(); 
    3331$userAgent = $_SERVER['HTTP_USER_AGENT']; 
    34  
     32$netAgent = 'septemberAgent';   // hard-coded 
     33pw_utils::printDebugHeader('INFORMATION CARD LOGIN - DEBUG MODE ON'); 
    3534pw_utils::printDebug("This site is under maintenance - anything is possible<br/>" 
    3635        . "<br/>This page contains the hidden form object that specifies required and optional claims, and invokes the Identity Selector.<br/>" 
     
    3837 
    3938pw_utils::printDebug("Plugin: " . PW_PLUGIN . "<br/>\n"); 
    40 pw_utils::printDebug("Net Agent: $netAgent<br/>\n"); 
    4139pw_utils::printDebug("User Agent: $userAgent<br/>\n"); 
    4240 
     41pw_utils::showClaimList($claimslist); 
     42pw_utils::showDataMap($datamap); 
    4343?> 
    44 <html xmlns="http://www.w3.org/1999/xhtml"> 
    45 <head> 
    46         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    47 </head> 
    48 <body> 
    4944   <form name="ctl00" id="ctl00" method="post" action="<?php InfocardLogin::printICPostDestination(); ?>">   
    50               <OBJECT type="application/x-informationCard" name="xmlToken"> 
    51                 <PARAM  Name="tokenType" 
    52                         Value="urn:oasis:names:tc:SAML:1.0:assertion"> 
     45<?php 
     46               InfocardLogin::printIdentitySelectorTrigger(); 
     47                InfocardLogin::printHiddenClickback($clickback);  
    5348 
    54                 <PARAM  Name="requiredClaims" 
    55                         Value="<?php InfocardLogin::printRequiredClaims($netAgent); ?>"> 
    56 <?php  
    57                         InfocardLogin::printOptionalClaims(); 
    58 ?>       
    59               </OBJECT> 
    60 <?php  
    61                 InfocardLogin::printHiddenClickback($clickback);  
    6249                if (PW_DEBUG_ON) 
    6350                // replace auto-submit with manual submit in debug mode. 
     
    8875        } 
    8976?> 
    90 </body> 
    91 </html> 
  • trunk/wp-infocard/pwlib/utils.pwlib.php

    r34 r35  
    7878                if (PW_DEBUG_ON) { 
    7979 
    80                         InfocardUtils::printDebug( $title . " (length: " .strlen($binary) . " octents) <br/>"); 
     80                        if (PW_SHOW_BINARY === false) 
     81                                return strlen($binary) . " characters (to see the binary enable PW_SHOW_BINARY)"; 
     82                                 
     83 
     84 
     85                        pw_utils::printDebug( $title . " (length: " .strlen($binary) . " octents) <br/>"); 
    8186                        $ascii = strtoupper(bin2hex($binary)); 
    8287                        $ascii_length = strlen($ascii); 
     
    8691                        $binary_offset = 0; 
    8792                        // initial value of printbuf is 8 zeros 
    88                         $printbuf .= sprintf("&nbsp;<b>%08d</b> ", $binary_offset); 
     93                        $printbuf = sprintf("&nbsp;<b>%08d</b> ", $binary_offset); 
    8994 
    9095                        while ($offset < $ascii_length){ 
     
    101106                                        // so print off the current line & start a new one 
    102107                                        $printbuf = $printbuf."<br>"; 
    103                                         InfocardUtils::printDebug( $printbuf ); 
     108                                        pw_utils::printDebug( $printbuf ); 
    104109                                        $binary_offset += 32; 
    105110                                        $printbuf = sprintf("&nbsp;<b>%08d</b> ", $binary_offset); 
     
    109114 
    110115                        if ($linelen > 0) 
    111                                 InfocardUtils::printDebug( $printbuf . "<br/>"); 
     116                                pw_utils::printDebug( $printbuf . "<br/>"); 
    112117                } 
    113118 
     
    128133                if (strcmp($db_item, $token_item) == 0) 
    129134                { 
    130                         Infocardutils::printDebug("&nbsp; $item_name: matches ($db_item)<br/>"); 
     135                        pw_utils::printDebug("&nbsp; $item_name: matches ($db_item)<br/>"); 
    131136                        return (TRUE); 
    132137                } 
    133138                else 
    134139                { 
    135                         Infocardutils::printDebug("&nbsp; $item_name:&nbsp;DB: $db_item &nbsp;&nbsp;TOKEN: $token_item<br/>"); 
     140                        pw_utils::printDebug("&nbsp; $item_name:&nbsp;DB: $db_item &nbsp;&nbsp;TOKEN: $token_item<br/>"); 
    136141                        return (FALSE); 
    137142                }