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:

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
?>

Also available in: Unified diff