| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
require '../include/class.vfs.php'; |
|---|
| 22 |
require '../include/ispcp-lib.php'; |
|---|
| 23 |
|
|---|
| 24 |
check_login(__FILE__); |
|---|
| 25 |
|
|---|
| 26 |
$tpl = new pTemplate(); |
|---|
| 27 |
$tpl->define_dynamic('page', Config::get('CLIENT_TEMPLATE_PATH') . '/error_pages.tpl'); |
|---|
| 28 |
$tpl->define_dynamic('page_message', 'page'); |
|---|
| 29 |
$tpl->define_dynamic('logged_from', 'page'); |
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
function write_error_page(&$sql, $user_id, $eid) { |
|---|
| 34 |
$error = stripslashes($_POST['error']); |
|---|
| 35 |
$file = '/errors/' . $eid . '.html'; |
|---|
| 36 |
$vfs = &new vfs($_SESSION['user_logged'], $sql); |
|---|
| 37 |
return $vfs->put($file, $error); |
|---|
| 38 |
} |
|---|
| 39 |
|
|---|
| 40 |
function update_error_page(&$sql, $user_id) { |
|---|
| 41 |
if (isset($_POST['uaction']) && $_POST['uaction'] === 'updt_error') { |
|---|
| 42 |
$eid = intval($_POST['eid']); |
|---|
| 43 |
if (in_array($eid, array(401, 402, 403, 404, 500, 503)) && write_error_page($sql, $_SESSION['user_id'], $eid)) { |
|---|
| 44 |
set_page_message(tr('Custom error page was updated!')); |
|---|
| 45 |
} else { |
|---|
| 46 |
set_page_message(tr('System error - custom error page was NOT updated!')); |
|---|
| 47 |
} |
|---|
| 48 |
} |
|---|
| 49 |
} |
|---|
| 50 |
|
|---|
| 51 |
$theme_color = Config::get('USER_INITIAL_THEME'); |
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
$domain = $_SESSION['user_logged']; |
|---|
| 56 |
$domain = "http://www." . $domain; |
|---|
| 57 |
|
|---|
| 58 |
$tpl->assign(array('TR_CLIENT_ERROR_PAGE_TITLE' => tr('ispCP - Client/Manage Error Custom Pages'), |
|---|
| 59 |
'THEME_COLOR_PATH' => "../themes/$theme_color", |
|---|
| 60 |
'THEME_CHARSET' => tr('encoding'), |
|---|
| 61 |
'ISP_LOGO' => get_logo($_SESSION['user_id']), |
|---|
| 62 |
'DOMAIN' => $domain |
|---|
| 63 |
)); |
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
update_error_page($sql, $_SESSION['user_id']); |
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
gen_client_mainmenu($tpl, Config::get('CLIENT_TEMPLATE_PATH') . '/main_menu_webtools.tpl'); |
|---|
| 72 |
gen_client_menu($tpl, Config::get('CLIENT_TEMPLATE_PATH') . '/menu_webtools.tpl'); |
|---|
| 73 |
|
|---|
| 74 |
gen_logged_from($tpl); |
|---|
| 75 |
|
|---|
| 76 |
check_permissions($tpl); |
|---|
| 77 |
|
|---|
| 78 |
$tpl->assign( |
|---|
| 79 |
array( |
|---|
| 80 |
'TR_ERROR_401' => tr('Error 401 (unauthorised)'), |
|---|
| 81 |
'TR_ERROR_403' => tr('Error 403 (forbidden)'), |
|---|
| 82 |
'TR_ERROR_404' => tr('Error 404 (not found)'), |
|---|
| 83 |
'TR_ERROR_500' => tr('Error 500 (internal server error)'), |
|---|
| 84 |
'TR_ERROR_503' => tr('Error 503 (service unavailable)'), |
|---|
| 85 |
'TR_ERROR_PAGES' => tr('Error pages'), |
|---|
| 86 |
'TR_EDIT' => tr('Edit'), |
|---|
| 87 |
'TR_VIEW' => tr('View') |
|---|
| 88 |
) |
|---|
| 89 |
); |
|---|
| 90 |
|
|---|
| 91 |
gen_page_message($tpl); |
|---|
| 92 |
$tpl->parse('PAGE', 'page'); |
|---|
| 93 |
$tpl->prnt(); |
|---|
| 94 |
|
|---|
| 95 |
if (Config::get('DUMP_GUI_DEBUG')) |
|---|
| 96 |
dump_gui_debug(); |
|---|
| 97 |
|
|---|
| 98 |
unset_messages(); |
|---|
| 99 |
|
|---|
| 100 |
?> |
|---|