1 | <?php |
---|
2 | /*********************************************** |
---|
3 | * File : config.php |
---|
4 | * Project : Z-Push |
---|
5 | * Descr : Main configuration file |
---|
6 | * |
---|
7 | * Created : 01.10.2007 |
---|
8 | * |
---|
9 | * Copyright 2007 - 2012 Zarafa Deutschland GmbH |
---|
10 | * |
---|
11 | * This program is free software: you can redistribute it and/or modify |
---|
12 | * it under the terms of the GNU Affero General Public License, version 3, |
---|
13 | * as published by the Free Software Foundation with the following additional |
---|
14 | * term according to sec. 7: |
---|
15 | * |
---|
16 | * According to sec. 7 of the GNU Affero General Public License, version 3, |
---|
17 | * the terms of the AGPL are supplemented with the following terms: |
---|
18 | * |
---|
19 | * "Zarafa" is a registered trademark of Zarafa B.V. |
---|
20 | * "Z-Push" is a registered trademark of Zarafa Deutschland GmbH |
---|
21 | * The licensing of the Program under the AGPL does not imply a trademark license. |
---|
22 | * Therefore any rights, title and interest in our trademarks remain entirely with us. |
---|
23 | * |
---|
24 | * However, if you propagate an unmodified version of the Program you are |
---|
25 | * allowed to use the term "Z-Push" to indicate that you distribute the Program. |
---|
26 | * Furthermore you may use our trademarks where it is necessary to indicate |
---|
27 | * the intended purpose of a product or service provided you use it in accordance |
---|
28 | * with honest practices in industrial or commercial matters. |
---|
29 | * If you want to propagate modified versions of the Program under the name "Z-Push", |
---|
30 | * you may only do so if you have a written permission by Zarafa Deutschland GmbH |
---|
31 | * (to acquire a permission please contact Zarafa at trademark@zarafa.com). |
---|
32 | * |
---|
33 | * This program is distributed in the hope that it will be useful, |
---|
34 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
35 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
36 | * GNU Affero General Public License for more details. |
---|
37 | * |
---|
38 | * You should have received a copy of the GNU Affero General Public License |
---|
39 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
40 | * |
---|
41 | * Consult LICENSE file for details |
---|
42 | ************************************************/ |
---|
43 | |
---|
44 | /********************************************************************************** |
---|
45 | * Default settings |
---|
46 | */ |
---|
47 | // Defines the default time zone, change e.g. to "Europe/London" if necessary |
---|
48 | define('TIMEZONE', ''); |
---|
49 | |
---|
50 | // Defines the base path on the server |
---|
51 | define('BASE_PATH', dirname($_SERVER['SCRIPT_FILENAME']). '/'); |
---|
52 | |
---|
53 | // Try to set unlimited timeout |
---|
54 | define('SCRIPT_TIMEOUT', 0); |
---|
55 | |
---|
56 | //Max size of attachments to display inline. Default is 2 MB |
---|
57 | define('MAX_EMBEDDED_SIZE', 2097152); |
---|
58 | |
---|
59 | |
---|
60 | /********************************************************************************** |
---|
61 | * Default FileStateMachine settings |
---|
62 | */ |
---|
63 | define('STATE_DIR', __DIR__.'/states/'); |
---|
64 | |
---|
65 | |
---|
66 | /********************************************************************************** |
---|
67 | * Logging settings |
---|
68 | * Possible LOGLEVEL and LOGUSERLEVEL values are: |
---|
69 | * LOGLEVEL_OFF - no logging |
---|
70 | * LOGLEVEL_FATAL - log only critical errors |
---|
71 | * LOGLEVEL_ERROR - logs events which might require corrective actions |
---|
72 | * LOGLEVEL_WARN - might lead to an error or require corrective actions in the future |
---|
73 | * LOGLEVEL_INFO - usually completed actions |
---|
74 | * LOGLEVEL_DEBUG - debugging information, typically only meaningful to developers |
---|
75 | * LOGLEVEL_WBXML - also prints the WBXML sent to/from the device |
---|
76 | * LOGLEVEL_DEVICEID - also prints the device id for every log entry |
---|
77 | * LOGLEVEL_WBXMLSTACK - also prints the contents of WBXML stack |
---|
78 | * |
---|
79 | * The verbosity increases from top to bottom. More verbose levels include less verbose |
---|
80 | * ones, e.g. setting to LOGLEVEL_DEBUG will also output LOGLEVEL_FATAL, LOGLEVEL_ERROR, |
---|
81 | * LOGLEVEL_WARN and LOGLEVEL_INFO level entries. |
---|
82 | */ |
---|
83 | define('LOGFILEDIR', __DIR__.'/logs/'); |
---|
84 | define('LOGFILE', LOGFILEDIR . 'z-push.log'); |
---|
85 | define('LOGERRORFILE', LOGFILEDIR . 'z-push-error.log'); |
---|
86 | define('LOGLEVEL', LOGLEVEL_WARN); |
---|
87 | define('LOGAUTHFAIL', false); |
---|
88 | |
---|
89 | |
---|
90 | // To save e.g. WBXML data only for selected users, add the usernames to the array |
---|
91 | // The data will be saved into a dedicated file per user in the LOGFILEDIR |
---|
92 | define('LOGUSERLEVEL', LOGLEVEL_DEVICEID); |
---|
93 | $specialLogUsers = array(); |
---|
94 | |
---|
95 | |
---|
96 | /********************************************************************************** |
---|
97 | * Mobile settings |
---|
98 | */ |
---|
99 | // Device Provisioning |
---|
100 | define('PROVISIONING', true); |
---|
101 | |
---|
102 | // This option allows the 'loose enforcement' of the provisioning policies for older |
---|
103 | // devices which don't support provisioning (like WM 5 and HTC Android Mail) - dw2412 contribution |
---|
104 | // false (default) - Enforce provisioning for all devices |
---|
105 | // true - allow older devices, but enforce policies on devices which support it |
---|
106 | define('LOOSE_PROVISIONING', false); |
---|
107 | |
---|
108 | // Default conflict preference |
---|
109 | // Some devices allow to set if the server or PIM (mobile) |
---|
110 | // should win in case of a synchronization conflict |
---|
111 | // SYNC_CONFLICT_OVERWRITE_SERVER - Server is overwritten, PIM wins |
---|
112 | // SYNC_CONFLICT_OVERWRITE_PIM - PIM is overwritten, Server wins (default) |
---|
113 | define('SYNC_CONFLICT_DEFAULT', SYNC_CONFLICT_OVERWRITE_PIM); |
---|
114 | |
---|
115 | // Global limitation of items to be synchronized |
---|
116 | // The mobile can define a sync back period for calendar and email items |
---|
117 | // For large stores with many items the time period could be limited to a max value |
---|
118 | // If the mobile transmits a wider time period, the defined max value is used |
---|
119 | // Applicable values: |
---|
120 | // SYNC_FILTERTYPE_ALL (default, no limitation) |
---|
121 | // SYNC_FILTERTYPE_1DAY, SYNC_FILTERTYPE_3DAYS, SYNC_FILTERTYPE_1WEEK, SYNC_FILTERTYPE_2WEEKS, |
---|
122 | // SYNC_FILTERTYPE_1MONTH, SYNC_FILTERTYPE_3MONTHS, SYNC_FILTERTYPE_6MONTHS |
---|
123 | define('SYNC_FILTERTIME_MAX', SYNC_FILTERTYPE_ALL); |
---|
124 | |
---|
125 | // Interval in seconds before checking if there are changes on the server when in Ping. |
---|
126 | // It means the highest time span before a change is pushed to a mobile. Set it to |
---|
127 | // a higher value if you have a high load on the server. |
---|
128 | define('PING_INTERVAL', 30); |
---|
129 | |
---|
130 | // Interval in seconds to force a re-check of potentially missed notifications when |
---|
131 | // using a changes sink. Default are 300 seconds (every 5 min). |
---|
132 | // This can also be disabled by setting it to false |
---|
133 | define('SINK_FORCERECHECK', 300); |
---|
134 | |
---|
135 | // Set the fileas (save as) order for contacts in the webaccess/webapp/outlook. |
---|
136 | // It will only affect new/modified contacts on the mobile which then are synced to the server. |
---|
137 | // Possible values are: |
---|
138 | // SYNC_FILEAS_FIRSTLAST - fileas will be "Firstname Middlename Lastname" |
---|
139 | // SYNC_FILEAS_LASTFIRST - fileas will be "Lastname, Firstname Middlename" |
---|
140 | // SYNC_FILEAS_COMPANYONLY - fileas will be "Company" |
---|
141 | // SYNC_FILEAS_COMPANYLAST - fileas will be "Company (Lastname, Firstname Middlename)" |
---|
142 | // SYNC_FILEAS_COMPANYFIRST - fileas will be "Company (Firstname Middlename Lastname)" |
---|
143 | // SYNC_FILEAS_LASTCOMPANY - fileas will be "Lastname, Firstname Middlename (Company)" |
---|
144 | // SYNC_FILEAS_FIRSTCOMPANY - fileas will be "Firstname Middlename Lastname (Company)" |
---|
145 | // The company-fileas will only be set if a contact has a company set. If one of |
---|
146 | // company-fileas is selected and a contact doesn't have a company set, it will default |
---|
147 | // to SYNC_FILEAS_FIRSTLAST or SYNC_FILEAS_LASTFIRST (depending on if last or first |
---|
148 | // option is selected for company). |
---|
149 | // If SYNC_FILEAS_COMPANYONLY is selected and company of the contact is not set |
---|
150 | // SYNC_FILEAS_LASTFIRST will be used |
---|
151 | define('FILEAS_ORDER', SYNC_FILEAS_LASTFIRST); |
---|
152 | |
---|
153 | // Amount of items to be synchronized per request |
---|
154 | // Normally this value is requested by the mobile. Common values are 5, 25, 50 or 100. |
---|
155 | // Exporting too much items can cause mobile timeout on busy systems. |
---|
156 | // Z-Push will use the lowest value, either set here or by the mobile. |
---|
157 | // default: 100 - value used if mobile does not limit amount of items |
---|
158 | define('SYNC_MAX_ITEMS', 100); |
---|
159 | |
---|
160 | /********************************************************************************** |
---|
161 | * Backend settings |
---|
162 | */ |
---|
163 | // The data providers that we are using (see configuration below) |
---|
164 | define('BACKEND_PROVIDER', "BackendExpresso"); |
---|
165 | |
---|
166 | |
---|
167 | //Expresso location |
---|
168 | define('EXPRESSO_PATH', __DIR__.'/..'); |
---|
169 | |
---|
170 | |
---|
171 | // ************************ |
---|
172 | // BackendZarafa settings |
---|
173 | // ************************ |
---|
174 | // Defines the server to which we want to connect |
---|
175 | //define('MAPI_SERVER', 'file:///var/run/zarafa'); |
---|
176 | |
---|
177 | |
---|
178 | |
---|
179 | // ************************ |
---|
180 | // BackendMaildir settings |
---|
181 | // ************************ |
---|
182 | define('MAILDIR_BASE', '/tmp'); |
---|
183 | define('MAILDIR_SUBDIR', 'Maildir'); |
---|
184 | |
---|
185 | // ********************** |
---|
186 | // BackendVCardDir settings |
---|
187 | // ********************** |
---|
188 | define('VCARDDIR_DIR', '/home/%u/.kde/share/apps/kabc/stdvcf'); |
---|
189 | |
---|
190 | |
---|
191 | /********************************************************************************** |
---|
192 | * Search provider settings |
---|
193 | * |
---|
194 | * Alternative backend to perform SEARCH requests (GAL search) |
---|
195 | * By default the main Backend defines the preferred search functionality. |
---|
196 | * If set, the Search Provider will always be preferred. |
---|
197 | * Use 'BackendSearchLDAP' to search in a LDAP directory (see backend/searchldap/config.php) |
---|
198 | */ |
---|
199 | define('SEARCH_PROVIDER', ''); |
---|
200 | // Time in seconds for the server search. Setting it too high might result in timeout. |
---|
201 | // Setting it too low might not return all results. Default is 10. |
---|
202 | define('SEARCH_WAIT', 10); |
---|
203 | // The maximum number of results to send to the client. Setting it too high |
---|
204 | // might result in timeout. Default is 10. |
---|
205 | define('SEARCH_MAXRESULTS', 10); |
---|
206 | |
---|
207 | |
---|
208 | /********************************************************************************** |
---|
209 | * Synchronize additional folders to all mobiles |
---|
210 | * |
---|
211 | * With this feature, special folders can be synchronized to all mobiles. |
---|
212 | * This is useful for e.g. global company contacts. |
---|
213 | * |
---|
214 | * This feature is supported only by certain devices, like iPhones. |
---|
215 | * Check the compatibility list for supported devices: |
---|
216 | * http://z-push.sf.net/compatibility |
---|
217 | * |
---|
218 | * To synchronize a folder, add a section setting all parameters as below: |
---|
219 | * store: the ressource where the folder is located. |
---|
220 | * Zarafa users use 'SYSTEM' for the 'Public Folder' |
---|
221 | * folderid: folder id of the folder to be synchronized |
---|
222 | * name: name to be displayed on the mobile device |
---|
223 | * type: supported types are: |
---|
224 | * SYNC_FOLDER_TYPE_USER_CONTACT |
---|
225 | * SYNC_FOLDER_TYPE_USER_APPOINTMENT |
---|
226 | * SYNC_FOLDER_TYPE_USER_TASK |
---|
227 | * SYNC_FOLDER_TYPE_USER_MAIL |
---|
228 | * |
---|
229 | * Additional notes: |
---|
230 | * - on Zarafa systems use backend/zarafa/listfolders.php script to get a list |
---|
231 | * of available folders |
---|
232 | * |
---|
233 | * - all Z-Push users must have full writing permissions (secretary rights) so |
---|
234 | * the configured folders can be synchronized to the mobile |
---|
235 | * |
---|
236 | * - this feature is only partly suitable for multi-tenancy environments, |
---|
237 | * as ALL users from ALL tenents need access to the configured store & folder. |
---|
238 | * When configuring a public folder, this will cause problems, as each user has |
---|
239 | * a different public folder in his tenant, so the folder are not available. |
---|
240 | |
---|
241 | * - changing this configuration could cause HIGH LOAD on the system, as all |
---|
242 | * connected devices will be updated and load the data contained in the |
---|
243 | * added/modified folders. |
---|
244 | */ |
---|
245 | |
---|
246 | $additionalFolders = array( |
---|
247 | // demo entry for the synchronization of contacts from the public folder. |
---|
248 | // uncomment (remove '/*' '*/') and fill in the folderid |
---|
249 | /* |
---|
250 | array( |
---|
251 | 'store' => "SYSTEM", |
---|
252 | 'folderid' => "", |
---|
253 | 'name' => "Public Contacts", |
---|
254 | 'type' => SYNC_FOLDER_TYPE_USER_CONTACT, |
---|
255 | ), |
---|
256 | */ |
---|
257 | ); |
---|
258 | |
---|
259 | $ldapConfig = parse_ini_file(EXPRESSO_PATH . '/prototype/config/OpenLDAP.srv' , true ); |
---|
260 | $ldapConfig = $ldapConfig['config']; |
---|
261 | $con = ldap_connect( $ldapConfig['host'] ); |
---|
262 | |
---|
263 | ldap_set_option( $con , LDAP_OPT_PROTOCOL_VERSION , 3 ); |
---|
264 | |
---|
265 | if( isset( $ldapConfig['user'] ) && isset( $ldapConfig['password'] ) ) |
---|
266 | ldap_bind( $con , $ldapConfig['user'], $ldapConfig['password'] ); |
---|
267 | |
---|
268 | $GLOBALS['connections']['ldap'] = $con; |
---|
269 | |
---|
270 | $dbConfig = parse_ini_file(EXPRESSO_PATH . '/prototype/config/PostgreSQL.srv' , true ); |
---|
271 | $dbConfig = $dbConfig['config']; |
---|
272 | |
---|
273 | $rs = ''; |
---|
274 | $rs .= ( isset($dbConfig['host']) && $dbConfig['host'] ) ? ' host='.$dbConfig['host'] : '' ; |
---|
275 | $rs .= ( isset($dbConfig['user']) && $dbConfig['user'] ) ? ' user='.$dbConfig['user'] : '' ; |
---|
276 | $rs .= ( isset($dbConfig['password']) && $dbConfig['password'] ) ? ' password='.$dbConfig['password'] : '' ; |
---|
277 | $rs .= ( isset($dbConfig['dbname']) && $dbConfig['dbname'] ) ? ' dbname='.$dbConfig['dbname'] : '' ; |
---|
278 | $rs .= ( isset($dbConfig['port']) && $dbConfig['port'] ) ? ' port='.$dbConfig['port'] : '' ; |
---|
279 | |
---|
280 | $GLOBALS['connections']['db'] = pg_connect( $rs ); |
---|
281 | |
---|
282 | |
---|
283 | $rs = pg_query( $GLOBALS['connections']['db'], 'SELECT * FROM phpgw_emailadmin' ); |
---|
284 | $row = pg_fetch_assoc( $rs ); |
---|
285 | |
---|
286 | // ************************ |
---|
287 | // BackendIMAP settings |
---|
288 | // ************************ |
---|
289 | // Defines the server to which we want to connect |
---|
290 | define('IMAP_SERVER', $row['imapserver']); |
---|
291 | // connecting to default port (143) |
---|
292 | define('IMAP_PORT', $row['imapport']); |
---|
293 | // best cross-platform compatibility (see http://php.net/imap_open for options) |
---|
294 | define('IMAP_OPTIONS', (isset($row['imapTLSEncryption']) && $row['imapTLSEncryption'] == 'yes' ) ? '/tls/norsh' : '/notls/norsh'); |
---|
295 | |
---|
296 | // overwrite the "from" header if it isn't set when sending emails |
---|
297 | // options: 'username' - the username will be set (usefull if your login is equal to your emailaddress) |
---|
298 | // 'domain' - the value of the "domain" field is used |
---|
299 | // '@mydomain.com' - the username is used and the given string will be appended |
---|
300 | |
---|
301 | define('IMAP_DEFAULTFROM', ''); |
---|
302 | // copy outgoing mail to this folder. If not set z-push will try the default folders |
---|
303 | define('IMAP_SENTFOLDER', 'INBOX' . $row['imapdelimiter'] . $row['imapdefaultsentfolder']); |
---|
304 | define('IMAP_TRASHFOLDER', 'INBOX' . $row['imapdelimiter'] . $row['imapdefaulttrashfolder']); |
---|
305 | define('IMAP_DRAFTFOLDER', 'INBOX' . $row['imapdelimiter'] . $row['imapdefaultdraftsfolder']); |
---|
306 | define('IMAP_SPANFOLDER', 'INBOX' . $row['imapdelimiter'] . $row['imapdefaultspamfolder']); |
---|
307 | |
---|
308 | // forward messages inline (default false - as attachment) |
---|
309 | define('IMAP_INLINE_FORWARD', false); |
---|
310 | // use imap_mail() to send emails (default) - if false mail() is used |
---|
311 | define('IMAP_USE_IMAPMAIL', true); |
---|
312 | |
---|
313 | define('CALENDAR_SYNC_SIGNED_CALENDARS', false); |
---|
314 | |
---|
315 | $rs = pg_query( $GLOBALS['connections']['db'], 'SELECT app_id FROM phpgw_applications WHERE app_name = \'zpush\'' ); |
---|
316 | $row = pg_fetch_assoc( $rs ); |
---|
317 | |
---|
318 | |
---|
319 | if(!$row) |
---|
320 | die('Modulo Z-push não Instalado'); |
---|
321 | |
---|
322 | |
---|
323 | ?> |
---|