root/trunk/gui/include/ispcp-lib.php

Revision 1355, 7.8 kB (checked in by scitech, 2 months ago)

Cleaning update functions code

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 define('INCLUDEPATH', realpath(dirname(__FILE__)));
22 require_once(INCLUDEPATH . '/ispcp-config.php');
23
24 session_name('ispCP');
25
26 if (!isset($_SESSION)) {
27     session_start();
28 }
29
30 // Error handling and debug
31 //error_reporting(0);
32 // setting for development edition - see all error messages
33 error_reporting(E_ALL);
34
35 require_once(INCLUDEPATH . '/spGzip.php');
36 require_once(INCLUDEPATH . '/class.pTemplate.php');
37 require_once(INCLUDEPATH . '/i18n.php');
38
39 // Template pathes
40 Config::set('ROOT_TEMPLATE_PATH', 'themes/');
41 Config::set('USER_INITIAL_THEME', 'omega_original');
42 Config::set('LOGIN_TEMPLATE_PATH', Config::get('ROOT_TEMPLATE_PATH') . Config::get('USER_INITIAL_THEME'));
43 Config::set('ADMIN_TEMPLATE_PATH', '../' . Config::get('ROOT_TEMPLATE_PATH') . Config::get('USER_INITIAL_THEME') . '/admin');
44 Config::set('RESELLER_TEMPLATE_PATH', '../' . Config::get('ROOT_TEMPLATE_PATH') . Config::get('USER_INITIAL_THEME') . '/reseller');
45 Config::set('CLIENT_TEMPLATE_PATH', '../' . Config::get('ROOT_TEMPLATE_PATH') . Config::get('USER_INITIAL_THEME') . '/client');
46 Config::set('IPS_LOGO_PATH', '../themes/user_logos');
47 Config::set('PURCHASE_TEMPLATE_PATH', '../' . Config::get('ROOT_TEMPLATE_PATH') . Config::get('USER_INITIAL_THEME') . '/orderpanel');
48
49 // Standard Language (if not set)
50 Config::set('USER_INITIAL_LANG', 'lang_English');
51
52 require_once(INCLUDEPATH . '/system-message.php');
53 require_once(INCLUDEPATH . '/ispcp-db-keys.php');
54 require_once(INCLUDEPATH . '/sql.php');
55 define('E_USER_OFF', 0);
56
57 // variable for development edition => shows all php variables under the pages
58 // false = disable, true = enable
59 Config::set('DUMP_GUI_DEBUG', false);
60
61 // session timeout in minutes
62 Config::set('SESSION_TIMEOUT', 30);
63 // Item states
64 Config::set('ITEM_ADD_STATUS', 'toadd');
65 Config::set('ITEM_OK_STATUS', 'ok');
66 Config::set('ITEM_CHANGE_STATUS', 'change');
67 Config::set('ITEM_DELETE_STATUS', 'delete');
68 Config::set('ITEM_DISABLED_STATUS', 'disabled');
69 Config::set('ITEM_RESTORE_STATUS', 'restore');
70 Config::set('ITEM_TOENABLE_STATUS', 'toenable');
71 Config::set('ITEM_TODISABLED_STATUS', 'todisable');
72 Config::set('ITEM_ORDERED_STATUS', 'ordered');
73 // SQL variables
74 Config::set('MAX_SQL_DATABASE_LENGTH', 64);
75 Config::set('MAX_SQL_USER_LENGTH', 16);
76 Config::set('MAX_SQL_PASS_LENGTH', 32);
77
78 // the following variables are overriden via admin cp
79 Config::set('DOMAIN_ROWS_PER_PAGE', 10);
80 // 'admin' => hosting plans are available only in admin level, reseller can not make custom changes
81 // 'reseller' => hosting plans are available only in reseller level
82 Config::set('HOSTING_PLANS_LEVEL', 'reseller');
83
84 // enable or disable supportsystem
85 // false = disable, true = enable
86 Config::set('ISPCP_SUPPORT_SYSTEM', true);
87
88 // enable or disable lostpassword function
89 // false = disable, true = enable
90 Config::set('LOSTPASSWORD', true);
91
92 // uniqkeytimeout in minuntes
93 Config::set('LOSTPASSWORD_TIMEOUT', 30);
94 // captcha imagehigh
95 Config::set('LOSTPASSWORD_CAPTCHA_HEIGHT', 65);
96 // captcha imagewidth
97 Config::set('LOSTPASSWORD_CAPTCHA_WIDTH', 210);
98 // captcha background color
99 Config::set('LOSTPASSWORD_CAPTCHA_BGCOLOR', array(229,243,252));
100 // captcha text color
101 Config::set('LOSTPASSWORD_CAPTCHA_TEXTCOLOR', array(0,53,92));
102 // captcha ttf fontfile
103 Config::set('LOSTPASSWORD_CAPTCHA_FONT', Config::get('LOGIN_TEMPLATE_PATH') . '/font/cap.ttf');
104
105 // enable or disable bruteforcedetection
106 // false = disable, true = enable
107 Config::set('BRUTEFORCE', true);
108 // blocktime in minutes
109 Config::set('BRUTEFORCE_BLOCK_TIME', 30);
110 // max login before block
111 Config::set('BRUTEFORCE_MAX_LOGIN', 3);
112 // max captcha failed attempts before block
113 Config::set('BRUTEFORCE_MAX_CAPTCHA', 5);
114 // enable or disable time between logins
115 // true = disable, false = enable
116 Config::set('BRUTEFORCE_BETWEEN', true);
117 // time between logins in seconds
118 Config::set('BRUTEFORCE_BETWEEN_TIME', 30);
119
120 // enable or disable maintenance mode
121 // true = disable, false = enable
122 Config::set('MAINTENANCEMODE', false);
123 // servicemode message
124 Config::set('MAINTENANCEMODE_MESSAGE', tr("We are sorry, but the system is currently under maintenance.\nPlease try again later."));
125 curlang(null, true); //restore language auto detection
126
127 // password chars
128 Config::set('PASSWD_CHARS', 6);
129 // enable or disable strong passwords
130 // false = disable, true = enable
131 Config::set('PASSWD_STRONG', true);
132
133 // The virtual host file from Apache which contains our virtual host entries
134 Config::set('SERVER_VHOST_FILE', Config::get('APACHE_SITES_DIR') . '/ispcp.conf');
135
136 // The minimum level for a message to be sent to DEFAULT_ADMIN_ADDRESS
137 // PHP's E_USER_* values are used for simplicity:
138 // E_USER_NOTICE: logins, and all info that isn't very relevant
139 // E_USER_WARNING: switching to an other account, etc
140 // E_USER_ERROR: "admin MUST know" messages
141 Config::set('LOG_LEVEL', E_USER_NOTICE);
142
143 // Set to false to disable creation of webmaster, postmaster and abuse forwarders when domain/alias/subdomain is created
144 Config::set('CREATE_DEFAULT_EMAIL_ADDRESSES', true);
145
146 // Use hard mail suspension when suspending a domain:
147 // true: email accounts are hard suspended (completely unreachable)
148 // false: email accounts are soft suspended (passwords are modified so user can't access the accounts)
149 Config::set('HARD_MAIL_SUSPENSION', true);
150
151 // false: disable automatic serch for new version
152 Config::set('CHECK_FOR_UPDATES', true);
153
154 Config::set('CRITICAL_UPDATE_REVISION', 0);
155
156
157 require_once(INCLUDEPATH . '/date-functions.php');
158 require_once(INCLUDEPATH . '/input-checks.php');
159 require_once(INCLUDEPATH . '/debug.php');
160 require_once(INCLUDEPATH . '/calc-functions.php');
161 require_once(INCLUDEPATH . '/login-functions.php');
162 require_once(INCLUDEPATH . '/login.php');
163 require_once(INCLUDEPATH . '/client-functions.php');
164 require_once(INCLUDEPATH . '/admin-functions.php');
165 require_once(INCLUDEPATH . '/reseller-functions.php');
166 require_once(INCLUDEPATH . '/ispcp-functions.php');
167 require_once(INCLUDEPATH . '/idna.php');
168 require_once(INCLUDEPATH . '/lostpassword-functions.php');
169 require_once(INCLUDEPATH . '/emailtpl-functions.php');
170 require_once(INCLUDEPATH . '/layout-functions.php');
171 require_once(INCLUDEPATH . '/functions.ticket_system.php');
172 require_once(INCLUDEPATH . '/class.ispcp-update.php');
173 require_once(INCLUDEPATH . '/class.database-update.php');
174 require_once(INCLUDEPATH . '/class.critical-update.php');
175 require_once(INCLUDEPATH . '/htmlpurifier/HTMLPurifier.auto.php');
176 //require_once(INCLUDEPATH . '/htmlpurifier/HTMLPurifier.func.php');
177
178 if ($_SERVER['SCRIPT_NAME'] != '/client/sql_execute_query.php') {
179     check_query();
180 } else {
181     check_query(array('sql_query'));
182 }
183
184 if ($_REQUEST && !defined('OVERRIDE_PURIFIER')) {
185     $config = HTMLPurifier_Config::createDefault();
186     $config->set('HTML', 'TidyLevel', 'none'); // XSS cleaning
187
188     $purifier = new HTMLPurifier($config);
189     //$purifier = HTMLPurifier::getInstance();
190
191     $_GET     = $purifier->purifyArray($_GET);
192     $_POST     = $purifier->purifyArray($_POST);
193     //$_COOKIE = $purifier->purifyArray($_COOKIE);
194 }
195
196 $query = "SELECT `name`, `value` FROM `config`";
197
198 if (!$res = exec_query($sql, $query, array())) {
199     system_message(tr('Could not get config from database'));
200 } else {
201     while($row = $res -> FetchRow()) {
202         Config::set($row['name'], $row['value']);
203     }
204 }
205
206 ?>
Note: See TracBrowser for help on using the browser.