Changeset 41

Show
Ignore:
Timestamp:
05/10/07 14:40:01 (2 years ago)
Author:
pdingle
Message:

added extra functions to wp/utils.pw.php so they match the jos version

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-infocard/wp/audit.pw.php

    r33 r41  
    3333        } // end function writeToAudit 
    3434         
    35 } // end class pw_utils 
     35} // end class pw_audit 
    3636?> 
  • trunk/wp-infocard/wp/utils.pw.php

    r38 r41  
    88class pw_utils extends pwlib_utils { 
    99 
    10         function sendEmail($from_address, $from_name, $to_address, $body, $subject=''
     10        function sendEmail($to_address, $subject, $body
    1111        { 
    1212 
     
    3434        } 
    3535 
     36        function printDebugHeader( $content ) 
     37        { 
     38                if (PW_DEBUG_ON) 
     39                { 
     40                        echo "<title>$content</title>\n"; 
     41                } 
     42        } // end function printDebugHeader 
     43 
    3644        function printDebug( $content ) { 
    3745        // 
     
    4755                }        
    4856        } // end function printDebug 
    49  
    50         function printBinary ($title, $binary) 
    51         { 
    52                 // if debugging is on, this pretty-prints the contents of $binary 
    53                 // if debugging is off, printBinary simply returns. 
    54                 if (PW_DEBUG_ON) { 
    55  
    56                         pw_utils::printDebug( $title . " (length: " .strlen($binary) . " octents) <br/>"); 
    57                         $ascii = strtoupper(bin2hex($binary)); 
    58                         $ascii_length = strlen($ascii); 
    59  
    60                         $offset = 0; 
    61                         $linelen = 0; 
    62                         $binary_offset = 0; 
    63                         // initial value of printbuf is 8 zeros 
    64                         $printbuf .= sprintf("&nbsp;<b>%08d</b> ", $binary_offset); 
    65  
    66                         while ($offset < $ascii_length){ 
    67                                 $printbuf = $printbuf.substr($ascii, $offset, 8); 
    68                                 $offset += 8; 
    69                                 $linelen += 8; 
    70  
    71                                 if ($linelen < 64){ 
    72                                         if ($offset < $ascii_length) 
    73                                                 $printbuf = $printbuf.'-'; 
    74                                 } 
    75                                 else { 
    76                                         // output needs to span multiple lines 
    77                                         // so print off the current line & start a new one 
    78                                         $printbuf = $printbuf."<br>"; 
    79                                         pw_utils::printDebug( $printbuf ); 
    80                                         $binary_offset += 32; 
    81                                         $printbuf = sprintf("&nbsp;<b>%08d</b> ", $binary_offset); 
    82                                         $linelen = 0; 
    83                                 } 
    84                         } 
    85  
    86                         if ($linelen > 0) 
    87                                 pw_utils::printDebug( $printbuf . "<br/>"); 
    88                 } 
    89  
    90         } // end of function print_binary 
    91  
    92         // Function: writeToAudit 
    93         // Description:  writeToAudit puts information into the pw_infocard_audit table. 
    94         // Input:  IP address, Certificate Modulus, Email from token, Account ID if  
    95         //              available, any Error message 
    96         // Output: none 
    97         // Side Effects:  alters DB table 
    98         function writeToAudit( $ip, $modulus, $ppid, $email, $error, $acct)  
    99         { 
    100                 global $wpdb; 
    101                  
    102                 $today = date('Y-m-d H-i-s'); 
    103                 $query = "INSERT INTO `wp_infocard_audit` " 
    104                 . "(`modulusHash`, `ppid`, `accountid`, `email`,`time`,`IP`,`status`) " 
    105                 . "VALUES ('$modulus', '$ppid', '$acct', '$email','$today','$ip','$error')"; 
    106  
    107                 $update_result = $wpdb->query( $query ); 
    108                 if ( $update_result == FALSE ) 
    109                 { 
    110                         pw_utils::printDebug("Error ".mysql_errno($update_result)."with mysql_query update (".mysql_error($update_result).")<br/>"); 
    111                 } 
    112  
    113         } // end function writeToAudit 
    11457 
    11558        function printTitle(){ 
     
    205148        } // end function printUserMessageLinks 
    206149 
     150        function infocardPostIncludes() 
     151        { 
     152                // no joomla includes needed 
     153        } 
     154                                                 
     155        function getDefaultLang() 
     156        { 
     157                // hard-coded for now 
     158 
     159                return 'en-us'; 
     160        } 
     161 
     162        function showClaimList($claimslist) 
     163        { 
     164                pw_utils::printDebug('<br/>Requested Claims:<br/>'); 
     165                foreach ($claimslist as $claim) 
     166                { 
     167                        pw_utils::printDebug( '&nbsp;' . $claim->displayname . (($claim->required)?'  (required)':'  (optional)') . '<br/>'); 
     168                        //pw_utils::printDebug($claim->displayname); 
     169                } 
     170                pw_utils::printDebug('<br/>'); 
     171        } 
     172 
     173        function showDataMap($datamap) 
     174        { 
     175                pw_utils::printDebug('<br/>Mapped Data:<br/>'); 
     176                foreach ($datamap as $map) 
     177                { 
     178                        pw_utils::printDebug($map->handle . " in " 
     179                        . $map->mappingtable . "." 
     180                        . $map->mappingattribute 
     181                        . (($map->description != '')?"  (".$map->description.")":"") 
     182                        . "<br />"); 
     183                } 
     184        } // end function showDataMap 
     185 
     186        function redirectToURL( $url ) 
     187        { 
     188                wp_redirect( $url ); 
     189        } 
     190 
     191        function getUserMessageURL( $mesg ) 
     192        { 
     193                return PW_PLUGINURL 
     194                . "/site-messages/infocard-usermessage.php?mesg=".$mesg; 
     195        } 
    207196 
    208197} // end class pw_utils