Project

General

Profile

« Previous | Next » 

Revision 1911

Added by Dietmar over 11 years ago

! modules/menu_link/save.php coding new sql logic to replace adding an empty table row in add.php

View differences:

branches/2.8.x/CHANGELOG
12 12
===============================================================================
13 13

  
14 14

  
15
07 Jun-2013 Build 1911 Dietmar Woellbrink (Luisehahne)
16
! modules/menu_link/save.php coding new sql logic to replace adding an empty table row in add.php
15 17
07 Jun-2013 Build 1910 Dietmar Woellbrink (Luisehahne)
16 18
! modules/wysiwyg/save.php use new methode in class.wb to replace absolute MediaUrl
17 19
07 Jun-2013 Build 1909 Dietmar Woellbrink (Luisehahne)
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '1910');
54
if(!defined('REVISION')) define('REVISION', '1911');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/modules/menu_link/save.php
4 4
 * @category        modules
5 5
 * @package         menu_link
6 6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2011, Website Baker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
7
 * @copyright       2009-2013, WebsiteBaker Org. e.V.
8
 * @link            http://www.websitebaker.org/
9 9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.x
10
 * @platform        WebsiteBaker 2.8.4
11 11
 * @requirements    PHP 5.2.2 and higher
12 12
 * @version         $Id$
13
 * @filesource		$HeadURL$
13
 * @filesource      $HeadURL$
14 14
 * @lastmodified    $Date$
15 15
 *
16 16
*/
......
32 32

  
33 33
// Update id, anchor and target
34 34
if(isset($_POST['menu_link'])) {
35
	$foreign_page_id = $admin->add_slashes($_POST['menu_link']);
36
	$page_target = $admin->add_slashes($_POST['page_target']);
37
	$url_target = $admin->add_slashes($_POST['target']);
38
	$r_type = $admin->add_slashes($_POST['r_type']);
35
	$foreign_page_id = intval($_POST['menu_link']);
36
	$url_target = $admin->StripCodeFromText($_POST['target']);
37
	$r_type = intval($_POST['r_type']);
38
	$page_target = $admin->StripCodeFromText($_POST['page_target']);
39 39
	if(isset($_POST['extern']))
40
		$extern = $admin->add_slashes($_POST['extern']);
40
		$extern = $admin->StripCodeFromText($_POST['extern']);
41 41
	else
42 42
		$extern='';
43 43

  
44 44
	$table_pages = TABLE_PREFIX.'pages';
45 45
	$table_mod = TABLE_PREFIX.'mod_menu_link';
46 46
	$database->query("UPDATE `$table_pages` SET `target` = '$url_target' WHERE `page_id` = '$page_id'");
47
	$database->query("UPDATE `$table_mod` SET `target_page_id` = '$foreign_page_id', `anchor` = '$page_target', `extern` = '$extern', `redirect_type` = '$r_type' WHERE `page_id` = '$page_id'");
47
//	$database->query("UPDATE `$table_mod` SET `target_page_id` = '$foreign_page_id', `anchor` = '$page_target', `extern` = '$extern', `redirect_type` = '$r_type' WHERE `page_id` = '$page_id'");
48

  
49
	// Check that it doesn't already exist
50
	$sqlwhere = 'WHERE `page_id`='.$page_id.'';
51
	$sqlOne  = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'mod_menu_link` '.$sqlwhere;
52
	if( $database->get_one($sqlOne) ) {
53
		$sql  = 'UPDATE `'.TABLE_PREFIX.'mod_menu_link`  SET';
54
	}else{
55
		// Load into DB
56
		$sql  = 'INSERT INTO `'.TABLE_PREFIX.'mod_menu_link`  SET ';
57
		$sqlwhere = '';
58
		$sql .= '`section_id`='.$section_id.', '
59
		      . '`page_id`='.$page_id.', ';
60
	}
61
	$sql .= '`target_page_id` = \''.$foreign_page_id.'\', '
62
	      . '`anchor` =  \''.$database->escapeString($page_target).'\', '
63
	      . '`extern` = \''.$database->escapeString($extern).'\', '
64
	      . '`redirect_type` = \''.$r_type.'\' '
65
	      . $sqlwhere;
48 66
}
49 67

  
50 68
// Check if there is a database error, otherwise say successful
51
if($database->is_error()) {
69
if($database->query($sql)) {
70
	$admin->print_success($MESSAGE['PAGES_SAVED'],$backlink );
71
} else {
52 72
	$admin->print_error($database->get_error(), $js_back);
53
} else {
54
	$admin->print_success($MESSAGE['PAGES']['SAVED'],$backlink );
55 73
}
56 74

  
57 75
// Print admin footer

Also available in: Unified diff