- Files:
-
- trunk/src/lib/functions.php (modified) (2 diffs)
- trunk/src/lyceum/wp-comments-post.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/lib/functions.php
r788 r789 130 130 } 131 131 132 function tokenIsValid ($token, $targetscript, $action='default', $id=0 ) {132 function tokenIsValid ($token, $targetscript, $action='default', $id=0, $keep=false) { 133 133 global $userdata; 134 134 //trace('$_SESSION', array_print($_SESSION)); … … 143 143 return false; 144 144 145 unset($_SESSION['formtokens'][$key][$token]);//not sure if this is really achieving what i want -jjb 145 if (!$keep) 146 unset($_SESSION['formtokens'][$key][$token]); 146 147 return true; 147 148 } 148 149 149 function validateToken( $token, $targetscript, $action='default', $id=0 ){150 if (!tokenIsValid( $token, $targetscript, $action, $id ))150 function validateToken( $token, $targetscript, $action='default', $id=0, $keep=false ){ 151 if (!tokenIsValid( $token, $targetscript, $action, $id, $keep )) 151 152 badTokenMessage(); 152 153 } trunk/src/lyceum/wp-comments-post.php
r624 r789 8 8 assert('hv($comment_post_ID)'); 9 9 10 validateToken($_POST['token'], basename(__FILE__), 'default', $comment_post_ID );10 validateToken($_POST['token'], basename(__FILE__), 'default', $comment_post_ID, true); 11 11 12 12 $status = $wpdb->get_row("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'"); … … 65 65 $location = ( empty( $_POST['redirect_to'] ) ) ? get_permalink( $comment_post_ID ) : $_POST['redirect_to']; 66 66 67 validateToken($_POST['token'], basename(__FILE__), 'default', $comment_post_ID); 67 68 wp_redirect( $location ); 68 69 ?>
