Revision 1457
Added by Luisehahne over 14 years ago
| admin.php | ||
|---|---|---|
| 22 | 22 |
die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
|
| 23 | 23 |
} |
| 24 | 24 |
|
| 25 |
// if admin is be call from admin modify core you have $page_id |
|
| 26 |
if(!isset($page_id)) {
|
|
| 27 |
// Get page id |
|
| 28 |
if(isset($_GET['page_id']) && is_numeric($_GET['page_id'])) {
|
|
| 29 |
$page_id = (int)$_GET['page_id']; |
|
| 30 |
} elseif(isset($_POST['page_id']) && is_numeric($_POST['page_id'])) {
|
|
| 31 |
$page_id = (int)$_POST['page_id']; |
|
| 32 |
} else {
|
|
| 25 |
// Get page id |
|
| 26 |
$requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']); |
|
| 27 |
$page_id = intval(isset(${$requestMethod}['page_id'])) ? ${$requestMethod}['page_id'] : (isset($page_id) ? intval($page_id) : 0);
|
|
| 28 |
if( ($page_id == 0)) {
|
|
| 33 | 29 |
header("Location: index.php");
|
| 34 | 30 |
exit(0); |
| 35 | 31 |
} |
| 36 |
} |
|
| 37 | 32 |
|
| 38 |
// if admin is be call from admin modify core you have $section_id |
|
| 39 |
if(!isset($section_id)) {
|
|
| 40 | 33 |
// Get section id if there is one |
| 41 |
if(isset($_GET['section_id']) && is_numeric($_GET['section_id'])) {
|
|
| 42 |
$section_id = (int)$_GET['section_id']; |
|
| 43 |
} elseif(isset($_POST['section_id']) && is_numeric($_POST['section_id'])) {
|
|
| 44 |
$section_id = (int)$_POST['section_id']; |
|
| 45 |
} else {
|
|
| 46 |
// Check if we should redirect the user if there is no section id |
|
| 47 |
if(!isset($section_required)) {
|
|
| 48 |
$section_id = 0; |
|
| 49 |
} else {
|
|
| 50 |
header("Location: $section_required");
|
|
| 51 |
exit(0); |
|
| 52 |
} |
|
| 34 |
$requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']); |
|
| 35 |
$section_id = intval(isset(${$requestMethod}['section_id'])) ? ${$requestMethod}['section_id'] : (isset($section_id) ? intval($section_id) : 0);
|
|
| 36 |
if( ($section_id == 0) && isset($section_required)) {
|
|
| 37 |
header("Location: $section_required");
|
|
| 38 |
exit(0); |
|
| 53 | 39 |
} |
| 54 |
}
|
|
| 40 |
/*
|
|
| 55 | 41 |
// be sure is is numeric |
| 56 | 42 |
$page_id = intval($page_id); |
| 57 | 43 |
$section_id = intval($section_id); |
| 58 |
|
|
| 44 |
*/ |
|
| 59 | 45 |
// Create js back link |
| 60 | 46 |
// $js_back = 'javascript: history.go(-1);'; |
| 61 |
$js_back = ADMIN_URL.'/pages/sections.php?page_id='.(int)$page_id;
|
|
| 47 |
$js_back = ADMIN_URL.'/pages/sections.php?page_id='.$page_id; |
|
| 62 | 48 |
// Create new admin object, you can set the next variable in your module |
| 63 | 49 |
// to print with or without header, default is with header |
| 64 | 50 |
// it is recommed to set the variable before including the /modules/admin.php |
| ... | ... | |
| 82 | 68 |
|
| 83 | 69 |
if((!$in_group) && !is_numeric(array_search($admin->get_user_id(), $old_admin_users))) {
|
| 84 | 70 |
print $admin->get_group_id().$admin->get_user_id(); |
| 85 |
print_r ($old_admin_groups); |
|
| 71 |
// print_r ($old_admin_groups);
|
|
| 86 | 72 |
$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']); |
| 87 | 73 |
} |
| 88 | 74 |
|
| ... | ... | |
| 93 | 79 |
if (!$admin->get_permission($section['module'], 'module')) |
| 94 | 80 |
{
|
| 95 | 81 |
$admin->print_error($MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS']); |
| 96 |
}
|
|
| 82 |
} |
|
| 97 | 83 |
} |
| 98 | 84 |
|
| 99 | 85 |
// Workout if the developer wants to show the info banner |
| ... | ... | |
| 178 | 164 |
// Parse and print header template |
| 179 | 165 |
$template->parse('main', 'main_block', false);
|
| 180 | 166 |
$template->pparse('output', 'page');
|
| 181 |
|
|
| 182 | 167 |
// unset($print_info_banner); |
| 183 | 168 |
unset($template); |
| 184 |
print '<div id="wb_'.$section['section_id'].'"><b>' . $TEXT['BLOCK'] . ': </b>' . $section['block']; |
|
| 185 |
print '<b> Modul: </b>' . $section['module']." "; |
|
| 186 |
print '<b> ID: </b>' . $section_id."</div>\n"; |
|
| 187 | 169 |
|
| 170 |
if (SECTION_BLOCKS) {
|
|
| 171 |
if (isset($block[$section['block']]) && trim(strip_tags(($block[$section['block']]))) != '') |
|
| 172 |
{
|
|
| 173 |
$block_name = htmlentities(strip_tags($block[$section['block']])); |
|
| 174 |
} else {
|
|
| 175 |
if ($section['block'] == 1) |
|
| 176 |
{
|
|
| 177 |
$block_name = $TEXT['MAIN']; |
|
| 178 |
} else {
|
|
| 179 |
$block_name = '#' . (int) $section['block']; |
|
| 180 |
} |
|
| 181 |
} |
|
| 182 |
|
|
| 183 |
$sec_anchor = (defined( 'SEC_ANCHOR' ) && ( SEC_ANCHOR != '' ) ? 'id="'.SEC_ANCHOR.$section['section_id'].'"' : ''); |
|
| 184 |
print '<div class="section-info" '.$sec_anchor.' ><b>' . $TEXT['BLOCK'] . ': </b>' . $block_name; |
|
| 185 |
print '<b> Modul: </b>' . $section['module']." "; |
|
| 186 |
print '<b> ID: </b>' . $section_id."</div>\n"; |
|
| 187 |
} |
|
| 188 |
|
|
| 188 | 189 |
} // |
| 189 | 190 |
|
| 190 | 191 |
// Work-out if the developer wants us to update the timestamp for when the page was last modified |
| 191 | 192 | |
Also available in: Unified diff
Preparing 2.8.2 stable, last tests