Changeset 1055
- Timestamp:
- 08/12/07 18:47:01 (1 year ago)
- Files:
-
- trunk/src/lib/functions.php (modified) (1 diff)
- trunk/src/lyceum/wp-admin/post.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/lib/functions.php
r1023 r1055 344 344 } 345 345 346 function remove_token_arg($url){ 347 return preg_replace('/&?token=[^&]+/', '', $url); 348 } 349 350 function get_url_arg_pairs($url) { 351 $args = parse_url($url, PHP_URL_QUERY); 352 $arr = array(); 353 foreach (explode('&', $args) as $i) { 354 list($name,$value) = explode('=', $i, 2); 355 $arr[$name] = $value; 356 } 357 return $arr; 358 } 359 346 360 ?> trunk/src/lyceum/wp-admin/post.php
r1054 r1055 123 123 124 124 if ($_POST['save']) { 125 $location = 'post.php?token='.formtoken('post.php','edit',$post_ID)."&action=edit&post=$post_ID";//might not be ideal for all cases -jjb 126 // $location = wp_get_referer(); 125 $location = wp_get_referer(); 127 126 } elseif ($_POST['updatemeta']) { 128 $location = 'post.php?token='.formtoken('post.php','edit',$post_ID)."&action=edit&post=$post_ID&message=2#postcustom";//might not be ideal for all cases -jjb 129 // $location = wp_get_referer() . '&message=2#postcustom'; 127 $location = wp_get_referer() . '&message=2#postcustom'; 130 128 } elseif ($_POST['deletemeta']) { 131 $location = 'post.php?token='.formtoken('post.php','edit',$post_ID)."&action=edit&post=$post_ID&message=3#postcustom";//might not be ideal for all cases -jjb 132 // $location = wp_get_referer() . '&message=3#postcustom'; 133 } elseif ($_POST['submit']) { 134 $location = 'post.php?message=1'; 135 // } elseif (!empty($referredby) && $referredby != $referer) { 136 // $location = $_POST['referredby']; 137 // if ( $_POST['referredby'] == 'redo' ) 138 // $location = get_permalink( $post_ID ); 129 $location = wp_get_referer() . '&message=3#postcustom'; 130 } elseif (!empty($referredby) && $referredby != $referer) { 131 $location = $_POST['referredby']; 132 if ( $_POST['referredby'] == 'redo' ) 133 $location = get_permalink( $post_ID ); 139 134 } elseif ($action == 'editattachment') { 140 135 $location = 'attachments.php'; … … 142 137 $location = 'post.php'; 143 138 } 139 140 $location = remove_token_arg($location); 141 $matches=array(); 142 preg_match('/(.*)?\/([^\/]*\.php)/', parse_url($location, PHP_URL_PATH), $matches); 143 $file = $matches[2]; 144 $args = get_url_arg_pairs($location); 145 146 if ('post.php' == $file && 'edit' == $args['action']) 147 $location .= '&token=' . formtoken('post.php','edit',$post_ID); 144 148 145 149 wp_redirect($location); // Send user on their way while we keep working
