Project

General

Profile

« Previous | Next » 

Revision 1825

Added by Dietmar over 11 years ago

! update page settings, add save & back Button, add extended hide/show
redesign the page settings for a better overview

View differences:

settings_save.php
14 14
 * @lastmodified    $Date$
15 15
 *
16 16
 */
17
/* */
18 17

  
19 18
// Create new admin object and print admin header
20
require('../../config.php');
21
require_once(WB_PATH.'/framework/class.admin.php');
19
if(!defined('WB_URL'))
20
{
21
    $config_file = realpath('../../config.php');
22
    if(file_exists($config_file) && !defined('WB_URL'))
23
    {
24
    	require($config_file);
25
    }
26
}
27
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
22 28

  
23 29
$lang_dir = dirname(__FILE__).'/languages/';
24 30
$lang = file_exists($lang_dir.LANGUAGE.'.php') ? LANGUAGE : 'EN';
......
26 32

  
27 33
// suppress to print the header, so no new FTAN will be set
28 34
$admin = new admin('Pages', 'pages_settings',false);
29

  
30 35
$pagetree_url = ADMIN_URL.'/pages/index.php';
31 36

  
32 37
// Get page id
......
56 61
	$admin->print_header();
57 62
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$target_url);
58 63
}
64

  
59 65
// After check print the header
60 66
$admin->print_header();
61 67

  
68
if(isset($_POST['extended_submit'])) {
69
	$sql = 'SELECT `value` FROM `'.TABLE_PREFIX.'settings` WHERE `name` = \'page_exented\'';
70
	if( ($page_exented = $database->get_one($sql)) != '' ) {
71
		$sql = 'UPDATE ';
72
		$sql_where = 'WHERE `name` = \'page_exented\'';
73
	} else {
74
		$sql = 'INSERT INTO ';
75
		$sql_where = '';
76
	}
77
	$val = (((($page_exented=='1') ? $page_exented : 0)) + 1) % 2;
78

  
79
	$sql .= '`'.TABLE_PREFIX.'settings` ';
80
	$sql .= 'SET `name` = \'page_exented\', ';
81
	$sql .= '`value` = \''.$val.'\' '.$sql_where;
82

  
83
    if($database->query($sql)) {
84
        // redirect to backend
85
echo "<p style=\"text-align:center;\"> If the script</strong> could not be start automatically.\n" .
86
     "Please click <a style=\"font-weight:bold;\" " .
87
     "href=\"".$target_url."\">on this link</a> to start the script!</p>\n";
88
echo "<script type=\"text/javascript\">
89
<!--
90
// Get the location object
91
var locationObj = document.location;
92
// Set the value of the location object
93
document.location = '$target_url';
94
-->
95
</script>";
96

  
97
    } else {
98
    	$admin->print_error($database->get_error(), $target_url );
99
    }
100
}
101

  
62 102
// Include the WB functions file
63
require_once(WB_PATH.'/framework/functions.php');
103
if(!function_exists('directory_list')) { require(WB_PATH.'/framework/functions.php'); }
64 104

  
65 105
// Get values
66 106
$page_title = str_replace(array("[[", "]]"), '', htmlspecialchars($admin->get_post_escaped('page_title')));
......
335 375

  
336 376
// using standard function by core,
337 377
function fix_page_trail($page_id) {
338
    global $database,$admin,$target_url,$MESSAGE;
378
    global $database,$admin,$target_url,$pagetree_url,$MESSAGE;
379

  
380
    $target_url = (isset($_POST['back_submit'])) ? $pagetree_url : $target_url;
381

  
339 382
    // Work out level
340 383
    $level = level_count($page_id);
341 384
    // Work out root parent

Also available in: Unified diff