-
Notifications
You must be signed in to change notification settings - Fork 4
/
modify_settings.php
103 lines (88 loc) · 3.13 KB
/
modify_settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
/**
*
* @category modules
* @package news_img
* @author WBCE Community
* @copyright 2004-2009, Ryan Djurovich
* @copyright 2009-2010, Website Baker Org. e.V.
* @copyright 2019-, WBCE Community
* @link https://www.wbce.org/
* @license http://www.gnu.org/licenses/gpl.html
* @platform WBCE
*
*/
global $section_id;
require_once __DIR__.'/functions.inc.php';
require_once WB_PATH .'/framework/module.functions.php';
$admin_header = false;
require WB_PATH.'/modules/admin.php';
$source_id = 0;
if (isset($_POST['source_id']) && is_numeric($_POST['source_id']) && ($_POST['source_id'] > 0)) {
$source_id = $_POST['source_id'];
}
if(!defined('CAT_PATH')) {
if (isset($_POST['source_id'])) {
if(!$admin->checkFTAN()) {
$admin->print_header();
$admin->print_error(
$MESSAGE['GENERIC_SECURITY_ACCESS']
.' (FTAN) '.__FILE__.':'.__LINE__,
ADMIN_URL.'/pages/index.php'
);
$admin->print_footer();
exit();
} else {
$admin->print_header();
}
} else {
$admin->print_header();
$section_key = $admin->checkIDKEY('section_key', 0, 'GET');
if (!$section_key || $section_key != $section_id) {
$admin->print_error(
$MESSAGE['GENERIC_SECURITY_ACCESS']
.' (IDKEY) '.__FILE__.':'.__LINE__,
ADMIN_URL.'/pages/index.php'
);
$admin->print_footer();
exit();
}
}
}
// get settings
$settings = mod_nwi_settings_get($source_id>0?$source_id:$section_id);
// Check if user has permission to modify the page settings
if (!$admin->isAdmin() && $settings['show_settings_only_admins'] == 'Y') {
$admin->print_error($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
}
// extract width and height
$previewwidth = $previewheight = $thumbwidth = $thumbheight = '';
if (substr_count($settings['resize_preview'], 'x')>0) {
list($previewwidth, $previewheight) = explode('x', $settings['resize_preview'], 2);
}
if (substr_count($settings['imgthumbsize'], 'x')>0) {
list($thumbwidth, $thumbheight) = explode('x', $settings['imgthumbsize'], 2);
}
// Set raw html <'s and >'s to be replaced by friendly html code
$raw = array('<', '>');
$friendly = array('<', '>');
// default image sizes
$SIZES['50'] = '50x50px';
$SIZES['75'] = '75x75px';
$SIZES['100'] = '100x100px';
$SIZES['125'] = '125x125px';
$SIZES['150'] = '150x150px';
$SIZES['220'] = '200x200px';
$FTAN = $admin->getFTAN();
// get available views
if(defined('CAT_PATH')) {
$views = CAT_Helper_Directory::getDirectories(__DIR__.'/views',__DIR__.'/views/');
} else {
$dirs = array_filter(glob(__DIR__.'/views/*'), 'is_dir');
foreach($dirs as $dir) {
$views[] = pathinfo($dir,PATHINFO_FILENAME);
}
}
include __DIR__.'/templates/default/modify_settings.phtml';
// Print admin footer
$admin->print_footer();