Project

General

Profile

« Previous | Next » 

Revision 545

Added by thorn almost 17 years ago

fixed two issues with menu_link: adding a menu_link as first page did not worked; and an E_NOTICE-warning

View differences:

trunk/wb/modules/menu_link/uninstall.php
1 1
<?php
2 2

  
3
// $Id$
3
// $Id: install.php 519 2007-12-23 14:37:02Z Ruebenwurzel $
4 4

  
5 5
/*
6 6

  
trunk/wb/modules/menu_link/info.php
25 25

  
26 26
/* History:
27 27

  
28
2.6.1.0 - 16. Jan. 2008 - thorn
28
2.6.1.1 - 16. Jan. 2008 - thorn
29 29
- added table mod_menu_link
30 30
- added install.php, delete.php, add.php
31 31
- changed wb/index.php: redirect if page is menu_link
......
36 36
$module_directory = 'menu_link';
37 37
$module_name = 'Menu Link';
38 38
$module_function = 'page';
39
$module_version = '2.6.1.0';
39
$module_version = '2.6.1.1';
40 40
$module_platform = '2.6.x';
41 41
$module_author = 'Ryan Djurovich, thorn';
42 42
$module_license = 'GNU General Public License';
trunk/wb/modules/menu_link/save.php
23 23

  
24 24
*/
25 25

  
26
require('../../config.php');
26
require_once('../../config.php');
27 27

  
28 28
// Include WB admin wrapper script
29 29
$update_when_modified = true; // Tells script to update when this page was last updated
30 30
require(WB_PATH.'/modules/admin.php');
31 31

  
32
// Update the mod_menu_links table with the link
33
if(isset($_POST['link']) && isset($_POST['target'])) {
34
	// Update id and target
32
// Update id and target
33
if(!isset($_POST['link']))
34
	$foreign_page_id = 0;
35
else
35 36
	$foreign_page_id = $_POST['link']; // foreign-page_id
36
	$url_target = $_POST['target'];
37
	$table_pages = TABLE_PREFIX.'pages';
38
	$table_mod = TABLE_PREFIX.'mod_menu_link';
39
	$database->query("UPDATE $table_pages SET target = '$url_target' WHERE page_id = '$page_id'");
40
	$database->query("UPDATE $table_mod SET target_page_id = '$foreign_page_id' WHERE page_id = '$page_id'");
41
} else {
42
	$admin->print_error('Error in wb/modules/menu_link/save.php at line 35', true);
43
}
44 37

  
38
$url_target = $_POST['target'];
39
$table_pages = TABLE_PREFIX.'pages';
40
$table_mod = TABLE_PREFIX.'mod_menu_link';
41
$database->query("UPDATE $table_pages SET target = '$url_target' WHERE page_id = '$page_id'");
42
$database->query("UPDATE $table_mod SET target_page_id = '$foreign_page_id' WHERE page_id = '$page_id'");
43

  
45 44
// Check if there is a database error, otherwise say successful
46 45
if($database->is_error()) {
47 46
	$admin->print_error($database->get_error(), $js_back);
......
52 51
// Print admin footer
53 52
$admin->print_footer();
54 53

  
55
?>
54
?>
trunk/wb/modules/menu_link/install.php
23 23

  
24 24
*/
25 25

  
26
// prevent this file from being accesses directly
26
// prevent this file from being accessed directly
27 27
if(defined('WB_PATH') == false) {
28 28
	exit("Cannot access this file directly"); 
29 29
}
trunk/wb/modules/menu_link/modify.php
23 23

  
24 24
*/
25 25

  
26
// Must include code to stop this file being access directly
26
// Must include code to stop this file being accessed directly
27 27
if(defined('WB_PATH') == false) { exit("Cannot access this file directly"); }
28 28

  
29 29
// get target page_id
......
44 44
			if($query_subpage->numRows() > 0) {
45 45
				while($sub = $query_subpage->fetchRow()) {
46 46
					if($admin->page_is_visible($sub)) {
47
						$links[$sub['page_id']]=$links[$sub['parent']].'/'.$sub['menu_title'];
47
						$parent_link = (array_key_exists($sub['parent'],$links))?$links[$sub['parent']]:"";
48
						$links[$sub['page_id']]=$parent_link.'/'.$sub['menu_title'];
48 49
					}
49 50
				}
50 51
			}

Also available in: Unified diff