Project

General

Profile

« Previous | Next » 

Revision 447

Added by Matthias about 17 years ago

Fixed ticket #392; root_parent not being set correctly (Thanks to eggsurplus)

View differences:

settings2.php
202 202
}
203 203

  
204 204
// Function to fix page trail of subs
205
function fix_page_trail($parent) {
205
function fix_page_trail($parent,$root_parent) {
206 206
	// Get objects and vars from outside this function
207 207
	global $admin, $template, $database, $TEXT, $MESSAGE;
208 208
	// Get page list from database
......
213 213
	if($get_pages->numRows() > 0)	{
214 214
		while($page = $get_pages->fetchRow()) {
215 215
			// Fix page trail
216
			$database->query("UPDATE ".TABLE_PREFIX."pages SET page_trail = '".get_page_trail($page['page_id'])."' WHERE page_id = '".$page['page_id']."'");
216
			$database->query("UPDATE ".TABLE_PREFIX."pages SET ".($root_parent != 0 ?"root_parent = '$root_parent', ":"")." page_trail = '".get_page_trail($page['page_id'])."' WHERE page_id = '".$page['page_id']."'");
217 217
			// Run this query on subs
218
			fix_page_trail($page['page_id']);
218
			fix_page_trail($page['page_id'],$root_parent);
219 219
		}
220 220
	}
221 221
}
222 222
// Fix sub-pages page trail
223
fix_page_trail($page_id);
223
fix_page_trail($page_id,$root_parent);
224 224

  
225 225
/* END page "access file" code */
226 226

  

Also available in: Unified diff