Project

General

Profile

« Previous | Next » 

Revision 755

Added by thorn about 16 years ago

menulink: link can be menulink or subpage of menulink, too

View differences:

modify.php
44 44
$anchor = $sql_row['anchor'];
45 45
$sel = ' selected';
46 46

  
47
// Get list of all visible page-links, except menu_links and actual page
47
// Get list of all visible pages, except actual one
48 48
$links = array();
49 49
$table_p = TABLE_PREFIX."pages";
50
$table_s = TABLE_PREFIX."sections";
51
if($query_page = $database->query("SELECT DISTINCT p.* FROM $table_p AS p INNER JOIN $table_s AS s ON p.page_id=s.page_id WHERE s.module != 'menu_link' AND p.page_id != '$page_id' AND parent = '0' ORDER BY position")) {

52
	while($page = $query_page->fetchRow()) {

53
		if($admin->page_is_visible($page)) {
54
			$links[$page['page_id']]='/'.$page['menu_title'];

55
			if($query_subpage = $database->query("SELECT DISTINCT p.* FROM $table_p AS p INNER JOIN $table_s AS s ON p.page_id=s.page_id WHERE s.module != 'menu_link' AND p.page_id != '$page_id' AND root_parent = '{$page['page_id']}' ORDER BY level")) {
56
				while($sub = $query_subpage->fetchRow()) {
57
					if($admin->page_is_visible($sub)) {
58
						$parent_link = (array_key_exists($sub['parent'],$links))?$links[$sub['parent']]:"";
59
						$links[$sub['page_id']]=$parent_link.'/'.$sub['page_title'];
60
					}
50
if($query_page = $database->query("SELECT * FROM $table_p WHERE parent = '0' ORDER BY position")) {
51
	while($page = $query_page->fetchRow()) {
52
		$all_links[$page['page_id']]='/'.$page['menu_title'];
53
		if($admin->page_is_visible($page) && $page['page_id']!=$page_id) {
54
			$links[$page['page_id']]='/'.$page['menu_title'];
55
		}
56
		if($query_subpage = $database->query("SELECT * FROM $table_p WHERE page_id != '$page_id' AND root_parent = '{$page['page_id']}' ORDER BY level")) {
57
			while($sub = $query_subpage->fetchRow()) {
58
				if($admin->page_is_visible($sub)) {
59
					$parent_link = (array_key_exists($sub['parent'],$all_links))?$all_links[$sub['parent']]:"";
60
					$links[$sub['page_id']]=$parent_link.'/'.$sub['page_title'];
61 61
				}
62 62
			}
63 63
		}
......
69 69
$table_s = TABLE_PREFIX."sections";
70 70
foreach($links as $pid=>$l) {
71 71
	if($query_section = $database->query("SELECT section_id, module FROM $table_s WHERE page_id = '$pid' ORDER BY position")) {
72
		while($section = $query_section->fetchRow()) {
72
		while($section = $query_section->fetchRow()) {
73
			// get section-anchor
73 74
			$targets[$pid][] = "wb_section_{$section['section_id']}";
74 75
			if($section['module'] == 'wysiwyg') {
75 76
				if($query_page = $database->query("SELECT content FROM $table_mw WHERE section_id = '{$section['section_id']}' LIMIT 1")) {

Also available in: Unified diff