[wp-cvs] wordpress/wp-includes functions.php,1.213,1.214

Ryan Boren rboren at users.sourceforge.net
Wed Nov 24 00:12:50 UTC 2004


Update of /cvsroot/cafelog/wordpress/wp-includes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7791/wp-includes

Modified Files:
	functions.php 
Log Message:
Do not allow a page to be its own parent.

Index: functions.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/functions.php,v
retrieving revision 1.213
retrieving revision 1.214
diff -C2 -d -r1.213 -r1.214
*** functions.php	21 Nov 2004 06:03:19 -0000	1.213
--- functions.php	24 Nov 2004 00:12:46 -0000	1.214
***************
*** 1333,1340 ****
  function get_page_uri($page) {
  	global $wpdb;
! 	$page = $wpdb->get_row("SELECT post_name, post_parent FROM $wpdb->posts WHERE ID = '$page'");
  
  	$uri = urldecode($page->post_name);
  
  	while ($page->post_parent != 0) {
  		$page = $wpdb->get_row("SELECT post_name, post_parent FROM $wpdb->posts WHERE ID = '$page->post_parent'");
--- 1333,1345 ----
  function get_page_uri($page) {
  	global $wpdb;
! 	$page = $wpdb->get_row("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE ID = '$page'");
  
  	$uri = urldecode($page->post_name);
  
+ 	// A page cannot be it's own parent.
+ 	if ($page->post_parent == $page->ID) {
+ 		return $uri;
+ 	}
+ 
  	while ($page->post_parent != 0) {
  		$page = $wpdb->get_row("SELECT post_name, post_parent FROM $wpdb->posts WHERE ID = '$page->post_parent'");




More information about the cvs mailing list