Changeset 102

Show
Ignore:
Timestamp:
08/21/07 13:15:19 (1 year ago)
Author:
tdoman
Message:

Changes to extend abstract classes.

Files:

Legend:

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

    r101 r102  
    2323{ 
    2424 
    25         // Function: pw_infocard 
    26         // Description: Constructor -- Set things up. 
    27         // Input: none 
    28         // Output: none 
    29         // Side effect: initializes some parameters 
    30         function pw_infocard()  
    31         { 
    32                 global $table_prefix; 
    33  
    34                 // We use a bunch of tables to store data 
    35                 $this->table_audit = $table_prefix . "infocard_audit"; 
    36                 $this->table_identity = $table_prefix . "infocard_identities"; 
    37  
    38                 // We also use some tables from Wordpress default set 
    39                 $this->table_options = $table_prefix . "options"; 
    40                 $this->table_users = $table_prefix . "users"; 
    41                 $this->table_usermeta = $table_prefix . "usermeta"; 
     25       // Function: pw_infocard 
     26       // Description: Constructor -- Set things up. 
     27       // Input: none 
     28       // Output: none 
     29       // Side effect: initializes some parameters 
     30       function pw_infocard()  
     31        { 
     32               global $table_prefix; 
     33 
     34               // We use a bunch of tables to store data 
     35               $this->table_audit = $table_prefix . "infocard_audit"; 
     36               $this->table_identity = $table_prefix . "infocard_identities"; 
     37 
     38               // We also use some tables from Wordpress default set 
     39               $this->table_options = $table_prefix . "options"; 
     40               $this->table_users = $table_prefix . "users"; 
     41               $this->table_usermeta = $table_prefix . "usermeta"; 
    4242 
    4343                // Options Table 
    4444                //      For WP we will use the builtin options table. 
    4545 
    46                 //$this->table_options = $table_prefix . "infocard_options"; 
    47                 $this->table_options = $table_prefix . "options"; 
    48         } // end pw_infocard 
    49  
    50         // Function: createAuditTable 
    51         // Description: Create audit table 
    52         // Input: none 
    53         // Output: boolean to detect if table was created 
    54         // Side effect: executes SQL code to create DB tables needed by the plugin 
    55         function _createAuditTable() { 
    56             global $wpdb; 
    57  
    58                 $myTableAuditQuery = 
    59                         "CREATE TABLE `$this->table_audit` ( 
    60                                 `modulusHash` varchar(128) NOT NULL default '', 
    61                                 `ppid` varchar(128) NOT NULL default '', 
    62                                 `accountid` bigint(20) unsigned, 
    63                                 `email` varchar(128) NOT NULL default '', 
    64                                 `time` datetime NOT NULL default '0000-00-00 00:00:00', 
    65                                 `IP` varchar(16) NOT NULL default '', 
    66                                 `status` varchar(128) NOT NULL default '' 
    67                         ) ENGINE = MYISAM"; 
    68  
    69                 // Check if table is already there 
    70             foreach ($wpdb->get_col("SHOW TABLES", 0) as $table ) { 
    71                 if ($table == $this->table_audit) { 
    72                                 return false; 
    73                         } 
    74                 } 
    75  
    76                 // Ok, let's proceed 
    77                 if ( $wpdb->query( $myTableAuditQuery ) === false ) { 
    78                         return false; 
    79                 } 
    80  
    81                 // Just to be sure, we check that tables were actually created 
    82                 foreach ( $wpdb->get_col("SHOW TABLES", 0) as $table ) { 
    83                         if ( $table == $this->table_audit ) { 
    84                                 return true; 
    85                         } 
    86                 } 
    87                 return false; 
    88         } 
    89         // end createAuditTable 
    90  
    91         // Function: createIdentityTable 
    92         // Description: Create identity table 
    93         // Input: none 
    94         // Output: boolean to detect if table was created 
    95         // Side effect: executes SQL code to create DB tables needed by the plugin 
    96         function _createIdentityTable() { 
    97             global $wpdb; 
     46                //$this->table_options = $table_prefix . "infocard_options"; 
     47                $this->table_options = $table_prefix . "options"; 
     48        } // end pw_infocard 
     49 
     50        // Function: createAuditTable 
     51        // Description: Create audit table 
     52        // Input: none 
     53        // Output: boolean to detect if table was created 
     54        // Side effect: executes SQL code to create DB tables needed by the plugin 
     55        function _createAuditTable() 
     56        { 
     57                global $wpdb; 
     58 
     59                $myTableAuditQuery = 
     60                                "CREATE TABLE `$this->table_audit` ( 
     61                                                `modulusHash` varchar(128) NOT NULL default '', 
     62                                                `ppid` varchar(128) NOT NULL default '', 
     63                                                `accountid` bigint(20) unsigned, 
     64                                                `email` varchar(128) NOT NULL default '', 
     65                                                `time` datetime NOT NULL default '0000-00-00 00:00:00', 
     66                                                `IP` varchar(16) NOT NULL default '', 
     67                                                `status` varchar(128) NOT NULL default '' 
     68                                                ) ENGINE = MYISAM"; 
     69 
     70                // Check if table is already there 
     71                foreach ($wpdb->get_col("SHOW TABLES", 0) as $table ) 
     72                { 
     73                        if ($table == $this->table_audit) 
     74                        { 
     75                                return false; 
     76                        } 
     77                } 
     78 
     79                // Ok, let's proceed 
     80                if ( $wpdb->query( $myTableAuditQuery ) === false ) 
     81                { 
     82                        return false; 
     83                } 
     84 
     85                // Just to be sure, we check that tables were actually created 
     86                foreach ( $wpdb->get_col("SHOW TABLES", 0) as $table ) 
     87                { 
     88                        if ( $table == $this->table_audit ) 
     89                        { 
     90                                return true; 
     91                        } 
     92                } 
     93                return false; 
     94        } 
     95        // end createAuditTable 
     96 
     97        // Function: createIdentityTable 
     98        // Description: Create identity table 
     99        // Input: none 
     100        // Output: boolean to detect if table was created 
     101        // Side effect: executes SQL code to create DB tables needed by the plugin 
     102        function _createIdentityTable() 
     103        { 
     104                global $wpdb; 
    98105 
    99106                /* -- old format 
    100                 $myTableIdentityQuery = 
    101                         "CREATE TABLE `$this->table_identity` ( 
    102                                 `modulusHash` varchar(128) NOT NULL default '', 
    103                                 `ppid` varchar(128) NOT NULL default '', 
    104                                 `accountid` bigint(20) unsigned 
    105                         ) ENGINE = MYISAM"; 
     107               $myTableIdentityQuery = 
     108                       "CREATE TABLE `$this->table_identity` ( 
     109                                               `modulusHash` varchar(128) NOT NULL default '', 
     110                                               `ppid` varchar(128) NOT NULL default '', 
     111                                               `accountid` bigint(20) unsigned 
     112                                               ) ENGINE = MYISAM"; 
    106113                */ 
    107                 $myTableIdentityQuery = 
    108                         "CREATE TABLE `$this->table_identity` ( 
    109                                 `cardhash` text default '', 
    110                                 `accountid` bigint(20) unsigned, 
    111                                 `cardhandle` varchar(128) NOT NULL default '', 
    112                                 `startdate` varchar(128) NOT NULL default '', 
    113                                 `lastused` varchar(128) NOT NULL default '' 
    114                         ) ENGINE = MYISAM"; 
    115  
    116                 // Check if table is already there 
    117             foreach ($wpdb->get_col("SHOW TABLES", 0) as $table ) { 
    118                 if ($table == $this->table_identity) { 
    119                                 return false; 
    120                         } 
    121                 } 
    122  
    123                 // Ok, let's proceed 
    124                 if ( $wpdb->query( $myTableIdentityQuery ) === false ) { 
    125                         return false; 
    126                 } 
    127  
    128                 // Just to be sure, we check that tables were actually created 
    129                 foreach ( $wpdb->get_col("SHOW TABLES", 0) as $table ) { 
    130                         if ( $table == $this->table_identity ) { 
    131                                 return true; 
    132                         } 
    133                 } 
    134                 return false; 
    135         } 
    136         // end createIdentityTable 
    137  
    138         // Function: createOptionTable 
    139         // Description: Create option table (in the case of wp not needed) 
    140         // Input: none 
    141         // Output: boolean to detect if table was created 
    142         // Side effect: executes SQL code to create DB tables needed by the plugin 
    143         function _createOptionTable() { 
    144                 global $wpdb; 
     114                $myTableIdentityQuery = 
     115                        "CREATE TABLE `$this->table_identity` ( 
     116                                                `cardhash` text default '', 
     117                                                `accountid` bigint(20) unsigned, 
     118                                                `cardhandle` varchar(128) NOT NULL default '', 
     119                                                `startdate` varchar(128) NOT NULL default '', 
     120                                                `lastused` varchar(128) NOT NULL default '' 
     121                                                ) ENGINE = MYISAM"; 
     122 
     123                // Check if table is already there 
     124                foreach ($wpdb->get_col("SHOW TABLES", 0) as $table ) 
     125                { 
     126                        if ($table == $this->table_identity) 
     127                        { 
     128                                return false; 
     129                        } 
     130                } 
     131 
     132                // Ok, let's proceed 
     133                if ( $wpdb->query( $myTableIdentityQuery ) === false ) 
     134                { 
     135                        return false; 
     136                } 
     137 
     138                // Just to be sure, we check that tables were actually created 
     139                foreach ( $wpdb->get_col("SHOW TABLES", 0) as $table ) 
     140                { 
     141                        if ( $table == $this->table_identity ) 
     142                        { 
     143                                return true; 
     144                        } 
     145                } 
     146                return false; 
     147        } 
     148        // end createIdentityTable 
     149 
     150        // Function: createOptionTable 
     151        // Description: Create option table (in the case of wp not needed) 
     152        // Input: none 
     153        // Output: boolean to detect if table was created 
     154        // Side effect: executes SQL code to create DB tables needed by the plugin 
     155        function _createOptionTable() 
     156        { 
     157                global $wpdb; 
    145158 
    146159                // Might decide later to have all plugins use a standard options 
    147160                // table - but for right now, why re-invent the wheel. 
    148161 
    149                 // check to see if the wp_options table exists 
    150                 foreach ( $wpdb->get_col("SHOW TABLES", 0) as $table ) { 
    151                         if ( $table == $this->table_identity ) { 
    152                                 return true; 
    153                         } 
    154                 } 
    155                 return false; 
    156         } 
    157         // end createOptionTable 
    158  
    159         // Function: setup 
    160         // Description: Creates Tables, sets up options. 
    161         // Input: none 
    162         // Output: none 
    163         // Side effect: creates tables 
    164         function setup() { 
    165                 global $wpdb; 
    166  
    167                 $isAuditTableCreated = $this->_createAuditTable(); 
    168                 $isIdentityTableCreated = $this->_createIdentityTable(); 
    169                 $isOptionTableCreated = $this->_createOptionTable(); 
    170  
     162                // check to see if the wp_options table exists 
     163                foreach ( $wpdb->get_col("SHOW TABLES", 0) as $table ) 
     164                { 
     165                        if ( $table == $this->table_identity ) 
     166                        { 
     167                                return true; 
     168                        } 
     169                } 
     170                return false; 
     171        } 
     172        // end createOptionTable 
     173 
     174        // Function: setup 
     175        // Description: Creates Tables, sets up options. 
     176        // Input: none 
     177        // Output: none 
     178        // Side effect: creates tables 
     179        function setup() 
     180        { 
     181                global $wpdb; 
     182 
     183                $isAuditTableCreated = $this->_createAuditTable(); 
     184                $isIdentityTableCreated = $this->_createIdentityTable(); 
     185                $isOptionTableCreated = $this->_createOptionTable(); 
    171186 
    172187                $salt = pw_admin::createClickbackSalt(); 
     
    186201                $this->createOption('pw_trusted_idp_list', ''); 
    187202 
    188         } // end function setup 
    189  
    190         // Function: createOption 
    191         // Description: if the option exists & is non-empty, it is kept  
    192         //      the same otherwise it is updated to $option_value 
    193         // Input: option name, option value  
    194         // Output:none  
    195         // Side effect: updates attributes in wp_options 
     203       } // end function setup 
     204 
     205       // Function:    createOption 
     206       // Description: if the option exists & is non-empty, it is kept  
     207        //                             the same otherwise it is updated to $option_value 
     208       // Input:               option name, option value  
     209       // Output:              none  
     210       // Side effect: updates attributes in wp_options 
    196211        function createOption($option_name, $option_value ) 
    197212        { 
    198  
    199213                $options = get_option($option_name); 
    200  
    201                 if ( !$options ) 
    202                         $options = $option_value; 
    203  
    204                 update_option($option_name, $options); 
    205  
     214                if ( !$options ) 
     215                        $options = $option_value; 
     216 
     217                update_option($option_name, $options); 
    206218        } // end function createOptionValue 
    207219 
     
    250262//                      display_cryptographp(); 
    251263?> 
    252               <hr /> 
     264      <hr /> 
    253265                <a href="<?php echo PW_SECUREPLUGINURL . '/' . PW_PLUGIN; ?>/login/infocard-login.php" alt="<?php pw_utils::screenPrint('Infocard Login'); ?>" style="border-bottom: none; color: #FFF"> 
    254266                        <?php pw_utils::screenPrint('Login or Register using an Information Card'); ?> 
     
    258270                &nbsp; <a alt="<?php echo __('What is this?'); ?>" style="border-bottom: none; color: #fff"  href="http://pamelaproject.com/"> 
    259271                        <?php echo __('(what is this?)'); ?> 
    260                 </a>  
    261 <?php 
    262         } //end function pw_loginform_link 
     272                </a> 
     273<?php 
     274       } //end function pw_loginform_link 
    263275 
    264276        function pw_printUserCardStatus() 
     
    294306class pw_admin extends pwlib_admin 
    295307{ 
    296         // Function: getOption 
    297         // Description: Retrieves things set in wp_options 
    298         // Input: attribute name 
    299         // Output: attribute value 
    300         // Side effect: none 
     308       // Function: getOption 
     309       // Description: Retrieves things set in wp_options 
     310       // Input: attribute name 
     311       // Output: attribute value 
     312       // Side effect: none 
    301313        function getOption($attr_name) 
    302314        { 
    303                 return get_settings($attr_name);         
    304                  
     315                return get_settings($attr_name); 
    305316        } //end function getOption 
    306317 
    307         // Function: createNewAccount 
    308         // Description: creates a new db record 
    309         // Input: account details 
    310         // Output: returns the user Id on success, FALSE on failure 
    311         // Side effect: none 
     318       // Function: createNewAccount 
     319       // Description: creates a new db record 
     320       // Input: account details 
     321       // Output: returns the user Id on success, FALSE on failure 
     322       // Side effect: none 
    312323        function createNewAccount( $user_login, $user_pass, $user_email, $user_url, $user_firstname, $user_lastname )  
    313324        { 
    314325                require_once( ABSPATH . WPINC . '/registration-functions.php'); 
    315326 
    316                 InfocardUtils::printDebug("<br/>Action: createNewAccount<br>"); 
    317                 $user_nicename = "$user_firstname $user_lastname"; 
    318                 InfocardUtils::printDebug("<br/>Nice Name: $user_nicename<br>"); 
    319                 $display_name = $user_nicename; 
    320                 $userdata = compact('user_login', 'user_pass', 'user_email', 'user_nicename', 'user_url', 'display_name', 'user_firstname', 'user_lastname'); 
    321                 $user_ID = wp_insert_user($userdata); 
    322  
    323                 if ($user_ID)  
    324                 { 
    325                         InfocardUtils::printDebug("&nbsp;Inserted record # $user_ID<br>"); 
    326                         return $user_ID; 
    327                 } else { 
    328                         InfocardUtils::printDebug("&nbsp;Error - new user not created<br/>"); 
    329                         return FALSE; 
    330                 } 
    331  
    332         } // end function createNewAccount 
     327                InfocardUtils::printDebug("<br/>Action: createNewAccount<br>"); 
     328                $user_nicename = "$user_firstname $user_lastname"; 
     329                InfocardUtils::printDebug("<br/>Nice Name: $user_nicename<br>"); 
     330                $display_name = $user_nicename; 
     331                $userdata = compact('user_login', 'user_pass', 'user_email', 'user_nicename', 'user_url', 'display_name', 'user_firstname', 'user_lastname'); 
     332                $user_ID = wp_insert_user($userdata); 
     333 
     334                if ($user_ID)  
     335                { 
     336                        InfocardUtils::printDebug("&nbsp;Inserted record # $user_ID<br>"); 
     337                        return $user_ID; 
     338                } 
     339                else 
     340                { 
     341                        InfocardUtils::printDebug("&nbsp;Error - new user not created<br/>"); 
     342                        return FALSE; 
     343                } 
     344        } // end function createNewAccount 
    333345 
    334346        function pwAdminScreen() 
     
    338350                // write submitted changes if this page reload shows a submit 
    339351 
    340                 pw_admin::printSystemCheck($opts['pw_securesiteurl']); 
     352                pw_admin::printSystemCheck($opts['pw_securesiteurl']); 
    341353?> 
    342354                <form  action="" method="post"> 
     
    455467        function pw_sidebar_cardlogin( $link ) 
    456468        { 
    457                  if( strstr('redirect_to', $link )) return $link; 
    458                 return str_replace( 'action=logout', 'action=logout' . ini_get('arg_separator.output') . 'redirect_to=' . urlencode($_SERVER["REQUEST_URI"]), $link ); 
    459         } 
     469                if (strstr('redirect_to', $link )) 
     470                        return $link; 
     471                return str_replace( 'action=logout', 'action=logout' . ini_get('arg_separator.output') . 'redirect_to=' . urlencode($_SERVER["REQUEST_URI"]), $link ); 
     472        } 
    460473 
    461474        function setupCaptcha() 
     
    465478        } 
    466479 
    467         /* 
    468                 Function:       setOption 
    469                 Description:    updates an option in the infocard_options table 
    470                 Input:          option_name:  the name of the option 
    471                                 option_val:  the new value 
    472                 Output:         the value set 
    473                 Side Effects:   writes to the database 
    474         */ 
    475         function setOption( $option_name, $option_val ) 
    476         { 
    477                 update_option($option_name, $option_val); 
    478                 return $option_val; 
    479         } 
     480        // Function:    setOption 
     481        // Description: updates an option in the infocard_options table 
     482        // Input:               option_name:  the name of the option 
     483        //                              option_val:  the new value 
     484        // Output:              the value set 
     485        // Side Effects: writes to the database 
     486        function setOption( $option_name, $option_val ) 
     487        { 
     488                update_option($option_name, $option_val); 
     489                return $option_val; 
     490        } 
    480491} // end class pw_admin 
    481492?> 
  • trunk/wp-infocard/wp/audit.pw.php

    r100 r102  
    44include_once( dirname(__FILE__) . '/../pw-config.php' ); 
    55include_once( 'utils.pw.php' ); 
    6 //include_once( dirname(__FILE__) . '/../pwlib/audit.pwlib.php'); 
     6include_once( dirname(__FILE__) . '/../pwlib/audit.pwlib.php'); 
    77 
    8  
    9 //class pw_audit extends pwlib_audit { 
    10 class pw_audit  
     8class pw_audit extends pwlib_audit 
    119{ 
    12  
    13         // Function: writeToAudit 
    14         // Description:  writeToAudit puts information into the pw_infocard_audit table. 
    15         // Input:  IP address, Certificate Modulus, Email from token, Account ID if  
    16         //              available, any Error message 
    17         // Output: none 
     10        // Function:    writeToAudit 
     11        // Description: writeToAudit puts information into the pw_infocard_audit table. 
     12        // Input:               IP address, Certificate Modulus, Email from token, Account ID if  
     13        //                              available, any Error message 
     14        // Output:              none 
    1815        // Side Effects:  alters DB table 
    19         function writeToAudit( $ip, $modulus, $ppid, $email, $error, $acct)  
     16        function writeToAudit($ip, $modulus='NA', $ppid='NA', $email='NA', $error, $acct='NA') 
    2017        { 
    2118                global $wpdb; 
    22                  
     19 
    2320                $today = date('Y-m-d H-i-s'); 
    2421                $query = "INSERT INTO `" . PW_TABLE_PREFIX . "infocard_audit` " 
     
    2724 
    2825                $update_result = $wpdb->query( $query ); 
    29                 if ( $update_result == FALSE ) 
     26               if ( $update_result == FALSE ) 
    3027                { 
    31                         pw_utils::printDebug("Error ".mysql_errno($update_result)."with mysql_query update (".mysql_error($update_result).")<br/>"); 
    32                 } 
    33  
    34         } // end function writeToAudit 
    35          
     28                        pw_utils::printDebug("Error ".mysql_errno($update_result)."with mysql_query update (".mysql_error($update_result).")<br/>"); 
     29                } 
     30        } // end function writeToAudit 
    3631} // end class pw_audit 
    3732?> 
  • trunk/wp-infocard/wp/clickback.pw.php

    r98 r102  
    44include_once(dirname(__FILE__) . "/../" . PW_PLUGIN . "/userdata.pw.php"); 
    55include_once(dirname(__FILE__) . "/../" . PW_PLUGIN . "/utils.pw.php"); 
     6include_once(dirname(__FILE__) . "/../" . PW_PLUGIN . "/clickback.pwlib.php"); 
    67 
    7 class pw_clickback { 
     8class pw_clickback extends pwlib_clickback 
     9
    810        // this class details all of the functionality needed to support clickbacks. 
    911        // PW_CLICKBACK_LENGTH is set in pw-config.php 
    1012        function printHiddenClickback($clickback = "") 
    11        
     13       
    1214                if ($clickback) 
    1315                { 
    1416                        $debug = "Clickback detected: $clickback"; 
    1517                        print "\n\t<input type=\"hidden\" name=\"clickback\" " 
    16                         . "value=\"$clickback\t\" />"; 
     18                               . "value=\"$clickback\t\" />"; 
    1719                } 
    1820                else 
     
    2325        } // end function printClickback 
    2426 
    25         function createChallenge( $data ) { 
     27        function createChallenge( $data ) 
     28        { 
    2629                //$clickback_salt = get_settings('clickback_salt'); 
    2730                $clickback_salt = pw_admin::getOption('pw_clickback_salt'); 
     
    3235                } 
    3336 
    34                pw_utils::printDebug("Clickback: Challenge Created. <br/>" 
     37        pw_utils::printDebug("Clickback: Challenge Created. <br/>" 
    3538                        . "Clickback: salted data is " . (($data)?$data:"empty") . "<br/>" 
    3639                        . "Clickback: length is " . PW_CLICKBACK_LENGTH  
    3740                        . "<br/>Clickback: salt is $clickback_salt <br/>"); 
    3841 
    39               $data = MD5($clickback_salt . $data); 
     42              $data = MD5($clickback_salt . $data); 
    4043 
    41               $chopped = substr($data, 0, PW_CLICKBACK_LENGTH); 
     44              $chopped = substr($data, 0, PW_CLICKBACK_LENGTH); 
    4245 
    43               pw_utils::printDebug("Clickback: Hash of the salted challenge data: $data<br/>" 
     46              pw_utils::printDebug("Clickback: Hash of the salted challenge data: $data<br/>" 
    4447                        . "Clickback: Chopped challenge data: $chopped <br/>"); 
    4548 
    46                 return ($chopped); 
    47  
     49                return ($chopped); 
    4850        } // end of function createChallenge 
    4951 
    50         function verifyChallenge( $currentChallenge, $previousChallenge ) { 
     52        function verifyChallenge( $currentChallenge, $previousChallenge ) 
     53        { 
    5154 
    52               pw_utils::printDebug("<br/>Action: verifyClickbackChallenge. <br/>" 
     55              pw_utils::printDebug("<br/>Action: verifyClickbackChallenge. <br/>" 
    5356                        . "Binary Clickback Details:<br/>"); 
    5457 
     
    5760                // printBinary only prints if PW_DEBUG_ON is on. Otherwise it just falls through. 
    5861                pw_utils::printBinary("computed challenge: ", $currentChallenge); 
    59               pw_utils::printBinary("previous challenge:", $previousChallenge); 
     62              pw_utils::printBinary("previous challenge:", $previousChallenge); 
    6063 
    61                 if ($currentChallenge == $previousChallenge) { 
     64                if ($currentChallenge == $previousChallenge) 
     65                { 
    6266                        pw_utils::printDebug("&nbsp;verifyClickback: challenges match<br/>"); 
    63                         return (TRUE); 
    64                 } else { 
     67                        return (TRUE); 
     68                } 
     69                else 
     70                { 
    6571                        pw_utils::printDebug("&nbsp;verifyClickback: challenges DO NOT match<br/>"); 
    6672                        return (FALSE); 
    6773                } 
    68  
    6974        } // end of function verifyChallenge     
    7075 
    71         /* 
    72                 Function:       validateClickback 
    73                 Description:    returns true if the supplied candidate matches 
    74                                 a newly generated clickback 
    75                 Input:          candidate - the clickback value to validate 
    76                                 user_email - email address from the token 
    77                                 user_ppid - privatepersonalidentifier from the token 
    78                 Output:         boolean 
    79                 Side Effects:   none 
    80         */ 
     76        // Function:    validateClickback 
     77        // Description: returns true if the supplied candidate matches 
     78                                        a newly generated clickback 
     79        // Input:               candidate - the clickback value to validate 
     80        //                              user_email - email address from the token 
     81        //                              user_ppid - privatepersonalidentifier from the token 
     82        // Output:              boolean 
     83        // Side Effects: none 
    8184        function validateClickback($candidate, $user_email, $user_ppid) 
    8285        { 
     
    8891 
    8992                return pw_clickback::verifyChallenge($clickbackUrl, $previousChallenge); 
    90  
    9193        } 
    9294 
    93         /* 
    94                 Function:  sendAccountValidation 
    95                 Description:  creates & emails a validation message to the user 
    96                 Input:   clickbackID:  pre-created clickback value 
    97                         user email:  destination email 
    98                 Output:  none 
    99                 Side Effects: sends an email 
    100         */ 
     95        // Function:    sendAccountValidation 
     96        // Description: creates & emails a validation message to the user 
     97        // Input:               clickbackID:  pre-created clickback value 
     98        //                              user email:  destination email 
     99        // Output:              none 
     100        // Side Effects: sends an email 
    101101        function sendAccountValidation( $clickbackID, $user_email )  
    102102        { 
    103103                global $mosConfig_live_site; 
    104                 $clickbackUrl = PW_SECUREPLUGINURL . "/" . PW_PLUGIN . "/login/infocard-clickback.php?clickbackID=" . $clickbackID; 
     104               $clickbackUrl = PW_SECUREPLUGINURL . "/" . PW_PLUGIN . "/login/infocard-clickback.php?clickbackID=" . $clickbackID; 
    105105 
    106                 $message  = sprintf('Please complete your registration at %s by opening the link below.', pw_utils::getTitle()) . "\r\n\r\n"; 
    107                 $message .= $clickbackUrl."\r\n\r\nThanks\r\n"; 
    108                         // sendEmail: to-address, subject, body 
    109                 pw_utils::sendEmail($user_email, 'New InfoCard Registration', $message); 
     106               $message  = sprintf('Please complete your registration at %s by opening the link below.', pw_utils::getTitle()) . "\r\n\r\n"; 
     107               $message .= $clickbackUrl."\r\n\r\nThanks\r\n"; 
     108               // sendEmail: to-address, subject, body 
     109               pw_utils::sendEmail($user_email, 'New InfoCard Registration', $message); 
    110110 
    111                 pw_utils::printDebug( "<br/><br/>Account Validation is required.<br/>" 
    112                         . "Emailing Registration info to: $user_email<br/>" 
    113                         . "User would be redirected to:  <a href=\"$clickbackUrl\">$clickbackUrl</a><br/>" 
    114                         . "Message would be:  <pre>$message</pre>" 
    115                 ); 
    116  
    117         } // end of function sendAccountValidation 
    118  
    119 } // end of class InfocardClickback 
     111                pw_utils::printDebug( "<br/><br/>Account Validation is required.<br/>" 
     112                                        . "Emailing Registration info to: $user_email<br/>" 
     113                                        . "User would be redirected to:  <a href=\"$clickbackUrl\">$clickbackUrl</a><br/>" 
     114                                        . "Message would be:  <pre>$message</pre>" 
     115                                        ); 
     116        } // end of function sendAccountValidation 
     117} // end of class pw_clickback 
  • trunk/wp-infocard/wp/customdata.pw.php

    r66 r102  
    33include_once( dirname(__FILE__) . '/../pw-config.php'); 
    44include_once( dirname(__FILE__) . '/../'.PW_PLUGIN.'/utils.pw.php'); 
     5include_once(dirname(__FILE__) . "/../" . PW_PLUGIN . "/clickback.pwlib.php"); 
    56 
    67/* 
     
    2021         
    2122*/ 
    22 class pw_customdata 
     23class pw_customdata extends pwlib_customdata 
    2324{ 
    2425        // Function:  describeCustomData 
     
    114115        function evaluateIncomingCustomData( $ID ) 
    115116        { 
    116             //    global $datamap; 
     117               // global $datamap; 
    117118 
    118119                // this checks for an existing database value, and updates 
     
    126127 
    127128                return; 
    128         } // end function evaluateIncomingCustomData 
     129       } // end function evaluateIncomingCustomData 
    129130 
    130131        function updateNewCustomData( $ID ) 
  • trunk/wp-infocard/wp/login/login.pw.php

    r78 r102  
    44include_once( dirname(__FILE__) . '/../../pw-config.php' ); 
    55include_once( dirname(__FILE__) . '/../../pwlib/login/login.pwlib.php'); 
    6          
    7          
     6 
    87class pw_login extends pwlib_login  
    98{ 
     
    1413        } //end function printRedirect   
    1514 
    16         function printTokenType(){ 
     15        function printTokenType() 
     16        { 
    1717                // one day this could be a user-chosen option 
    1818                print "urn:oasis:names:tc:SAML:1.0:assertion"; 
     
    4343                if ($clickback) 
    4444                { 
    45                                $path .= "?" . $clickback; 
     45                        $path .= "?" . $clickback; 
    4646                } 
    47                          
     47 
    4848                print $path; 
    4949        } 
  • trunk/wp-infocard/wp/processing.pw.php

    r100 r102  
    2626                pw_utils::printDebug("&nbsp;Login ID: ".$datamap['user_login']->new_value."<br />"); 
    2727                pw_utils::printDebug("&nbsp;Account ID: ".$datamap['ID']->new_value."<br />"); 
    28               pw_utils::printDebug("&nbsp;Status: ".$status." <br/>"); 
     28              pw_utils::printDebug("&nbsp;Status: ".$status." <br/>"); 
    2929 
    3030                pw_utils::printDebug("&nbsp;Errors: ");  
  • trunk/wp-infocard/wp/userdata.pw.php

    r100 r102  
    44include_once( dirname(__FILE__) . '/utils.pw.php'); 
    55include_once( ABSPATH . WPINC . '/registration-functions.php'); 
     6include_once(dirname(__FILE__) . "/../" . PW_PLUGIN . "/userdata.pwlib.php"); 
    67 
    78/* 
     
    1011 
    1112        Class pw_userdata - plugin-specific user manipulation code 
    12          
     13 
    1314*/ 
    14 class pw_userdata  
     15class pw_userdata extends pwlib_userdata 
    1516{ 
    16         /* 
    17                 Function:  evaluateIncomingRequest 
    18                 Description: decides what kind of user is connecting. 
    19                 Input: email, modulus, ppid from incoming request 
    20                 Output: An array of user information. With the 
    21                         following indices: 
    22                         array['status'] - contains 1 of these statuses: 
    23                         1. valid-user - supplied email address exists 
    24                         and belongs to same user as supplied modulus/ppid 
    25                         2. new-user - email address & modulus/ppid are new 
    26                         3. new-card - email address exists but modulus is new 
    27                         4. new-email - modulus/ppid exists but email is new 
    28                         5. an error code 
    29          
    30                         array['id'] - contains the user id number (or 0 if the status  
    31                         is anything other than valid-user 
    32                 Side-effects: none 
    33         */ 
     17        // Function:  evaluateIncomingRequest 
     18        // Description: decides what kind of user is connecting. 
     19        // Input: email, modulus, ppid from incoming request 
     20        // Output: An array of user information. With the 
     21        //                      following indices: 
     22        //                      array['status'] - contains 1 of these statuses: 
     23        //                      1. valid-user - supplied email address exists 
     24        //                      and belongs to same user as supplied modulus/ppid 
     25        //                      2. new-user - email address & modulus/ppid are new 
     26        //                      3. new-card - email address exists but modulus is new 
     27        //                      4. new-email - modulus/ppid exists but email is new 
     28        //                      5. an error code 
     29        // 
     30        //              array['id'] - contains the user id number (or 0 if the status  
     31        //              is anything other than valid-user) 
     32        // Side-effects: none 
    3433        function evaluateIncomingRequest() 
    3534        { 
    36                 global $wpdb, $claimslist, $datamap; 
    37                 $incominguser['id'] = 0; 
    38                 $incominguser['status'] = 'UNKNOWNERROR'; 
    39                 $identity_user_id = 0; 
     35               global $wpdb, $claimslist, $datamap; 
     36               $incominguser['id'] = 0; 
     37               $incominguser['status'] = 'UNKNOWNERROR'; 
     38               $identity_user_id = 0; 
    4039 
    4140                $cardhash = pw_processing::getCardHash(); 
    42                 pw_utils::printDebug( '<br/>Evaluating Incoming Request:<br/>'); 
    43  
    44                 if (!is_email($claimslist['emailaddress']->token_value)) { 
    45                         $incominguser['status'] = "INVALIDEMAIL"; 
    46                         return $incominguser; 
    47                 } 
     41                pw_utils::printDebug( '<br/>Evaluating Incoming Request:<br/>'); 
     42 
     43                if (!is_email($claimslist['emailaddress']->token_value)) 
     44                { 
     45                        $incominguser['status'] = "INVALIDEMAIL"; 
     46                        return $incominguser; 
     47                } 
    4848