root/trunk/gui/client/error_pages.php

Revision 1359, 2.9 kB (checked in by scitech, 2 months ago)

Fixed #1544: Add SQL user has only one option -> useless. Fixed #1545: HTML bug with hint for updates. Fixed #1546: Tiny english typo

Line 
1 <?php
2 /**
3  * ispCP ω (OMEGA) a Virtual Hosting Control System
4  *
5  * @copyright     2001-2006 by moleSoftware GmbH
6  * @copyright     2006-2008 by ispCP | http://isp-control.net
7  * @version     SVN: $Id$
8  * @link         http://isp-control.net
9  * @author         ispCP Team
10  *
11  * @license
12  *   This program is free software; you can redistribute it and/or modify it under
13  *   the terms of the MPL General Public License as published by the Free Software
14  *   Foundation; either version 1.1 of the License, or (at your option) any later
15  *   version.
16  *   You should have received a copy of the MPL Mozilla Public License along with
17  *   this program; if not, write to the Open Source Initiative (OSI)
18  *   http://opensource.org | osi@opensource.org
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 // page functions.
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 // common page data.
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 // dynamic page data.
66
67 update_error_page($sql, $_SESSION['user_id']);
68
69 // static page messages.
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 ?>
Note: See TracBrowser for help on using the browser.