Changeset 33

Show
Ignore:
Timestamp:
04/14/07 17:18:30 (2 years ago)
Author:
pdingle
Message:

More file separation

Files:

Legend:

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

    r30 r33  
    66class InfocardGeneral { 
    77 
    8         function printCSSlink(){ 
    9                 //print "http://wordpress/ic-admin/infocard.css"; 
    10                 print PW_PLUGINURL . "/infocard.css"; 
    11         } 
    12  
    13         function printTitle(){ 
    14                 if ( function_exists('get_settings') ){ 
    15                         print get_settings('blogname'); 
    16                 } else { 
    17                         _e('Blog Login', wp-infocard); 
    18                 } 
    19         } 
    20          
    21         function printHomeLink(){ 
    22                 // This is where the "Back to blog" link goes. 
    23                 print get_settings('siteurl'); 
    24         } 
    25  
    26         function printPamelaProjectLink() { 
    27                 print "<a href='http://pamelaproject.com' title='" ; 
    28                 _e('Learn about Information Cards', 'wp=infocard'); 
    29                 print "'>&laquo; "; 
    30                 _e('Learn more at PamelaProject.com', 'wp-infocard'); 
    31                 print "</a>"; 
    32         } 
    33  
    348        function errorPageRedirect( $error_code='', $error_details = '') {  
    35                 $redirect = PW_PLUGINURL . "/error/error.php?error_code=" . $error_code; 
     9                $redirect = PW_PLUGINURL . "/pwlib/error/error.php?error_code=" . $error_code; 
    3610                if ($error_details)  
    3711                { 
     
    4519                <html xmlns="http://www.w3.org/1999/xhtml"> 
    4620                        <script> 
    47                                 if(confirm("Do you want to be redirected to the Error Page?")) 
    48                                 { 
     21<?php 
     22                                if (PW_DEBUG_ON) 
     23                                { 
     24                                echo "if(confirm('Do you want to be redirected to the Error Page?'))"; 
     25                                } 
     26?> 
    4927                                        location="<?php print($redirect); ?>";    
    50                                 } 
    51                         </script> 
     28                        </script> 
    5229 
    5330                </html> 
  • trunk/wp-infocard/processing/class.infocard-processing.php

    r32 r33  
    11<?php 
    22//defined( '_VALID_IC' ) or die( 'Direct Access to this location is not allowed.'); 
    3 require_once( dirname(__FILE__) . '/../class.infocard-basic.php' ); 
    43include_once("infocard-print-binary.php"); 
    54require_once( ABSPATH . WPINC . '/registration-functions.php'); 
     
    2322                //      Message, you would customize this function. 
    2423 
    25                 $clickbackUrl = PW_PLUGINURL . "/login/infocard-clickback.php?" . $clickbackID; 
     24                $clickbackUrl = PW_PLUGINURL . "/pwlib/login/infocard-clickback.php?" . $clickbackID; 
    2625 
    2726                $message  = sprintf(__('Please complete your registration at %s by opening the link below.'), get_settings('blogname')) . "\r\n\r\n"; 
     
    3029                wp_mail($user_email, sprintf(__('[%s] New User InfoCard Registration'), get_settings('blogname')), $message); 
    3130 
    32                 InfocardUtils::printDebug( "<br/><br/>Account Validation is required.<br/>" 
     31                pw_utils::printDebug( "<br/><br/>Account Validation is required.<br/>" 
    3332                        . "Emailing Registration info to: $user_email<br/>" 
    3433                        . "User would be redirected to:  <a href=\"$clickbackUrl\">$clickbackUrl</a><br/>" 
     
    5655                if (PW_DEBUG_ON)  
    5756                { 
    58                         InfocardUtils::printDebug("<br/>Action: Compare & Update User Data<br/>");     
     57                        pw_utils::printDebug("<br/>Action: Compare & Update User Data<br/>");  
    5958 
    6059                        $sql =  "SELECT a.*, b.meta_value as first_name, " 
     
    7271                        if (!user_row) 
    7372                        { 
    74                                 InfocardUtils::printDebug("Error getting original user information from database <br/>"); 
     73                                pw_utils::printDebug("Error getting original user information from database <br/>"); 
    7574                        } 
    7675                        else 
     
    104103                        $update_result = $wpdb->query( $sql ); 
    105104 
    106                         InfocardUtils::printDebug( 'Updated LoginID<br/>');    
     105                        pw_utils::printDebug( 'Updated LoginID<br/>');         
    107106                }                
    108                 InfocardUtils::printDebug ( '<br/>Database Updated<br/>' ); 
     107                pw_utils::printDebug ( '<br/>Database Updated<br/>' ); 
    109108        } // end function updateUserData 
    110109 
     
    134133                $clickback_salt = pw_admin::getOption('pw_clickback_salt'); 
    135134 
    136                 InfocardUtils::printDebug("Clickback: Challenge Created. <br/>" 
     135                pw_utils::printDebug("Clickback: Challenge Created. <br/>" 
    137136                        . "Clickback: salted data is " . (($data)?$data:"empty") . "<br/>" 
    138137                        . "Clickback: length is " . PW_CLICKBACK_LENGTH  
     
    143142                $chopped = substr($data, 0, PW_CLICKBACK_LENGTH); 
    144143 
    145                 InfocardUtils::printDebug("Clickback: Hash of the salted challenge data: $data<br/>" 
     144                pw_utils::printDebug("Clickback: Hash of the salted challenge data: $data<br/>" 
    146145                        . "Clickback: Chopped challenge data: $chopped <br/>"); 
    147146 
     
    152151        function verifyChallenge( $currentChallenge, $previousChallenge ) { 
    153152 
    154                 InfocardUtils::printDebug("<br/>Action: verifyClickbackChallenge. <br/>" 
     153                pw_utils::printDebug("<br/>Action: verifyClickbackChallenge. <br/>" 
    155154                        . "Binary Clickback Details:<br/>"); 
    156155 
    157                 InfocardUtils::printDebug("&nbsp;Previous Challenge: " . $previousChallenge . "X<br/>" 
     156                pw_utils::printDebug("&nbsp;Previous Challenge: " . $previousChallenge . "X<br/>" 
    158157                        . "&nbsp;Current Challenge: " . $currentChallenge . "X<br/>"); 
    159158                // printBinary only prints if PW_DEBUG_ON is on. Otherwise it just falls through. 
    160                 InfocardUtils::printBinary("computed challenge: ", $currentChallenge); 
    161                 InfocardUtils::printBinary("previous challenge:", $previousChallenge); 
     159                pw_utils::printBinary("computed challenge: ", $currentChallenge); 
     160                pw_utils::printBinary("previous challenge:", $previousChallenge); 
    162161 
    163162                if ($currentChallenge == $previousChallenge) { 
    164                         InfocardUtils::printDebug("&nbsp;verifyClickback: challenges match<br/>"); 
     163                        pw_utils::printDebug("&nbsp;verifyClickback: challenges match<br/>"); 
    165164                        return (TRUE); 
    166165                } else { 
    167                         InfocardUtils::printDebug("&nbsp;verifyClickback: challenges DO NOT match<br/>"); 
     166                        pw_utils::printDebug("&nbsp;verifyClickback: challenges DO NOT match<br/>"); 
    168167                        return (FALSE); 
    169168                } 
  • trunk/wp-infocard/processing/infocard-post.php

    r32 r33  
    4040        $debug_statement .= "PHP Version: " . phpversion() . "<br/>"; 
    4141        $debug_statement .= "PHP Include Path: " . ini_get('include_path') . "<br/>"; 
    42         InfocardUtils::printDebug($debug_statement); 
     42        pw_utils::printDebug($debug_statement); 
    4343    } 
    4444 
     
    5959        } 
    6060 
    61         InfocardUtils::printDebug("<br/>Action: decryptToken <br>"); 
     61        pw_utils::printDebug("<br/>Action: decryptToken <br>"); 
    6262 
    6363        $error=infocard_post_decrypt($tokenContent, $token); 
     
    6868        } 
    6969  
    70         InfocardUtils::printDebug( "<br/>Action: getTokenClaims <br>"); 
     70        pw_utils::printDebug( "<br/>Action: getTokenClaims <br>"); 
    7171 
    7272        if ($error = infocard_post_get_claims($token, $claims)) 
     
    8080                        $debug_statement .= "&nbsp;Claim:  $key - $value <br>"; 
    8181                } 
    82                 InfocardUtils::printDebug( $debug_statement ); 
     82                pw_utils::printDebug( $debug_statement ); 
    8383        }  
    8484 
     
    128128                                if (!user_row)  
    129129                                { 
    130                                         InfocardUtils::printDebug("Error with new email request getting original user information"); 
     130                                        pw_utils::printDebug("Error with new email request getting original user information"); 
    131131                                        $error = 'BADDBREQUEST'; 
    132132                                }  
     
    149149                        if (!$user_ID)  
    150150                        { 
    151                                InfocardUtils::printDebug('Problem Creating New User'); 
     151                               pw_utils::printDebug('Problem Creating New User'); 
    152152                                $error = 'USERNOTCREATED'; 
    153153                        }  
    154154                        else  
    155155                        { 
    156                                 InfocardUtils::printDebug("inserted record with id: $user_ID<br>"); 
     156                                pw_utils::printDebug("inserted record with id: $user_ID<br>"); 
    157157                        } 
    158158 
     
    175175        { 
    176176             
    177                 InfocardUtils::printDebug("<br/>Action: check Account Validation<br/>"); 
     177                pw_utils::printDebug("<br/>Action: check Account Validation<br/>"); 
    178178 
    179179                $clickbackUrl = InfocardClickback::createChallenge($challengeContent); 
     
    181181                { 
    182182 
    183                         InfocardUtils::printDebug("&nbsp;Clickback posted<br/>"); 
     183                        pw_utils::printDebug("&nbsp;Clickback posted<br/>"); 
    184184                        $previousChallenge = trim($_POST["clickback"]); 
    185185 
     
    187187                        { 
    188188                                $accountValidationRequired = FALSE; 
    189                                 InfocardUtils::printDebug("&nbsp;Account validation has succeeded <br>"); 
     189                                pw_utils::printDebug("&nbsp;Account validation has succeeded <br>"); 
    190190                                $relocationUrl = PW_SITEMESGURL . '?clickback-success';  
    191191                                $incominguser['status'] = 'clickback-success'; 
     
    215215    if (strlen($error) > 0) 
    216216    { 
    217         InfocardUtils::printDebug("Unexpected Error: $error <br/>"); 
     217        pw_utils::printDebug("Unexpected Error: $error <br/>"); 
    218218        $relocationUrl = "error"; 
    219219    } 
     
    245245                } 
    246246 
    247                 InfocardUtils::printDebug($comments_to_date); 
     247                pw_utils::printDebug($comments_to_date); 
    248248 
    249249            if (array_key_exists("clickback", $_POST)){ 
     
    266266    if ($relocationUrl == "error")  
    267267    { 
    268         InfocardGeneral::errorPageRedirect($error); 
     268        pw_utils::errorPageRedirect($error); 
    269269    }  
    270270    else  
     
    280280 
    281281                $debug_statement .= "Final redirect: <a href=\"$relocationUrl\">$relocationUrl</a> <br/>"; 
    282                 InfocardUtils::printDebug( $debug_statement ); 
     282                pw_utils::printDebug( $debug_statement ); 
    283283 
    284284        } 
  • trunk/wp-infocard/pw-config.php

    r32 r33  
    33define ('PW_VALIDITY_WINDOW', 300); 
    44define ('PW_CLICKBACK_LENGTH', 16); 
    5 define ('PW_DEBUG_ON', true); 
    65define ('PW_PLUGINPATH', 'wp-content/plugins/wp-infocard'); 
    76 
    87require( dirname(__FILE__) . '/../../../wp-config.php' ); 
     8define ('PW_DEBUG_ON', get_settings('pw_debug_on')); 
    99define ('PW_PATH', ABSPATH . PW_PLUGINPATH); 
    10 define ('PW_IMGPATH', PW_PATH . '/images'); 
     10define ('PW_IMGPATH', PW_PATH . '/pwlib/images'); 
    1111define ('PW_SITEMESGPATH', PW_PATH . '/site-messages'); 
    12 define ('PW_IMGURL', get_settings('siteurl') . '/wp-content/plugins/wp-infocard/images'); 
    1312define ('PW_PLUGINURL', get_settings('siteurl') . '/' . PW_PLUGINPATH ); 
     13define ('PW_IMGURL', PW_PLUGINURL . '/pwlib/images'); 
    1414define ('PW_SECUREPLUGINURL', get_settings('pw_securesiteurl') . '/' . PW_PLUGINPATH ); 
    1515define ('PW_SITEMESGURL', PW_PLUGINURL . '/site-messages/infocard-usermessage.php'); 
  • trunk/wp-infocard/site-messages/infocard-help.php

    r24 r33  
    11<?php 
    22$messageType = $_SERVER['QUERY_STRING']; 
    3 include_once( dirname(__FILE__) . '/../class.infocard-basic.php'); 
     3include_once( dirname(__FILE__) . '/../' . '/pw-config.php'); 
     4include_once( dirname(__FILE__) . '/../' . PW_PLUGIN . '/utils.pw.php'); 
    45//nocache_headers(); 
    56?> 
     
    78<html xmlns="http://www.w3.org/1999/xhtml"> 
    89<head> 
    9         <title><?php _e('User Help') ?></title> 
     10        <title><?php pw_utils::screenPrint('User Help') ?></title> 
    1011        <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" /> 
    11         <link rel="stylesheet" href="<?php InfocardGeneral::printCSSlink(); ?>" type="text/css" /> 
     12        <link rel="stylesheet" href="<?php pw_utils::printCSSlink(); ?>" type="text/css" /> 
    1213</head> 
    1314<body> 
    1415 
    1516<div id="help"> 
    16         <?php InfocardGeneral::printUserMessageText( $messageType ); ?> 
     17        <?php pw_utils::printUserMessageText( $messageType ); ?> 
    1718        <p class="submit"> 
    18                 <?php InfocardGeneral::printUserMessageLinks( $messageType ); ?> 
     19                <?php pw_utils::printUserMessageLinks( $messageType ); ?> 
    1920</p> 
    2021</div> 
  • trunk/wp-infocard/site-messages/infocard-usermessage.php

    r24 r33  
    22$messageType = $_SERVER['QUERY_STRING']; 
    33 
    4 include_once( dirname(__FILE__) . '/../class.infocard-basic.php'); 
     4include_once( dirname(__FILE__) . '/../' . '/pw-config.php'); 
     5include_once( dirname(__FILE__) . '/../' . PW_PLUGIN . '/utils.pw.php'); 
    56//nocache_headers(); 
    67?> 
     
    89<html xmlns="http://www.w3.org/1999/xhtml"> 
    910<head> 
    10         <title><?php _e('User Message') ?></title> 
     11        <title><?php pw_utils::screenPrint('User Message'); ?></title> 
    1112        <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" /> 
    12         <link rel="stylesheet" href="<?php InfocardGeneral::printCSSlink(); ?>" type="text/css" /> 
     13        <link rel="stylesheet" href="<?php pw_utils::printCSSlink(); ?>" type="text/css" /> 
    1314</head> 
    1415<body> 
    1516 
    1617<div id="login"> 
    17         <?php InfocardGeneral::printUserMessageText( $messageType ); ?> 
     18 
     19 
     20        <?php pw_utils::printUserMessageText( $messageType ); ?> 
    1821        <p class="submit"> 
    19                 <?php InfocardGeneral::printUserMessageLinks( $messageType ); ?> 
     22                <?php pw_utils::printUserMessageLinks( $messageType ); ?> 
    2023</p> 
    2124</div> 
  • trunk/wp-infocard/wp-infocard.php

    r30 r33  
    3030         
    3131 
    32                 function infocard_admin_menu() 
    33                 { 
    34                         if(function_exists('add_options_page')) 
    35                         {//($page_title, $menu_title, $access_level, $file, $function = '') 
    36                                 add_options_page('Information Card Options','Information Card Options', 'manage_options', basename(__FILE__),'infocard_options' ); 
    37                         } 
    38                 } 
     32function infocard_admin_menu() 
     33
     34        if(function_exists('add_options_page')) 
     35        { 
     36                //($page_title, $menu_title, $access_level, $file, $function = '') 
     37                add_options_page('Information Card Options','Information Card Options', 'manage_options', basename(__FILE__),'infocard_options' ); 
     38        } 
     39} // end function infocard_admin_menu 
    3940 
    40                 add_action('admin_menu', 'infocard_admin_menu'); 
     41add_action('admin_menu', 'infocard_admin_menu'); 
     42add_action( 'delete_user', array( &$wpInfocard, 'pw_deleteUserCards' ) ); 
    4143 
    42  
    43                 function infocard_options() { 
    44                         // Content shown in the Options page is constructed here 
    45                         $ic_opener = $new_opener = get_option('pw_infocard_opener'); 
    46                         $ic_key = $new_key = get_option('pw_infocard_key'); 
    47                         $secureurl = $new_secureurl = get_option('pw_securesiteurl'); 
    48                         $ic_secret = get_option('secret'); 
    49  
    50                         if ( $_POST["infocard_admin_submit"] ){ 
    51                                 //update the db with submitted information 
    52                                         $new_opener = $_POST["infocard_opener"]; 
    53                                         $new_key = $_POST["infocard_key"]; 
    54                                         $new_secureurl = $_POST["securesiteurl"]; 
    55                         } 
    56                         if ( $ic_opener != $new_opener ){ 
    57                                 update_option('pw_infocard_opener', $new_opener); 
    58                         } 
    59  
    60                         if ( $ic_key != $new_key ){ 
    61                                 update_option('pw_infocard_key', $new_key); 
    62                         } 
    63  
    64                         if ( $secureurl != $new_secureurl ){ 
    65                                 update_option('pw_securesiteurl', $new_secureurl ); 
    66                         } 
    67  
    68                          
    69                         $openssl_loaded = extension_loaded("openssl");   
    70                         $mcrypt_loaded = extension_loaded("mcrypt"); 
    71                         if ($openssl_loaded) { 
    72                                 $key_works = pw_admin::verifyGivenCerts();  
    73                         } 
    74                         ?> 
    75                         <div class="wrap">       
    76                         <form  action="" method="post"> 
    77                         <h2><?php _e('Information Card Login', 'wp-infocard'); ?></h2> 
    78                         <table border="0"><tr><th valign="bottom" colspan="2" align="left"> 
    79                         <?php _e('The plugin will not work until this checklist is positive:', 'wp-infocard'); ?></th></tr> 
    80                         <tr><td> 
    81                                 <?php _e('PHP Version 5 or greater installed', 'wp-infocard'); ?> 
    82                         </td><td valign="bottom">&nbsp; 
    83                                 <img src="<?php print pw_admin::checklist_icon(version_compare(phpversion(), '5.0', '>=')); ?>"/>                                 
    84                                  
    85                                 <a href="help/help.php?topic=php"><?php _e('More Information', 'wp-infocard');?></a> 
    86                         </td></tr> 
    87                         <tr><td> 
    88                                 <?php _e('Mcrypt PHP Libraries Installed', 'wp-infocard'); ?> 
    89                         </td><td valign="bottom">&nbsp; 
    90                                 <img src="<?php print pw_admin::checklist_icon($mcrypt_loaded); ?>"/> 
    91                                 <a href="help/help.php?topic=mcrypt"><?php _e('More Information', 'wp-infocard');?></a> 
    92                         </td></tr>   
    93 <?php                   if ($mcrypt_loaded) {  ?> 
    94                         <tr><td> 
    95                                 <?php _e('Rijndael 128 Algorithm Available', 'wp-infocard'); ?> 
    96                         </td><td valign="bottom">&nbsp; 
    97                                 <img src="<?php print pw_admin::checklist_icon(mcrypt_module_self_test(MCRYPT_RIJNDAEL_128)); ?>"/> 
    98                                 <a href="help/help.php?topic=rijndael"><?php _e('More Information', 'wp-infocard');?></a> 
    99                         </td></tr> 
    100 <?php                   } // end if mcrypt_loaded       ?> 
    101                         <tr><td> 
    102                                 <?php _e('OpenSSL Enabled', 'wp-infocard'); ?> 
    103                         </td><td valign="bottom">&nbsp; 
    104                                 <img src="<?php print pw_admin::checklist_icon($openssl_loaded); ?>"/> 
    105                                 <a href="help/help.php?topic=openssl"><?php _e('More Information', 'wp-infocard');?></a> 
    106                         </td></tr> 
    107                         <tr><td> 
    108                                 <?php _e('SSL Connection to Secure Site URL Works', 'wp-infocard'); ?> 
    109                         </td><td valign="bottom">&nbsp; 
    110                                 <img src="<?php print pw_admin::checklist_icon(pw_admin::verifySSLURL($new_secureurl)); ?>"/>    
    111                                 <a href="help/help.php?topic=cert"><?php _e('More Information', 'wp-infocard');?></a> 
    112                         </td></tr> 
    113                         <tr><td> 
    114                                 <?php _e('Private Key Validly Formatted', 'wp-infocard'); ?> 
    115                         </td><td valign="bottom">&nbsp; 
    116                                 <img src="<?php print pw_admin::checklist_icon($key_works); ?>"/> 
    117                                 <a href="help/help.php?topic=privatekey"><?php _e('More Information', 'wp-infocard');?></a> 
    118                         </td></tr> 
    119                         <tr><td>&nbsp</td><td/></tr> 
    120          
    121                         <tr><th colspan="2" align="left">Information Card Required Information</td></tr> 
    122                         <tr><td valign="top"> 
    123                         <label for="securesiteurl" title="Secure Site URL"> 
    124                         <?php _e('Secure Site URL', 'wp-infocard'); ?> 
    125                         </label> 
    126                         </td><td> 
    127                         <input type="text" name="securesiteurl" id="securesiteurl" size="50" value="<?php print $new_secureurl; ?>" /> 
    128                         </td></tr> 
    129  
    130                         <tr><td valign="top"> 
    131                         <label for="infocard_key" title="SSL Private Key"> 
    132                         <?php _e('SSL Private Key', 'wp-infocard'); ?>   
    133                         </label> 
    134                         </td><td> 
    135                         <textarea cols="50" rows="4" name="infocard_key" id="infocard_key"><?php print $new_key; ?></textarea> 
    136                         </td></tr> 
    137                         <tr><td> 
    138                         <label for="infocard_opener" title="SSL Passphrase"> 
    139                         <?php _e('SSL Passphrase', 'wp-infocard'); ?> 
    140                         </label> 
    141                         </td><td> 
    142                         <input type="text" name="infocard_opener" id="infocard_opener" size="50" value="<?php print $new_opener; ?>" /> 
    143                         </td></tr> 
    144                         <tr><td>&nbsp</td><td/></tr> 
    145                         <tr><th colspan="2" align="left">To Enable Information Card User Login</td></tr> 
    146                         <tr><td colspan="2"><?php _e('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> 
    147                         <tr><td colspan="2" id="code"> 
    148                                 <ol> 
    149 <?php                           $login_file = ABSPATH . "wp-login.php";  
    150                                 _e('<li>Copy ' . $login_file . ' to '. $login_file . '.orig</li>');  
    151                                 _e('<li>Insert the following code as described in in the next step:' );  
    152                                 print "<br/>wp_redirect( get_settings('siteurl').\"/wp-content/plugins/wp-infocard/login/login.php\");<br/></li>"; 
    153                                 _e('<li>Wordpress 2.0.7:  Edit '. $login_file .' and insert the following code between lines 209 and 210 of the file, should be just after the two lines below:' );  
    154                                 print "<code><br/>&nbsp;?><br/>"; 
    155                                 print "&lt;!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><br/></li></code>"; 
    156                                 _e('<br/><li>Wordpress 2.1.x: Insert the same line at line 381, just before this line:' );  
    157                                 _e('<code><br/>&nbsp;login_header(__(\'Login\'));</li></code>'); 
     44function infocard_options()  
     45
     46        // Content shown in the Options page is constructed here 
    15847?> 
    159                         </td></tr> 
    160 <tr><td>&nbsp</td><td/></tr> 
    161 <tr><th colspan="2" align="left">Advanced TroubleShooting</td></tr> 
    162                         <tr><td colspan="2"><?php _e('This test requires that changes be made to the Apache configuration files.  You only need to run this test if everything is green above, but things are still broken.'); ?></td></tr> 
    163  <tr><td> 
    164                                 <?php _e('Advanced Certificate Check', 'wp-infocard'); ?> 
    165                         </td><td valign="bottom">&nbsp; 
    166                                 <?php //pw_admin::advancedCertTest(IC_IMGURL); ?> 
    167                                 <br/>&nbsp;<a href="help/help.php?topic=advancedcerttest"><?php _e('More Information', 'wp-infocard');?></a> 
    168                         </td></tr> 
    169  
    170                         </table> 
    171                         <input type="submit" name="infocard_admin_submit" id="infocard_admin_submit" value="<?php _e('Save', 'wp-infocard');?>" /> 
    172                         </p> 
    173                         </form> 
    174                 <?php  
    175                         if (!$ic_secret) { 
    176                                 _e('There is no 32-bit secret generated for this blog - the secret is needed for security purposes. Do not use this plugin until a secret has been generated & placed into the database', 'wp-infocard'); 
    177                         } 
    178                 ?> 
    179                         </div> 
    180                 <?php 
    181                 } 
     48        <div class="wrap">       
     49                <h2> 
     50                        <?php _e('Information Card Login', 'wp-infocard'); ?> 
     51                </h2> 
     52<?php 
     53                pw_admin::pwAdminScreen(); 
     54?> 
     55        </div> 
     56<?php 
     57} // end function infocard_options 
    18258 
    18359// Add tab in the admin menu 
  • trunk/wp-infocard/wp/admin.pw.php

    r31 r33  
    22//defined( '_VALID_IC' ) or die( 'Direct Access to this location is not allowed.'); 
    33include_once( dirname(__FILE__) . '/../pw-config.php'); 
    4 include_once( dirname(__FILE__) . '/../pw/admin.pwlib.php'); 
     4include_once( dirname(__FILE__) . '/../pwlib/admin.pwlib.php'); 
    55//require_once( ABSPATH . WPINC . '/registration-functions.php'); 
    66/* 
     
    4444                //$this->table_options = $table_prefix . "infocard_options"; 
    4545                $this->table_options = $table_prefix . "options"; 
    46         } 
    47         // end pw_infocard 
     46        } // end pw_infocard 
    4847 
    4948        // Function: createAuditTable 
     
    167166                $this->createOption('pw_securesiteurl', $https_url); 
    168167 
    169         } 
     168                $this->createOption('pw_debug_on', 0); 
     169                $this->createOption('pw_enable_pass', 0); 
     170 
     171        } // end function setup 
    170172 
    171173        // Function: createOption 
     
    186188 
    187189        } // end function createOptionValue 
     190 
     191        function pw_deleteUserCards($accountid) 
     192        { 
     193                global $wpdb; 
     194                $query = "DELETE FROM `wp_infocard_identities` WHERE accountid " 
     195                        . " = '" . (int)$accountid . "'"; 
     196 
     197                return $wpdb->query( $query ); 
     198        } // end function delete_user_cards 
    188199 
    189200} // end class pw_infocard 
     
    229240        } // end function createNewAccount 
    230241 
     242        function pwAdminScreen() 
     243        { 
     244                // get initial option values  
     245                $ic_opener = $new_opener = pw_admin::getOption('pw_infocard_opener'); 
     246                $ic_key = $new_key = pw_admin::getOption('pw_infocard_key'); 
     247                $secureurl = $new_secureurl = pw_admin::getOption('pw_securesiteurl'); 
     248                $ic_secret = pw_admin::getOption('secret'); 
     249                $ic_debug = $new_debug = pw_admin::getOption('pw_debug_on'); 
     250                $ic_pass = $new_pass = pw_admin::getOption('pw_enable_pass'); 
     251 
     252                // write submitted changes if this page reload shows a submit 
     253                if ( $_POST["infocard_admin_submit"] ) 
     254                { 
     255                        $new_opener = $_POST['pw_infocard_opener']; 
     256                        $new_key = $_POST['pw_infocard_key']; 
     257                        $new_secureurl = $_POST['pw_securesiteurl']; 
     258                        $new_debug = $_POST['pw_debug_on']; 
     259                        $new_pass = $_POST['pw_enable_pass']; 
     260                } 
     261 
     262                if ( $ic_opener != $new_opener ){ 
     263                        update_option('pw_infocard_opener', $new_opener); 
     264                } 
     265 
     266                if ( $ic_key != $new_key ){ 
     267                        update_option('pw_infocard_key', $new_key); 
     268                } 
     269 
     270                if ( $secureurl != $new_secureurl ){ 
     271                        update_option('pw_securesiteurl', $new_secureurl ); 
     272                } 
     273 
     274                if ( $ic_debug != $new_debug ){ 
     275                        update_option('pw_debug_on', $new_debug ); 
     276                } 
     277                 
     278                if ( $ic_pass != $new_pass ){ 
     279                        update_option('pw_enable_pass', $new_pass ); 
     280                } 
     281                 
     282                pw_admin::printSystemCheck();    
     283?> 
     284                                        <form  action="" method="post"> 
     285                        <table border="0"><tr><th valign="bottom" colspan="2" align="left"> 
     286                        <tr><td>&nbsp</td><td/></tr> 
     287 
     288                        <tr><th colspan="2" align="left">Information Card Configuration</td></tr> 
     289                        <tr><td valign="top"> 
     290                        <label for="securesiteurl" title="Secure Site URL"> 
     291                        <?php _e('Secure Site URL', 'wp-infocard'); ?> 
     292                        </label> 
     293                        </td><td> 
     294                        <input type="text" name="pw_securesiteurl" id="pw_securesiteurl" size="50" value="<?php print $new_secureurl; ?>" /> 
     295                        </td></tr> 
     296 
     297                        <tr><td valign="top"> 
     298                        <label for="pw_infocard_key" title="SSL Private Key"> 
     299                        <?php _e('SSL Private Key', 'wp-infocard'); ?> 
     300                        </label> 
     301                        </td><td> 
     302                        <textarea cols="60" rows="4" name="pw_infocard_key" id="pw_infocard_key"><?php print $new_key; ?></textarea> 
     303                        </td></tr> 
     304                        <tr><td> 
     305                        <label for="pw_infocard_opener" title="SSL Passphrase"> 
     306                        <?php _e('SSL Passphrase', 'wp-infocard'); ?> 
     307                        </label> 
     308                        </td><td> 
     309                        <input type="text" name="pw_infocard_opener" id="pw_infocard_opener" size="50" value="<?php print $new_opener; ?>" /> 
     310                        </td></tr> 
     311 <tr><td colspan="2"> 
     312                                <input name="pw_enable_pass" type="checkbox" id="pw_enable_pass" value="1" <?php checked('1', ($new_pass)); ?> /> 
     313                                <?php _e('Use Username/Password in addition to Information Cards', 'wp-infocard'); ?> 
     314                        </td></tr> 
     315                        <tr><td>&nbsp;</td><td/></tr> 
     316                        <tr><td>&nbsp; 
     317<?php 
     318                                if (!$ic_secret) { 
     319                                _e('There is no 32-bit secret generated for this blog - the secret is needed for security purposes. Do not use this plugin until a secret has been generated & placed into the database', 'wp-infocard'); 
     320                        } 
     321?> 
     322                        </td></tr> 
     323                        <tr><th colspan="2" align="left">To Enable Information Card User Login</td></tr> 
     324                        <tr><td colspan="2"><?php _e('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> 
     325                        <tr><td colspan="2" id="code"> 
     326<?php 
     327                        pw_admin::printInstallData(); 
     328?> 
     329                        </td></tr> 
     330<tr><td>&nbsp</td><td/></tr> 
     331<tr><th colspan="2" align="left">Advanced TroubleShooting</td></tr> 
     332                        <tr><td>&nbsp;</td><td/></tr> 
     333                        <tr><td colspan="2"> 
     334                                <input name="pw_debug_on" type="checkbox" id="pw_debug_on" value="1" <?php checked('1', ($new_debug)); ?> /> 
     335                                <?php _e('Debug Mode', 'wp-infocard'); ?> 
     336                        </td></tr> 
     337                        <tr><td>&nbsp;</td><td/></tr> 
     338                        <tr><td colspan="2"><?php _e('This test requires that changes be made to the Apache configuration files.  You only need to run this test if everything is green above, but things are still broken.'); ?></td></tr> 
     339 <tr><td> 
     340                                <?php _e('Advanced Certificate Check', 'wp-infocard'); ?> 
     341                        </td><td valign="bottom">&nbsp; 
     342                                <?php //pw_admin::advancedCertTest(IC_IMGURL); ?> 
     343                                <br/>&nbsp;<a href="help/help.php?topic=advancedcerttest"><?php _e('More Information', 'wp-infocard');?></a> 
     344                        </td></tr> 
     345 
     346                        </table> 
     347                        <input type="submit" name="infocard_admin_submit" id="infocard_admin_submit" value="<?php _e('Save', 'wp-infocard');?>" /> 
     348                        </p> 
     349                        </form> 
     350<?php            
     351        } // end function pwAdminScreen 
     352 
     353        function printInstallData() 
     354        { 
     355?> 
     356                <ol> 
     357                        <li> 
     358<?php            
     359                        $login_file = ABSPATH . "wp-login.php"; 
     360                        _e('Copy ' . $login_file . ' to '. $login_file . '.orig'); 
     361?> 
     362                        </li> 
     363                        <br/> 
     364                        <li> 
     365<?php 
     366                        _e('Insert the following code as described in in the next step:' ); 
     367?> 
     368                                <code><br/>&nbsp; 
     369                                        wp_redirect( get_settings('siteurl')."/wp-content/plugins/wp-infocard/login/infocard-login.php"); 
     370                                </code> 
     371                        </li> 
     372                        <br/> 
     373                        <li> 
     374<?php 
     375                        _e('Wordpress 2.0.7:  Edit '. $login_file .' and insert the following code between lines 209 and 210 of the file, should be just after the two lines below:' ); 
     376?> 
     377                           <code> 
     378                                <br/>&nbsp;?&lt;<br/> 
     379                                &lt;!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><br/> 
     380                           </code> 
     381                        </li> 
     382                        <br/> 
     383                        <li> 
     384<?php 
     385                        _e('Wordpress 2.1.x: Insert the same line at line 381, just before this line:' ); 
     386?> 
     387                           <code><br/> 
     388                                &nbsp;login_header(__(\'Login\')); 
     389                           </code> 
     390                        </li> 
     391                </ol> 
     392<?php 
     393        } // end function printInstallData 
     394 
     395        function pw_sidebar_cardlogin( $link ) 
     396        { 
     397                 if( strstr('redirect_to', $link )) return $link; 
     398                return str_replace( 'action=logout', 'action=logout' . ini_get('arg_separator.output') . 'redirect_to=' . urlencode($_SERVER["REQUEST_URI"]), $link ); 
     399        } 
     400 
    231401} // end class pw_admin 
    232402?> 
  • trunk/wp-infocard/wp/audit.pw.php

    r31 r33  
    33 
    44include_once( dirname(__FILE__) . '/../pw-config.php' ); 
    5 //include_once( dirname(__FILE__) . '/../pw/audit.pwlib.php'); 
     5//include_once( dirname(__FILE__) . '/../pwlib/audit.pwlib.php'); 
    66 
    77 
  • trunk/wp-infocard/wp/data.pw.php

    r31 r33  
    7171                                print "<p>Problems with this file:  $message_file</p>";  
    7272                        } else { 
    73                                 InfocardGeneral::errorPageRedirect('BADUSERMESSAGE', $message_file); 
     73                                pw_utils::errorPageRedirect('BADUSERMESSAGE', $message_file); 
    7474