116 |
116 |
// Work-out what the link should be
|
117 |
117 |
if($parent == '0') {
|
118 |
118 |
$link = '/'.page_filename($menu_title);
|
119 |
|
$filename = WB_PATH.PAGES_DIRECTORY.'/'.page_filename($menu_title).'.php';
|
|
119 |
$filename = WB_PATH.PAGES_DIRECTORY.'/'.page_filename($menu_title).PAGE_EXTENSION;
|
120 |
120 |
} else {
|
121 |
121 |
$parent_section = '';
|
122 |
122 |
$parent_titles = array_reverse(get_parent_titles($parent));
|
... | ... | |
125 |
125 |
}
|
126 |
126 |
if($parent_section == '/') { $parent_section = ''; }
|
127 |
127 |
$link = '/'.$parent_section.page_filename($menu_title);
|
128 |
|
$filename = WB_PATH.PAGES_DIRECTORY.'/'.$parent_section.page_filename($menu_title).'.php';
|
|
128 |
$filename = WB_PATH.PAGES_DIRECTORY.'/'.$parent_section.page_filename($menu_title).PAGE_EXTENSION;
|
129 |
129 |
}
|
130 |
130 |
|
131 |
131 |
// Check if a page with same page filename exists
|
... | ... | |
144 |
144 |
$page_trail = get_page_trail($page_id);
|
145 |
145 |
|
146 |
146 |
// Make sure link is not overwritten if page uses the menu link module
|
147 |
|
if(strstr($old_link, '://') != '') {
|
|
147 |
$query_sections = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' AND module = 'menu_link'");
|
|
148 |
if($query_sections->numRows() > 0) {
|
148 |
149 |
$link = $old_link;
|
149 |
|
}
|
|
150 |
}
|
150 |
151 |
|
151 |
152 |
// Update page settings in the pages table
|
152 |
153 |
$query = "UPDATE ".TABLE_PREFIX."pages SET parent = '$parent', page_title = '$page_title', menu_title = '$menu_title', menu = '$menu', level = '$level', page_trail = '$page_trail', root_parent = '$root_parent', link = '$link', template = '$template', target = '$target', description = '$description', keywords = '$keywords', position = '$position', visibility = '$visibility', searching = '$searching', language = '$language', admin_groups = '$admin_groups', viewing_groups = '$viewing_groups' WHERE page_id = '$page_id'";
|
... | ... | |
166 |
167 |
// First check if we need to create a new file
|
167 |
168 |
if($old_link != $link) {
|
168 |
169 |
// Delete old file
|
169 |
|
unlink(WB_PATH.PAGES_DIRECTORY.$old_link.'.php');
|
|
170 |
unlink(WB_PATH.PAGES_DIRECTORY.$old_link.PAGE_EXTENSION);
|
170 |
171 |
// Create access file
|
171 |
172 |
create_access_file($filename,$page_id,$level);
|
172 |
173 |
// Move a directory for this page
|
... | ... | |
189 |
190 |
// Update level and link
|
190 |
191 |
$database->query("UPDATE ".TABLE_PREFIX."pages SET link = '$new_sub_link', level = '$new_sub_level' WHERE page_id = '".$sub['page_id']."' LIMIT 1");
|
191 |
192 |
// Re-write the access file for this page
|
192 |
|
$old_subpage_file = WB_PATH.PAGES_DIRECTORY.$new_sub_link.'.php';
|
|
193 |
$old_subpage_file = WB_PATH.PAGES_DIRECTORY.$new_sub_link.PAGE_EXTENSION;
|
193 |
194 |
if(file_exists($old_subpage_file)) {
|
194 |
195 |
unlink($old_subpage_file);
|
195 |
196 |
}
|
196 |
|
create_access_file(WB_PATH.PAGES_DIRECTORY.$new_sub_link.'.php', $sub['page_id'], $new_sub_level);
|
|
197 |
create_access_file(WB_PATH.PAGES_DIRECTORY.$new_sub_link.PAGE_EXTENSION, $sub['page_id'], $new_sub_level);
|
197 |
198 |
}
|
198 |
199 |
}
|
199 |
200 |
}
|
Fixed a bug in menulink; if you deleted a menulink page the linked page was also deleted in the pages directory (Special thanks to "Funky_MF" for the fix)