Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        modules
5
 * @package         menu_link
6
 * @author          WebsiteBaker Project
7
 * @copyright       WebsiteBaker Org. e.V.
8
 * @link            http://websitebaker.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.3
11
 * @requirements    PHP 5.3.6 and higher
12
 * @version         $Id: save.php 2 2017-07-02 15:14:29Z Manuela $
13
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/branches/main/modules/menu_link/save.php $
14
 * @lastmodified    $Date: 2017-07-02 17:14:29 +0200 (Sun, 02 Jul 2017) $
15
 *
16
*/
17

    
18
if ( !defined( 'WB_PATH' ) ){ require( dirname(dirname((__DIR__))).'/config.php' ); }
19

    
20
$admin_header = false;
21
// Tells script to update when this page was last updated
22
$update_when_modified = true;
23
// Include WB admin wrapper script
24
require(WB_PATH.'/modules/admin.php');
25
$backlink = ADMIN_URL.'/pages/modify.php?page_id='.(int)$page_id;
26
if (!$admin->checkFTAN())
27
{
28
    $admin->print_header();
29
    $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$backlink );
30
}
31
$admin->print_header();
32

    
33
// Update id, anchor and target
34
if(isset($_POST['menu_link'])) {
35
    $iTargetPageId = intval($admin->get_post('menu_link'));
36
    $iRedirectType = intval($admin->get_post('r_type'));
37
    $anchor = ($admin->get_post('page_target'));
38
    $sTarget = $admin->get_post('target');
39
    $extern='';
40
    if(isset($_POST['extern'])) {
41
        include_once WB_PATH.'/include/idna_convert/idna_convert.class.php';
42
        $oIdn = new idna_convert();
43
        $extern = $oIdn->encode($_POST['extern']);
44
        $extern = (filter_var($extern, FILTER_VALIDATE_URL) === false ? '' : $extern);
45
        $extern = $oIdn->decode($extern);
46
        unset($oIdn);
47
    } else { $extern = ''; }
48

    
49
    $table_pages = TABLE_PREFIX.'pages';
50
    $sql = 'UPDATE `'.TABLE_PREFIX.'pages` SET '
51
        .'`target` = \''.$database->escapeString($sTarget).'\' '
52
        .'WHERE `page_id` = '.$page_id;
53
    $database->query($sql);
54

    
55
    $sql = 'UPDATE `'.TABLE_PREFIX.'mod_menu_link` SET '
56
        .'`target_page_id` = '.$iTargetPageId.', '
57
        .'`redirect_type`  = '.$iRedirectType.', '
58
        .'`anchor` = \''.$database->escapeString($anchor).'\', '
59
        .'`extern` = \''.$database->escapeString($extern).'\' '
60
        .'WHERE `page_id` = '.$page_id;
61
    $database->query($sql);
62
}
63

    
64
// Check if there is a database error, otherwise say successful
65
if($database->is_error()) {
66
    $admin->print_error($database->get_error(), $js_back);
67
} else {
68
    $admin->print_success($MESSAGE['PAGES_SAVED'],$backlink );
69
}
70

    
71
// Print admin footer
72
$admin->print_footer();
(9-9/11)