@@ -80,7 +80,7 @@ |
||
80 | 80 | 'link_app2' => 'egw_links', |
81 | 81 | ) as $col => $table) |
82 | 82 | { |
83 | - $GLOBALS['egw_setup']->db->query("UPDATE $table SET $col='api-accounts' WHERE $col='home-accounts'", __LINE__, __FILE__); |
|
83 | + $GLOBALS['egw_setup']->db->query("update $table SET $col='api-accounts' WHERE $col='home-accounts'", __LINE__, __FILE__); |
|
84 | 84 | } |
85 | 85 | return $GLOBALS['setup_info']['api']['currentver'] = '16.1.002'; |
86 | 86 | } |
@@ -459,7 +459,7 @@ |
||
459 | 459 | * |
460 | 460 | * Forced preferences with value '' behave unexpected, false values of type "check" need to be written as "0". |
461 | 461 | * |
462 | - * @return type |
|
462 | + * @return string |
|
463 | 463 | */ |
464 | 464 | function api_upgrade17_1_003() |
465 | 465 | { |
@@ -46,7 +46,10 @@ discard block |
||
46 | 46 | { |
47 | 47 | $GLOBALS['egw_setup']->oProc->DropTable($table); |
48 | 48 | |
49 | - if (!$done++) $GLOBALS['egw_setup']->deregister_app('felamimail'); |
|
49 | + if (!$done++) |
|
50 | + { |
|
51 | + $GLOBALS['egw_setup']->deregister_app('felamimail'); |
|
52 | + } |
|
50 | 53 | } |
51 | 54 | |
52 | 55 | return $GLOBALS['setup_info']['api']['currentver'] = '16.1'; |
@@ -104,11 +107,17 @@ discard block |
||
104 | 107 | Vfs::$is_root = true; |
105 | 108 | foreach(array('','addressbook', 'calendar', 'infolog', 'tracker', 'timesheet', 'projectmanager', 'filemanager') as $app) |
106 | 109 | { |
107 | - if ($app && !file_exists(EGW_SERVER_ROOT.'/'.$app)) continue; |
|
110 | + if ($app && !file_exists(EGW_SERVER_ROOT.'/'.$app)) |
|
111 | + { |
|
112 | + continue; |
|
113 | + } |
|
108 | 114 | |
109 | 115 | // create directory and set permissions: Admins writable and other readable |
110 | 116 | $dir = '/templates'.($app ? '/'.$app : ''); |
111 | - if (Vfs::file_exists($dir)) continue; |
|
117 | + if (Vfs::file_exists($dir)) |
|
118 | + { |
|
119 | + continue; |
|
120 | + } |
|
112 | 121 | |
113 | 122 | Vfs::mkdir($dir, 075, STREAM_MKDIR_RECURSIVE); |
114 | 123 | Vfs::chgrp($dir, abs($admins)); |
@@ -297,7 +306,10 @@ discard block |
||
297 | 306 | fclose($fp); |
298 | 307 | } |
299 | 308 | } |
300 | - if (!trim($row['contact_pubkey'])) $row['contact_pubkey'] = null; |
|
309 | + if (!trim($row['contact_pubkey'])) |
|
310 | + { |
|
311 | + $row['contact_pubkey'] = null; |
|
312 | + } |
|
301 | 313 | |
302 | 314 | if ($files) |
303 | 315 | { |
@@ -432,7 +444,10 @@ discard block |
||
432 | 444 | $template_set = null; |
433 | 445 | break; |
434 | 446 | } |
435 | - if ($value !== $prefs[$attr]) error_log(__FUNCTION__."('$attr', '{$prefs[$attr]}', $owner, ...) setting $attr to ".array2string($value)); |
|
447 | + if ($value !== $prefs[$attr]) |
|
448 | + { |
|
449 | + error_log(__FUNCTION__."('$attr', '{$prefs[$attr]}', $owner, ...) setting $attr to ".array2string($value)); |
|
450 | + } |
|
436 | 451 | return $value; |
437 | 452 | }); |
438 | 453 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $tables = $GLOBALS['egw_setup']->db->table_names(true); |
26 | 26 | $phpgw_baseline = array(); |
27 | 27 | include (__DIR__.'/tables_current.inc.php'); |
28 | - foreach($phpgw_baseline as $table => $definition) |
|
28 | + foreach ($phpgw_baseline as $table => $definition) |
|
29 | 29 | { |
30 | 30 | if (!in_array($table, $tables)) |
31 | 31 | { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | // uninstall obsolete FelamiMail tables, if still around |
44 | 44 | $done = 0; |
45 | - foreach(array_intersect($tables, array('egw_felamimail_accounts', 'egw_felamimail_displayfilter', 'egw_felamimail_signatures')) as $table) |
|
45 | + foreach (array_intersect($tables, array('egw_felamimail_accounts', 'egw_felamimail_displayfilter', 'egw_felamimail_signatures')) as $table) |
|
46 | 46 | { |
47 | 47 | $GLOBALS['egw_setup']->oProc->DropTable($table); |
48 | 48 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | function api_upgrade16_1() |
61 | 61 | { |
62 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_ea_accounts','acc_folder_archive', array( |
|
62 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_ea_accounts', 'acc_folder_archive', array( |
|
63 | 63 | 'type' => 'varchar', |
64 | 64 | 'precision' => '128', |
65 | 65 | 'comment' => 'archive folder' |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | function api_upgrade16_1_001() |
77 | 77 | { |
78 | - foreach(array( |
|
78 | + foreach (array( |
|
79 | 79 | 'cf_type' => 'egw_customfields', |
80 | 80 | 'link_app1' => 'egw_links', |
81 | 81 | 'link_app2' => 'egw_links', |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | */ |
100 | 100 | function api_upgrade16_1_002() |
101 | 101 | { |
102 | - $admins = $GLOBALS['egw_setup']->add_account('Admins','Admin','Group',False,False); |
|
102 | + $admins = $GLOBALS['egw_setup']->add_account('Admins', 'Admin', 'Group', False, False); |
|
103 | 103 | |
104 | 104 | Vfs::$is_root = true; |
105 | - foreach(array('','addressbook', 'calendar', 'infolog', 'tracker', 'timesheet', 'projectmanager', 'filemanager') as $app) |
|
105 | + foreach (array('', 'addressbook', 'calendar', 'infolog', 'tracker', 'timesheet', 'projectmanager', 'filemanager') as $app) |
|
106 | 106 | { |
107 | 107 | if ($app && !file_exists(EGW_SERVER_ROOT.'/'.$app)) continue; |
108 | 108 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | function api_upgrade16_1_003() |
128 | 128 | { |
129 | 129 | $GLOBALS['egw_setup']->oProc->RenameColumn('egw_ea_accounts', 'acc_further_identities', 'further_bool'); |
130 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_ea_accounts','acc_further_identities',array( |
|
130 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_ea_accounts', 'acc_further_identities', array( |
|
131 | 131 | 'type' => 'int', |
132 | 132 | 'precision' => '1', |
133 | 133 | 'nullable' => False, |
@@ -161,19 +161,19 @@ discard block |
||
161 | 161 | $total = 0; |
162 | 162 | do { |
163 | 163 | $n = 0; |
164 | - foreach($GLOBALS['egw_setup']->db->query('SELECT fs_id,prop_namespace,prop_name,MAX(prop_id) AS prop_id |
|
164 | + foreach ($GLOBALS['egw_setup']->db->query('SELECT fs_id,prop_namespace,prop_name,MAX(prop_id) AS prop_id |
|
165 | 165 | FROM egw_sqlfs_props |
166 | 166 | GROUP BY fs_id,prop_namespace,prop_name |
167 | 167 | HAVING COUNT(*) > 1', __LINE__, __FILE__, 0, $junk_size, false, Api\Db::FETCH_ASSOC) as $row) |
168 | 168 | { |
169 | 169 | $prop_id = $row['prop_id']; |
170 | 170 | unset($row['prop_id']); |
171 | - $GLOBALS['egw_setup']->db->delete('egw_sqlfs_props', $row+array('prop_id != '.(int)$prop_id), __LINE__, __FILE__); |
|
171 | + $GLOBALS['egw_setup']->db->delete('egw_sqlfs_props', $row + array('prop_id != '.(int)$prop_id), __LINE__, __FILE__); |
|
172 | 172 | $total += $GLOBALS['egw_setup']->db->affected_rows(); |
173 | 173 | $n++; |
174 | 174 | } |
175 | 175 | } |
176 | - while($n == $junk_size); |
|
176 | + while ($n == $junk_size); |
|
177 | 177 | |
178 | 178 | if ($total) |
179 | 179 | { |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | function api_upgrade16_9() |
211 | 211 | { |
212 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_ea_credentials','cred_password',array( |
|
212 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_ea_credentials', 'cred_password', array( |
|
213 | 213 | 'type' => 'varchar', |
214 | 214 | 'precision' => '9600', |
215 | 215 | 'comment' => 'password encrypted' |
@@ -220,12 +220,12 @@ discard block |
||
220 | 220 | |
221 | 221 | function api_upgrade16_9_001() |
222 | 222 | { |
223 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_ea_accounts','acc_folder_ham',array( |
|
223 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_ea_accounts', 'acc_folder_ham', array( |
|
224 | 224 | 'type' => 'varchar', |
225 | 225 | 'precision' => '128', |
226 | 226 | 'comment' => 'ham folder' |
227 | 227 | )); |
228 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_ea_accounts','acc_spam_api',array( |
|
228 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_ea_accounts', 'acc_spam_api', array( |
|
229 | 229 | 'type' => 'varchar', |
230 | 230 | 'precision' => '128', |
231 | 231 | 'comment' => 'SpamTitan API URL' |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | */ |
243 | 243 | function api_upgrade16_9_002() |
244 | 244 | { |
245 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_addressbook','contact_files',array( |
|
245 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_addressbook', 'contact_files', array( |
|
246 | 246 | 'type' => 'int', |
247 | 247 | 'precision' => '1', |
248 | 248 | 'default' => '0', |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | Api\Vfs::$is_root = true; |
255 | 255 | do { |
256 | 256 | $n = 0; |
257 | - foreach($GLOBALS['egw_setup']->db->query("SELECT contact_id,contact_jpegphoto,contact_pubkey |
|
257 | + foreach ($GLOBALS['egw_setup']->db->query("SELECT contact_id,contact_jpegphoto,contact_pubkey |
|
258 | 258 | FROM egw_addressbook |
259 | 259 | WHERE contact_jpegphoto != '' OR contact_pubkey IS NOT NULL AND contact_pubkey LIKE '%-----%'", |
260 | 260 | __LINE__, __FILE__, 0, $junk_size, false, Api\Db::FETCH_ASSOC) as $row) |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | } |
276 | 276 | fclose($fp); |
277 | 277 | } |
278 | - foreach(array( |
|
278 | + foreach (array( |
|
279 | 279 | array(addressbook_bo::$pgp_key_regexp, Api\Contacts::FILES_PGP_PUBKEY, Api\Contacts::FILES_BIT_PGP_PUBKEY, 'application/pgp-keys'), |
280 | 280 | array(Api\Mail\Smime::$certificate_regexp, Api\Contacts::FILES_SMIME_PUBKEY, Api\Contacts::FILES_BIT_SMIME_PUBKEY, 'application/x-pem-file'), |
281 | 281 | ) as $data) |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | $n++; |
310 | 310 | } |
311 | 311 | } |
312 | - while($n == $junk_size); |
|
312 | + while ($n == $junk_size); |
|
313 | 313 | Api\Vfs::$is_root = false; |
314 | 314 | |
315 | 315 | return $GLOBALS['setup_info']['api']['currentver'] = '16.9.003'; |
@@ -322,78 +322,78 @@ discard block |
||
322 | 322 | */ |
323 | 323 | function api_upgrade16_9_003() |
324 | 324 | { |
325 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_addressbook',array( |
|
325 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_addressbook', array( |
|
326 | 326 | 'fd' => array( |
327 | - 'contact_id' => array('type' => 'auto','nullable' => False), |
|
328 | - 'contact_tid' => array('type' => 'char','precision' => '1','default' => 'n'), |
|
329 | - 'contact_owner' => array('type' => 'int','meta' => 'account','precision' => '8','nullable' => False,'comment' => 'account or group id of the adressbook'), |
|
330 | - 'contact_private' => array('type' => 'int','precision' => '1','default' => '0','comment' => 'privat or personal'), |
|
331 | - 'cat_id' => array('type' => 'ascii','meta' => 'category','precision' => '255','comment' => 'Category(s)'), |
|
332 | - 'n_family' => array('type' => 'varchar','precision' => '64','comment' => 'Family name'), |
|
333 | - 'n_given' => array('type' => 'varchar','precision' => '64','comment' => 'Given Name'), |
|
334 | - 'n_middle' => array('type' => 'varchar','precision' => '64'), |
|
335 | - 'n_prefix' => array('type' => 'varchar','precision' => '64','comment' => 'Prefix'), |
|
336 | - 'n_suffix' => array('type' => 'varchar','precision' => '64','comment' => 'Suffix'), |
|
337 | - 'n_fn' => array('type' => 'varchar','precision' => '128','comment' => 'Full name'), |
|
338 | - 'n_fileas' => array('type' => 'varchar','precision' => '255','comment' => 'sort as'), |
|
339 | - 'contact_bday' => array('type' => 'varchar','precision' => '12','comment' => 'Birtday'), |
|
340 | - 'org_name' => array('type' => 'varchar','precision' => '128','comment' => 'Organisation'), |
|
341 | - 'org_unit' => array('type' => 'varchar','precision' => '64','comment' => 'Department'), |
|
342 | - 'contact_title' => array('type' => 'varchar','precision' => '64','comment' => 'jobtittle'), |
|
343 | - 'contact_role' => array('type' => 'varchar','precision' => '64','comment' => 'role'), |
|
344 | - 'contact_assistent' => array('type' => 'varchar','precision' => '64','comment' => 'Name of the Assistent (for phone number)'), |
|
345 | - 'contact_room' => array('type' => 'varchar','precision' => '64','comment' => 'room'), |
|
346 | - 'adr_one_street' => array('type' => 'varchar','precision' => '64','comment' => 'street (business)'), |
|
347 | - 'adr_one_street2' => array('type' => 'varchar','precision' => '64','comment' => 'street (business) - 2. line'), |
|
348 | - 'adr_one_locality' => array('type' => 'varchar','precision' => '64','comment' => 'city (business)'), |
|
349 | - 'adr_one_region' => array('type' => 'varchar','precision' => '64','comment' => 'region (business)'), |
|
350 | - 'adr_one_postalcode' => array('type' => 'varchar','precision' => '64','comment' => 'postalcode (business)'), |
|
351 | - 'adr_one_countryname' => array('type' => 'varchar','precision' => '64','comment' => 'countryname (business)'), |
|
352 | - 'contact_label' => array('type' => 'text','comment' => 'currently not used'), |
|
353 | - 'adr_two_street' => array('type' => 'varchar','precision' => '64','comment' => 'street (private)'), |
|
354 | - 'adr_two_street2' => array('type' => 'varchar','precision' => '64','comment' => 'street (private) - 2. line'), |
|
355 | - 'adr_two_locality' => array('type' => 'varchar','precision' => '64','comment' => 'city (private)'), |
|
356 | - 'adr_two_region' => array('type' => 'varchar','precision' => '64','comment' => 'region (private)'), |
|
357 | - 'adr_two_postalcode' => array('type' => 'varchar','precision' => '64','comment' => 'postalcode (private)'), |
|
358 | - 'adr_two_countryname' => array('type' => 'varchar','precision' => '64','comment' => 'countryname (private)'), |
|
359 | - 'tel_work' => array('type' => 'varchar','precision' => '40','comment' => 'phone-number (business)'), |
|
360 | - 'tel_cell' => array('type' => 'varchar','precision' => '40','comment' => 'mobil phone (business)'), |
|
361 | - 'tel_fax' => array('type' => 'varchar','precision' => '40','comment' => 'fax-number (business)'), |
|
362 | - 'tel_assistent' => array('type' => 'varchar','precision' => '40','comment' => 'phone-number assistent'), |
|
363 | - 'tel_car' => array('type' => 'varchar','precision' => '40'), |
|
364 | - 'tel_pager' => array('type' => 'varchar','precision' => '40','comment' => 'pager'), |
|
365 | - 'tel_home' => array('type' => 'varchar','precision' => '40','comment' => 'phone-number (private)'), |
|
366 | - 'tel_fax_home' => array('type' => 'varchar','precision' => '40','comment' => 'fax-number (private)'), |
|
367 | - 'tel_cell_private' => array('type' => 'varchar','precision' => '40','comment' => 'mobil phone (private)'), |
|
368 | - 'tel_other' => array('type' => 'varchar','precision' => '40','comment' => 'other phone'), |
|
369 | - 'tel_prefer' => array('type' => 'varchar','precision' => '32','comment' => 'prefered phone-number'), |
|
370 | - 'contact_email' => array('type' => 'varchar','precision' => '128','comment' => 'email address (business)'), |
|
371 | - 'contact_email_home' => array('type' => 'varchar','precision' => '128','comment' => 'email address (private)'), |
|
372 | - 'contact_url' => array('type' => 'varchar','precision' => '128','comment' => 'website (business)'), |
|
373 | - 'contact_url_home' => array('type' => 'varchar','precision' => '128','comment' => 'website (private)'), |
|
374 | - 'contact_freebusy_uri' => array('type' => 'ascii','precision' => '128','comment' => 'freebusy-url for calendar of the contact'), |
|
375 | - 'contact_calendar_uri' => array('type' => 'ascii','precision' => '128','comment' => 'url for users calendar - currently not used'), |
|
376 | - 'contact_note' => array('type' => 'varchar','precision' => '8192','comment' => 'notes field'), |
|
377 | - 'contact_tz' => array('type' => 'varchar','precision' => '8','comment' => 'timezone difference'), |
|
378 | - 'contact_geo' => array('type' => 'ascii','precision' => '32','comment' => 'currently not used'), |
|
379 | - 'contact_pubkey' => array('type' => 'ascii','precision' => '16384','comment' => 'public key'), |
|
380 | - 'contact_created' => array('type' => 'int','meta' => 'timestamp','precision' => '8','comment' => 'timestamp of the creation'), |
|
381 | - 'contact_creator' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'comment' => 'account id of the creator'), |
|
382 | - 'contact_modified' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'timestamp of the last modified'), |
|
383 | - 'contact_modifier' => array('type' => 'int','meta' => 'user','precision' => '4','comment' => 'account id of the last modified'), |
|
384 | - 'account_id' => array('type' => 'int','meta' => 'user','precision' => '4','comment' => 'account id'), |
|
385 | - 'contact_etag' => array('type' => 'int','precision' => '4','default' => '0','comment' => 'etag of the changes'), |
|
386 | - 'contact_uid' => array('type' => 'ascii','precision' => '128','comment' => 'unique id of the contact'), |
|
387 | - 'adr_one_countrycode' => array('type' => 'ascii','precision' => '2','comment' => 'countrycode (business)'), |
|
388 | - 'adr_two_countrycode' => array('type' => 'ascii','precision' => '2','comment' => 'countrycode (private)'), |
|
389 | - 'carddav_name' => array('type' => 'ascii','precision' => '128','comment' => 'name part of CardDAV URL, if specified by client'), |
|
390 | - 'contact_files' => array('type' => 'int','precision' => '1','default' => '0','comment' => '&1: photo, &2: pgp, &4: smime') |
|
327 | + 'contact_id' => array('type' => 'auto', 'nullable' => False), |
|
328 | + 'contact_tid' => array('type' => 'char', 'precision' => '1', 'default' => 'n'), |
|
329 | + 'contact_owner' => array('type' => 'int', 'meta' => 'account', 'precision' => '8', 'nullable' => False, 'comment' => 'account or group id of the adressbook'), |
|
330 | + 'contact_private' => array('type' => 'int', 'precision' => '1', 'default' => '0', 'comment' => 'privat or personal'), |
|
331 | + 'cat_id' => array('type' => 'ascii', 'meta' => 'category', 'precision' => '255', 'comment' => 'Category(s)'), |
|
332 | + 'n_family' => array('type' => 'varchar', 'precision' => '64', 'comment' => 'Family name'), |
|
333 | + 'n_given' => array('type' => 'varchar', 'precision' => '64', 'comment' => 'Given Name'), |
|
334 | + 'n_middle' => array('type' => 'varchar', 'precision' => '64'), |
|
335 | + 'n_prefix' => array('type' => 'varchar', 'precision' => '64', 'comment' => 'Prefix'), |
|
336 | + 'n_suffix' => array('type' => 'varchar', 'precision' => '64', 'comment' => 'Suffix'), |
|
337 | + 'n_fn' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'Full name'), |
|
338 | + 'n_fileas' => array('type' => 'varchar', 'precision' => '255', 'comment' => 'sort as'), |
|
339 | + 'contact_bday' => array('type' => 'varchar', 'precision' => '12', 'comment' => 'Birtday'), |
|
340 | + 'org_name' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'Organisation'), |
|
341 | + 'org_unit' => array('type' => 'varchar', 'precision' => '64', 'comment' => 'Department'), |
|
342 | + 'contact_title' => array('type' => 'varchar', 'precision' => '64', 'comment' => 'jobtittle'), |
|
343 | + 'contact_role' => array('type' => 'varchar', 'precision' => '64', 'comment' => 'role'), |
|
344 | + 'contact_assistent' => array('type' => 'varchar', 'precision' => '64', 'comment' => 'Name of the Assistent (for phone number)'), |
|
345 | + 'contact_room' => array('type' => 'varchar', 'precision' => '64', 'comment' => 'room'), |
|
346 | + 'adr_one_street' => array('type' => 'varchar', 'precision' => '64', 'comment' => 'street (business)'), |
|
347 | + 'adr_one_street2' => array('type' => 'varchar', 'precision' => '64', 'comment' => 'street (business) - 2. line'), |
|
348 | + 'adr_one_locality' => array('type' => 'varchar', 'precision' => '64', 'comment' => 'city (business)'), |
|
349 | + 'adr_one_region' => array('type' => 'varchar', 'precision' => '64', 'comment' => 'region (business)'), |
|
350 | + 'adr_one_postalcode' => array('type' => 'varchar', 'precision' => '64', 'comment' => 'postalcode (business)'), |
|
351 | + 'adr_one_countryname' => array('type' => 'varchar', 'precision' => '64', 'comment' => 'countryname (business)'), |
|
352 | + 'contact_label' => array('type' => 'text', 'comment' => 'currently not used'), |
|
353 | + 'adr_two_street' => array('type' => 'varchar', 'precision' => '64', 'comment' => 'street (private)'), |
|
354 | + 'adr_two_street2' => array('type' => 'varchar', 'precision' => '64', 'comment' => 'street (private) - 2. line'), |
|
355 | + 'adr_two_locality' => array('type' => 'varchar', 'precision' => '64', 'comment' => 'city (private)'), |
|
356 | + 'adr_two_region' => array('type' => 'varchar', 'precision' => '64', 'comment' => 'region (private)'), |
|
357 | + 'adr_two_postalcode' => array('type' => 'varchar', 'precision' => '64', 'comment' => 'postalcode (private)'), |
|
358 | + 'adr_two_countryname' => array('type' => 'varchar', 'precision' => '64', 'comment' => 'countryname (private)'), |
|
359 | + 'tel_work' => array('type' => 'varchar', 'precision' => '40', 'comment' => 'phone-number (business)'), |
|
360 | + 'tel_cell' => array('type' => 'varchar', 'precision' => '40', 'comment' => 'mobil phone (business)'), |
|
361 | + 'tel_fax' => array('type' => 'varchar', 'precision' => '40', 'comment' => 'fax-number (business)'), |
|
362 | + 'tel_assistent' => array('type' => 'varchar', 'precision' => '40', 'comment' => 'phone-number assistent'), |
|
363 | + 'tel_car' => array('type' => 'varchar', 'precision' => '40'), |
|
364 | + 'tel_pager' => array('type' => 'varchar', 'precision' => '40', 'comment' => 'pager'), |
|
365 | + 'tel_home' => array('type' => 'varchar', 'precision' => '40', 'comment' => 'phone-number (private)'), |
|
366 | + 'tel_fax_home' => array('type' => 'varchar', 'precision' => '40', 'comment' => 'fax-number (private)'), |
|
367 | + 'tel_cell_private' => array('type' => 'varchar', 'precision' => '40', 'comment' => 'mobil phone (private)'), |
|
368 | + 'tel_other' => array('type' => 'varchar', 'precision' => '40', 'comment' => 'other phone'), |
|
369 | + 'tel_prefer' => array('type' => 'varchar', 'precision' => '32', 'comment' => 'prefered phone-number'), |
|
370 | + 'contact_email' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'email address (business)'), |
|
371 | + 'contact_email_home' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'email address (private)'), |
|
372 | + 'contact_url' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'website (business)'), |
|
373 | + 'contact_url_home' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'website (private)'), |
|
374 | + 'contact_freebusy_uri' => array('type' => 'ascii', 'precision' => '128', 'comment' => 'freebusy-url for calendar of the contact'), |
|
375 | + 'contact_calendar_uri' => array('type' => 'ascii', 'precision' => '128', 'comment' => 'url for users calendar - currently not used'), |
|
376 | + 'contact_note' => array('type' => 'varchar', 'precision' => '8192', 'comment' => 'notes field'), |
|
377 | + 'contact_tz' => array('type' => 'varchar', 'precision' => '8', 'comment' => 'timezone difference'), |
|
378 | + 'contact_geo' => array('type' => 'ascii', 'precision' => '32', 'comment' => 'currently not used'), |
|
379 | + 'contact_pubkey' => array('type' => 'ascii', 'precision' => '16384', 'comment' => 'public key'), |
|
380 | + 'contact_created' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'comment' => 'timestamp of the creation'), |
|
381 | + 'contact_creator' => array('type' => 'int', 'meta' => 'user', 'precision' => '4', 'nullable' => False, 'comment' => 'account id of the creator'), |
|
382 | + 'contact_modified' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False, 'comment' => 'timestamp of the last modified'), |
|
383 | + 'contact_modifier' => array('type' => 'int', 'meta' => 'user', 'precision' => '4', 'comment' => 'account id of the last modified'), |
|
384 | + 'account_id' => array('type' => 'int', 'meta' => 'user', 'precision' => '4', 'comment' => 'account id'), |
|
385 | + 'contact_etag' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'comment' => 'etag of the changes'), |
|
386 | + 'contact_uid' => array('type' => 'ascii', 'precision' => '128', 'comment' => 'unique id of the contact'), |
|
387 | + 'adr_one_countrycode' => array('type' => 'ascii', 'precision' => '2', 'comment' => 'countrycode (business)'), |
|
388 | + 'adr_two_countrycode' => array('type' => 'ascii', 'precision' => '2', 'comment' => 'countrycode (private)'), |
|
389 | + 'carddav_name' => array('type' => 'ascii', 'precision' => '128', 'comment' => 'name part of CardDAV URL, if specified by client'), |
|
390 | + 'contact_files' => array('type' => 'int', 'precision' => '1', 'default' => '0', 'comment' => '&1: photo, &2: pgp, &4: smime') |
|
391 | 391 | ), |
392 | 392 | 'pk' => array('contact_id'), |
393 | 393 | 'fk' => array(), |
394 | - 'ix' => array('contact_owner','cat_id','n_fileas','contact_modified','contact_uid','carddav_name',array('n_family','n_given'),array('n_given','n_family'),array('org_name','n_family','n_given')), |
|
394 | + 'ix' => array('contact_owner', 'cat_id', 'n_fileas', 'contact_modified', 'contact_uid', 'carddav_name', array('n_family', 'n_given'), array('n_given', 'n_family'), array('org_name', 'n_family', 'n_given')), |
|
395 | 395 | 'uc' => array('account_id') |
396 | - ),'contact_jpegphoto'); |
|
396 | + ), 'contact_jpegphoto'); |
|
397 | 397 | |
398 | 398 | return $GLOBALS['setup_info']['api']['currentver'] = '16.9.004'; |
399 | 399 | } |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | */ |
447 | 447 | function api_upgrade17_1() |
448 | 448 | { |
449 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_ea_credentials','cred_password',array( |
|
449 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_ea_credentials', 'cred_password', array( |
|
450 | 450 | 'type' => 'varchar', |
451 | 451 | 'precision' => '16384', |
452 | 452 | 'comment' => 'password encrypted' |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | */ |
461 | 461 | function api_upgrade17_1_001() |
462 | 462 | { |
463 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_history_log','share_email',array( |
|
463 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_history_log', 'share_email', array( |
|
464 | 464 | 'type' => 'varchar', |
465 | 465 | 'precision' => '4096', |
466 | 466 | 'default' => NULL, |
@@ -473,11 +473,11 @@ discard block |
||
473 | 473 | |
474 | 474 | function api_upgrade17_1_002() |
475 | 475 | { |
476 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_history_log','history_new_value',array( |
|
476 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_history_log', 'history_new_value', array( |
|
477 | 477 | 'type' => 'longtext', |
478 | 478 | 'nullable' => False |
479 | 479 | )); |
480 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_history_log','history_old_value',array( |
|
480 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_history_log', 'history_old_value', array( |
|
481 | 481 | 'type' => 'longtext', |
482 | 482 | 'nullable' => False |
483 | 483 | )); |
@@ -502,12 +502,12 @@ discard block |
||
502 | 502 | |
503 | 503 | function api_upgrade17_1_004() |
504 | 504 | { |
505 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_addressbook','contact_uid',array( |
|
505 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_addressbook', 'contact_uid', array( |
|
506 | 506 | 'type' => 'ascii', |
507 | 507 | 'precision' => '255', |
508 | 508 | 'comment' => 'unique id of the contact' |
509 | 509 | )); |
510 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_addressbook','carddav_name',array( |
|
510 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_addressbook', 'carddav_name', array( |
|
511 | 511 | 'type' => 'ascii', |
512 | 512 | 'precision' => '260', |
513 | 513 | 'comment' => 'name part of CardDAV URL, if specified by client' |
@@ -215,14 +215,20 @@ |
||
215 | 215 | $prefs->read_repository(false); |
216 | 216 | foreach(array('','addressbook', 'calendar', 'infolog', 'tracker', 'timesheet', 'projectmanager', 'filemanager') as $app) |
217 | 217 | { |
218 | - if ($app && !file_exists(EGW_SERVER_ROOT.'/'.$app)) continue; |
|
218 | + if ($app && !file_exists(EGW_SERVER_ROOT.'/'.$app)) |
|
219 | + { |
|
220 | + continue; |
|
221 | + } |
|
219 | 222 | |
220 | 223 | // create directory and set permissions: Admins writable and other readable |
221 | 224 | $dir = '/templates'.($app ? '/'.$app : ''); |
222 | 225 | Vfs::mkdir($dir, 075, STREAM_MKDIR_RECURSIVE); |
223 | 226 | Vfs::chgrp($dir, abs($admins)); |
224 | 227 | Vfs::chmod($dir, 075); |
225 | - if (!$app) continue; |
|
228 | + if (!$app) |
|
229 | + { |
|
230 | + continue; |
|
231 | + } |
|
226 | 232 | |
227 | 233 | // set default preference for app (preserving a maybe already set document-directory) |
228 | 234 | if ($prefs->default[$app]['document_dir']) |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | //$oProc->m_odb->Halt_On_Error = 'yes'; |
16 | 16 | |
17 | -foreach(array( |
|
17 | +foreach (array( |
|
18 | 18 | 'aa' => 'Afar', |
19 | 19 | 'ab' => 'Abkhazian', |
20 | 20 | 'af' => 'Afrikaans', |
@@ -155,20 +155,20 @@ discard block |
||
155 | 155 | 'zu' => 'Zulu', |
156 | 156 | ) as $id => $name) |
157 | 157 | { |
158 | - $oProc->insert($GLOBALS['egw_setup']->languages_table,array('lang_name' => $name),array('lang_id' => $id),__LINE__,__FILE__); |
|
158 | + $oProc->insert($GLOBALS['egw_setup']->languages_table, array('lang_name' => $name), array('lang_id' => $id), __LINE__, __FILE__); |
|
159 | 159 | } |
160 | 160 | |
161 | -foreach(array( |
|
161 | +foreach (array( |
|
162 | 162 | 'sessions_checkip' => 'True', |
163 | 163 | 'asyncservice' => 'fallback', |
164 | 164 | ) as $name => $value) |
165 | 165 | { |
166 | - $oProc->insert($GLOBALS['egw_setup']->config_table,array( |
|
166 | + $oProc->insert($GLOBALS['egw_setup']->config_table, array( |
|
167 | 167 | 'config_value' => $value, |
168 | - ),array( |
|
168 | + ), array( |
|
169 | 169 | 'config_app' => 'phpgwapi', |
170 | 170 | 'config_name' => $name, |
171 | - ),__LINE__,__FILE__); |
|
171 | + ), __LINE__, __FILE__); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | // make sure the required sqlfs dirs are there and have the following id's |
@@ -177,12 +177,12 @@ discard block |
||
177 | 177 | '/home' => 2, |
178 | 178 | '/apps' => 3, |
179 | 179 | ); |
180 | -foreach($dirs as $path => $id) |
|
180 | +foreach ($dirs as $path => $id) |
|
181 | 181 | { |
182 | 182 | $nrow = array( |
183 | 183 | 'fs_id' => $id, |
184 | 184 | 'fs_dir' => $path == '/' ? 0 : $dirs['/'], |
185 | - 'fs_name' => substr($path,1), |
|
185 | + 'fs_name' => substr($path, 1), |
|
186 | 186 | 'fs_mode' => 05, |
187 | 187 | 'fs_uid' => 0, |
188 | 188 | 'fs_gid' => 0, |
@@ -195,24 +195,24 @@ discard block |
||
195 | 195 | 'fs_comment' => null, |
196 | 196 | 'fs_content' => null, |
197 | 197 | ); |
198 | - $GLOBALS['egw_setup']->db->insert('egw_sqlfs',$nrow,false,__LINE__,__FILE__,'phpgwapi'); |
|
198 | + $GLOBALS['egw_setup']->db->insert('egw_sqlfs', $nrow, false, __LINE__, __FILE__, 'phpgwapi'); |
|
199 | 199 | } |
200 | 200 | // PostgreSQL seems to require to update the sequenz, after manually inserting id's |
201 | -$oProc->UpdateSequence('egw_sqlfs','fs_id'); |
|
201 | +$oProc->UpdateSequence('egw_sqlfs', 'fs_id'); |
|
202 | 202 | |
203 | 203 | // Create Addressbook for Default group, by setting a group ACL from the group to itself for all rights: add, read, edit and delete |
204 | -$defaultgroup = $GLOBALS['egw_setup']->add_account('Default','Default','Group',False,False); |
|
205 | -$GLOBALS['egw_setup']->add_acl('addressbook',$defaultgroup,$defaultgroup,1|2|4|8); |
|
204 | +$defaultgroup = $GLOBALS['egw_setup']->add_account('Default', 'Default', 'Group', False, False); |
|
205 | +$GLOBALS['egw_setup']->add_acl('addressbook', $defaultgroup, $defaultgroup, 1|2|4|8); |
|
206 | 206 | |
207 | 207 | /** |
208 | 208 | * Create template directory and set default document_dir preference of addressbook, calendar, infolog, tracker, timesheet and projectmanager |
209 | 209 | */ |
210 | -$admins = $GLOBALS['egw_setup']->add_account('Admins','Admin','Group',False,False); |
|
210 | +$admins = $GLOBALS['egw_setup']->add_account('Admins', 'Admin', 'Group', False, False); |
|
211 | 211 | |
212 | 212 | Vfs::$is_root = true; |
213 | 213 | $prefs = new Api\Preferences(); |
214 | 214 | $prefs->read_repository(false); |
215 | -foreach(array('','addressbook', 'calendar', 'infolog', 'tracker', 'timesheet', 'projectmanager', 'filemanager') as $app) |
|
215 | +foreach (array('', 'addressbook', 'calendar', 'infolog', 'tracker', 'timesheet', 'projectmanager', 'filemanager') as $app) |
|
216 | 216 | { |
217 | 217 | if ($app && !file_exists(EGW_SERVER_ROOT.'/'.$app)) continue; |
218 | 218 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | // set default preference for app (preserving a maybe already set document-directory) |
227 | 227 | if ($prefs->default[$app]['document_dir']) |
228 | 228 | { |
229 | - $existing = explode(' ',$prefs->default[$app]['document_dir']); |
|
229 | + $existing = explode(' ', $prefs->default[$app]['document_dir']); |
|
230 | 230 | $existing[] = $dir; |
231 | 231 | $dir = implode(' ', array_unique($existing)); |
232 | 232 | } |
@@ -21,4 +21,6 @@ |
||
21 | 21 | * |
22 | 22 | * @deprecated use Api\Db\Exception\InvalidSql |
23 | 23 | */ |
24 | -class egw_exception_db_invalid_sql extends Api\Db\Exception {} |
|
24 | +class egw_exception_db_invalid_sql extends Api\Db\Exception |
|
25 | +{ |
|
26 | +} |
@@ -21,4 +21,6 @@ |
||
21 | 21 | * |
22 | 22 | * @deprecated use Api\Exception\NoPermission |
23 | 23 | */ |
24 | -class egw_exception_no_permission extends Api\Exception {} |
|
24 | +class egw_exception_no_permission extends Api\Exception |
|
25 | +{ |
|
26 | +} |
@@ -21,4 +21,6 @@ |
||
21 | 21 | * |
22 | 22 | * @deprecated use Api\Db\Exception |
23 | 23 | */ |
24 | -class egw_exception_db extends Api\Exception {} |
|
24 | +class egw_exception_db extends Api\Exception |
|
25 | +{ |
|
26 | +} |
@@ -14,8 +14,14 @@ |
||
14 | 14 | use EGroupware\Api; |
15 | 15 | |
16 | 16 | // just to be sure, noone tries something nasty ... |
17 | -if (!preg_match('/^[a-z0-9_]+$/i', $_GET['app'])) die('No valid application-name given!'); |
|
18 | -if (!preg_match('/^[a-z]{2}(-[a-z]{2})?$/i', $_GET['lang'])) die('No valid lang-name given!'); |
|
17 | +if (!preg_match('/^[a-z0-9_]+$/i', $_GET['app'])) |
|
18 | +{ |
|
19 | + die('No valid application-name given!'); |
|
20 | +} |
|
21 | +if (!preg_match('/^[a-z]{2}(-[a-z]{2})?$/i', $_GET['lang'])) |
|
22 | +{ |
|
23 | + die('No valid lang-name given!'); |
|
24 | +} |
|
19 | 25 | |
20 | 26 | // switch evtl. set output-compression off, as we cant calculate a Content-Length header with transparent compression |
21 | 27 | ini_set('zlib.output_compression', 0); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | 'flags' => array( |
25 | 25 | 'currentapp' => 'api', |
26 | 26 | 'noheader' => true, |
27 | - 'load_translations' => false, // do not automatically load translations |
|
27 | + 'load_translations' => false, // do not automatically load translations |
|
28 | 28 | 'nocachecontrol' => true, |
29 | 29 | ) |
30 | 30 | ); |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | // use an etag with app, lang and a hash over the creation-times of all lang-files |
42 | -$etag = '"'.$_GET['app'].'-'.$_GET['lang'].'-'. Api\Translation::etag($_GET['app'], $_GET['lang']).'"'; |
|
42 | +$etag = '"'.$_GET['app'].'-'.$_GET['lang'].'-'.Api\Translation::etag($_GET['app'], $_GET['lang']).'"'; |
|
43 | 43 | |
44 | 44 | // headers to allow caching, we specify etag on url to force reload, even with Expires header |
45 | -Api\Session::cache_control(864000); // cache for 10 days |
|
45 | +Api\Session::cache_control(864000); // cache for 10 days |
|
46 | 46 | Header('Content-Type: text/javascript; charset=utf-8'); |
47 | 47 | Header('ETag: '.$etag); |
48 | 48 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | ', egw && egw.window !== window);'; |
67 | 67 | |
68 | 68 | // we run our own gzip compression, to set a correct Content-Length of the encoded content |
69 | -if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) |
|
69 | +if (in_array('gzip', explode(',', $_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) |
|
70 | 70 | { |
71 | 71 | $content = gzencode($content); |
72 | 72 | header('Content-Encoding: gzip'); |
@@ -84,14 +84,21 @@ discard block |
||
84 | 84 | { |
85 | 85 | $GLOBALS['egw_info']['server']['server_root'] = EGW_SERVER_ROOT; |
86 | 86 | } |
87 | -if (isset($_POST['setting'])) // Post of the header-form |
|
87 | +if (isset($_POST['setting'])) |
|
88 | 88 | { |
89 | - $validation_errors = check_header_form(); // validate the submitted form |
|
89 | + // Post of the header-form |
|
90 | +{ |
|
91 | + $validation_errors = check_header_form(); |
|
92 | +} |
|
93 | +// validate the submitted form |
|
90 | 94 | } |
91 | -if (!isset($_POST['action']) || $validation_errors) // generate form to edit the header |
|
95 | +if (!isset($_POST['action']) || $validation_errors) |
|
96 | +{ |
|
97 | + // generate form to edit the header |
|
92 | 98 | { |
93 | 99 | show_header_form($validation_errors); |
94 | 100 | } |
101 | +} |
|
95 | 102 | else |
96 | 103 | { |
97 | 104 | $newheader = $GLOBALS['egw_setup']->header->generate($GLOBALS['egw_info'],$GLOBALS['egw_domain']); |
@@ -156,7 +163,10 @@ discard block |
||
156 | 163 | // setting the non-domain settings from the posted content |
157 | 164 | foreach($_POST['setting'] as $name => $value) |
158 | 165 | { |
159 | - if (get_magic_quotes_gpc()) $value = stripslashes($value); |
|
166 | + if (get_magic_quotes_gpc()) |
|
167 | + { |
|
168 | + $value = stripslashes($value); |
|
169 | + } |
|
160 | 170 | |
161 | 171 | switch($name) |
162 | 172 | { |
@@ -166,7 +176,10 @@ discard block |
||
166 | 176 | $GLOBALS['egw_info']['server'][$name] = $value == 'True'; |
167 | 177 | break; |
168 | 178 | case 'new_admin_password': |
169 | - if ($value) $GLOBALS['egw_info']['server']['header_admin_password'] = $value; |
|
179 | + if ($value) |
|
180 | + { |
|
181 | + $GLOBALS['egw_info']['server']['header_admin_password'] = $value; |
|
182 | + } |
|
170 | 183 | break; |
171 | 184 | default: |
172 | 185 | $GLOBALS['egw_info']['server'][$name] = $value; |
@@ -186,11 +199,17 @@ discard block |
||
186 | 199 | |
187 | 200 | foreach($_POST['setting_'.$key] as $name => $value) |
188 | 201 | { |
189 | - if (get_magic_quotes_gpc()) $value = stripslashes($value); |
|
202 | + if (get_magic_quotes_gpc()) |
|
203 | + { |
|
204 | + $value = stripslashes($value); |
|
205 | + } |
|
190 | 206 | |
191 | 207 | if ($name == 'new_config_passwd') |
192 | 208 | { |
193 | - if ($value) $GLOBALS['egw_domain'][$domain]['config_passwd'] = $value; |
|
209 | + if ($value) |
|
210 | + { |
|
211 | + $GLOBALS['egw_domain'][$domain]['config_passwd'] = $value; |
|
212 | + } |
|
194 | 213 | continue; |
195 | 214 | } |
196 | 215 | $GLOBALS['egw_domain'][$domain][$name] = $value; |
@@ -255,7 +274,10 @@ discard block |
||
255 | 274 | } |
256 | 275 | $setup_tpl->set_var('js_default_db_ports',$js_default_db_ports); |
257 | 276 | |
258 | - if ($validation_errors) $setup_tpl->set_var('detected','<ul><li>'.implode("</li>\n<li>",$validation_errors)."</li>\n</ul>\n"); |
|
277 | + if ($validation_errors) |
|
278 | + { |
|
279 | + $setup_tpl->set_var('detected','<ul><li>'.implode("</li>\n<li>",$validation_errors)."</li>\n</ul>\n"); |
|
280 | + } |
|
259 | 281 | |
260 | 282 | if ($_POST['adddomain']) |
261 | 283 | { |
@@ -275,7 +297,10 @@ discard block |
||
275 | 297 | $setup_tpl->set_var($name.($GLOBALS['egw_info']['server'][$name] ? '_yes' : '_no'),' selected="selected"'); |
276 | 298 | break; |
277 | 299 | default: |
278 | - if (!is_array($value)) $setup_tpl->set_var($name,htmlspecialchars($value)); |
|
300 | + if (!is_array($value)) |
|
301 | + { |
|
302 | + $setup_tpl->set_var($name,htmlspecialchars($value)); |
|
303 | + } |
|
279 | 304 | break; |
280 | 305 | } |
281 | 306 | } |
@@ -300,10 +325,13 @@ discard block |
||
300 | 325 | $setup_tpl->set_var('db_domain',htmlspecialchars($domain)); |
301 | 326 | foreach($data as $name => $value) |
302 | 327 | { |
303 | - if ($name == 'db_port' && !$value) // Set default here if the admin didn't set a port yet |
|
328 | + if ($name == 'db_port' && !$value) |
|
329 | + { |
|
330 | + // Set default here if the admin didn't set a port yet |
|
304 | 331 | { |
305 | 332 | $value = $GLOBALS['egw_setup']->header->default_db_ports[$data['db_type']]; |
306 | 333 | } |
334 | + } |
|
307 | 335 | $setup_tpl->set_var($name,htmlspecialchars($value)); |
308 | 336 | } |
309 | 337 | $dbtype_options = ''; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | require_once('./inc/class.setup_header.inc.php'); |
19 | 19 | $GLOBALS['egw_setup']->header = new setup_header(); |
20 | 20 | |
21 | -$setup_tpl = new Framework\Template('./templates/default', 'keep'); // 'keep' to keep our {hash} prefix of passwords |
|
21 | +$setup_tpl = new Framework\Template('./templates/default', 'keep'); // 'keep' to keep our {hash} prefix of passwords |
|
22 | 22 | $setup_tpl->set_file(array( |
23 | 23 | 'T_head' => 'head.tpl', |
24 | 24 | 'T_footer' => 'footer.tpl', |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | 'T_login_stage_header' => 'login_stage_header.tpl', |
28 | 28 | 'T_setup_manage' => 'manageheader.tpl' |
29 | 29 | )); |
30 | -$setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain'); |
|
31 | -$setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain'); |
|
32 | -$setup_tpl->set_block('T_setup_manage','manageheader','manageheader'); |
|
33 | -$setup_tpl->set_block('T_setup_manage','domain','domain'); |
|
30 | +$setup_tpl->set_block('T_login_stage_header', 'B_multi_domain', 'V_multi_domain'); |
|
31 | +$setup_tpl->set_block('T_login_stage_header', 'B_single_domain', 'V_single_domain'); |
|
32 | +$setup_tpl->set_block('T_setup_manage', 'manageheader', 'manageheader'); |
|
33 | +$setup_tpl->set_block('T_setup_manage', 'domain', 'domain'); |
|
34 | 34 | |
35 | 35 | $setup_tpl->set_var(array( |
36 | 36 | 'lang_select' => '', |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | |
45 | 45 | if ($GLOBALS['egw_info']['setup']['stage']['header'] > 2 && !$GLOBALS['egw_setup']->auth('Header')) |
46 | 46 | { |
47 | - $GLOBALS['egw_setup']->html->show_header('Please login',True); |
|
47 | + $GLOBALS['egw_setup']->html->show_header('Please login', True); |
|
48 | 48 | $GLOBALS['egw_setup']->html->login_form(); |
49 | 49 | $GLOBALS['egw_setup']->html->show_footer(); |
50 | 50 | exit; |
51 | 51 | } |
52 | 52 | // Detect current mode |
53 | -switch($GLOBALS['egw_info']['setup']['stage']['header']) |
|
53 | +switch ($GLOBALS['egw_info']['setup']['stage']['header']) |
|
54 | 54 | { |
55 | 55 | case '1': |
56 | 56 | $GLOBALS['egw_info']['setup']['HeaderFormMSG'] = lang('Create your header.inc.php'); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | if (isset($_POST['setting'])) // Post of the header-form |
88 | 88 | { |
89 | - $validation_errors = check_header_form(); // validate the submitted form |
|
89 | + $validation_errors = check_header_form(); // validate the submitted form |
|
90 | 90 | } |
91 | 91 | if (!isset($_POST['action']) || $validation_errors) // generate form to edit the header |
92 | 92 | { |
@@ -94,25 +94,25 @@ discard block |
||
94 | 94 | } |
95 | 95 | else |
96 | 96 | { |
97 | - $newheader = $GLOBALS['egw_setup']->header->generate($GLOBALS['egw_info'],$GLOBALS['egw_domain']); |
|
97 | + $newheader = $GLOBALS['egw_setup']->header->generate($GLOBALS['egw_info'], $GLOBALS['egw_domain']); |
|
98 | 98 | |
99 | 99 | list($action) = @each($_POST['action']); |
100 | - switch($action) |
|
100 | + switch ($action) |
|
101 | 101 | { |
102 | 102 | case 'download': |
103 | - Api\Header\Content::type('header.inc.php','application/octet-stream'); |
|
103 | + Api\Header\Content::type('header.inc.php', 'application/octet-stream'); |
|
104 | 104 | echo $newheader; |
105 | 105 | break; |
106 | 106 | |
107 | 107 | case 'view': |
108 | 108 | $GLOBALS['egw_setup']->html->show_header('Generated header.inc.php', False, 'header'); |
109 | 109 | echo '<table width="90%"><tr><td>'; |
110 | - echo '<br />' . lang('Save this text as contents of your header.inc.php') . '<br /><hr />'; |
|
110 | + echo '<br />'.lang('Save this text as contents of your header.inc.php').'<br /><hr />'; |
|
111 | 111 | echo "<pre>\n"; |
112 | 112 | echo htmlentities($newheader); |
113 | 113 | echo "\n</pre><hr />\n"; |
114 | 114 | echo '<form action="index.php" method="post">'; |
115 | - echo '<br />' . lang('After retrieving the file, put it into place as the header.inc.php. Then, click "continue".') . '<br />'; |
|
115 | + echo '<br />'.lang('After retrieving the file, put it into place as the header.inc.php. Then, click "continue".').'<br />'; |
|
116 | 116 | echo '<input type="hidden" name="FormLogout" value="header" />'; |
117 | 117 | echo '<input type="submit" name="junk" value="'.lang('Continue').'" />'; |
118 | 118 | echo '</form>'; |
@@ -122,13 +122,13 @@ discard block |
||
122 | 122 | |
123 | 123 | case 'write': |
124 | 124 | if ((is_writeable('../header.inc.php') || !file_exists('../header.inc.php') && is_writeable('../')) && |
125 | - ($f = fopen('../header.inc.php','wb'))) |
|
125 | + ($f = fopen('../header.inc.php', 'wb'))) |
|
126 | 126 | { |
127 | - fwrite($f,$newheader); |
|
127 | + fwrite($f, $newheader); |
|
128 | 128 | fclose($f); |
129 | 129 | $GLOBALS['egw_setup']->html->show_header('Saved header.inc.php', False, 'header'); |
130 | 130 | echo '<form action="index.php" method="post">'; |
131 | - echo '<br />' . lang('Created header.inc.php!'); |
|
131 | + echo '<br />'.lang('Created header.inc.php!'); |
|
132 | 132 | echo '<input type="hidden" name="FormLogout" value="header" />'; |
133 | 133 | echo '<input type="submit" name="junk" value="'.lang('Continue').'" />'; |
134 | 134 | echo '</form>'; |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | else |
139 | 139 | { |
140 | 140 | $GLOBALS['egw_setup']->html->show_header('Error generating header.inc.php', False, 'header'); |
141 | - echo lang('Could not open header.inc.php for writing!') . '<br />' . "\n"; |
|
142 | - echo lang('Please check read/write permissions on directories, or back up and use another option.') . '<br />'; |
|
141 | + echo lang('Could not open header.inc.php for writing!').'<br />'."\n"; |
|
142 | + echo lang('Please check read/write permissions on directories, or back up and use another option.').'<br />'; |
|
143 | 143 | $GLOBALS['egw_setup']->html->show_footer(); |
144 | 144 | } |
145 | 145 | break; |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | function check_header_form() |
155 | 155 | { |
156 | 156 | // setting the non-domain settings from the posted content |
157 | - foreach($_POST['setting'] as $name => $value) |
|
157 | + foreach ($_POST['setting'] as $name => $value) |
|
158 | 158 | { |
159 | 159 | if (get_magic_quotes_gpc()) $value = stripslashes($value); |
160 | 160 | |
161 | - switch($name) |
|
161 | + switch ($name) |
|
162 | 162 | { |
163 | 163 | case 'show_domain_selectbox': |
164 | 164 | case 'mcrypt_enabled': |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | } |
176 | 176 | |
177 | 177 | // setting the domain settings from the posted content |
178 | - foreach($_POST['domains'] as $key => $domain) |
|
178 | + foreach ($_POST['domains'] as $key => $domain) |
|
179 | 179 | { |
180 | 180 | if ($_POST['deletedomain'][$key]) |
181 | 181 | { |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | continue; |
185 | 185 | } |
186 | 186 | |
187 | - foreach($_POST['setting_'.$key] as $name => $value) |
|
187 | + foreach ($_POST['setting_'.$key] as $name => $value) |
|
188 | 188 | { |
189 | 189 | if (get_magic_quotes_gpc()) $value = stripslashes($value); |
190 | 190 | |
@@ -218,20 +218,20 @@ discard block |
||
218 | 218 | |
219 | 219 | $GLOBALS['egw_setup']->html->show_header($GLOBALS['egw_info']['setup']['HeaderFormMSG'], False, 'header'); |
220 | 220 | |
221 | - if(empty($_REQUEST['ConfigLang'])) |
|
221 | + if (empty($_REQUEST['ConfigLang'])) |
|
222 | 222 | { |
223 | - $setup_tpl->set_var('lang_select','<tr><td colspan="2"><form action="manageheader.php" method="post">Please Select your language '.setup_html::lang_select(True,'en')."</form></td></tr>"); |
|
223 | + $setup_tpl->set_var('lang_select', '<tr><td colspan="2"><form action="manageheader.php" method="post">Please Select your language '.setup_html::lang_select(True, 'en')."</form></td></tr>"); |
|
224 | 224 | } |
225 | 225 | |
226 | - $setup_tpl->set_var('pagemsg',$GLOBALS['egw_info']['setup']['PageMSG']); |
|
226 | + $setup_tpl->set_var('pagemsg', $GLOBALS['egw_info']['setup']['PageMSG']); |
|
227 | 227 | |
228 | 228 | // checking required PHP version |
229 | - if ((float) PHP_VERSION < $GLOBALS['egw_setup']->required_php_version) |
|
229 | + if ((float)PHP_VERSION < $GLOBALS['egw_setup']->required_php_version) |
|
230 | 230 | { |
231 | - $GLOBALS['egw_setup']->html->show_header($GLOBALS['egw_info']['setup']['header_msg'],True); |
|
231 | + $GLOBALS['egw_setup']->html->show_header($GLOBALS['egw_info']['setup']['header_msg'], True); |
|
232 | 232 | $GLOBALS['egw_setup']->html->show_alert_msg('Error', |
233 | 233 | lang('You are using PHP version %1. EGroupware now requires %2 or later, recommended is PHP %3.', |
234 | - PHP_VERSION,$GLOBALS['egw_setup']->required_php_version,$GLOBALS['egw_setup']->recommended_php_version)); |
|
234 | + PHP_VERSION, $GLOBALS['egw_setup']->required_php_version, $GLOBALS['egw_setup']->recommended_php_version)); |
|
235 | 235 | $GLOBALS['egw_setup']->html->show_footer(); |
236 | 236 | exit; |
237 | 237 | } |
@@ -249,33 +249,33 @@ discard block |
||
249 | 249 | exit; |
250 | 250 | } |
251 | 251 | $js_default_db_ports = 'var default_db_ports = new Array();'."\n"; |
252 | - foreach($GLOBALS['egw_setup']->header->default_db_ports as $db => $port) |
|
252 | + foreach ($GLOBALS['egw_setup']->header->default_db_ports as $db => $port) |
|
253 | 253 | { |
254 | 254 | $js_default_db_ports .= ' default_db_ports["'.$db.'"]="'.$port.'";'."\n"; |
255 | 255 | } |
256 | - $setup_tpl->set_var('js_default_db_ports',$js_default_db_ports); |
|
256 | + $setup_tpl->set_var('js_default_db_ports', $js_default_db_ports); |
|
257 | 257 | |
258 | - if ($validation_errors) $setup_tpl->set_var('detected','<ul><li>'.implode("</li>\n<li>",$validation_errors)."</li>\n</ul>\n"); |
|
258 | + if ($validation_errors) $setup_tpl->set_var('detected', '<ul><li>'.implode("</li>\n<li>", $validation_errors)."</li>\n</ul>\n"); |
|
259 | 259 | |
260 | 260 | if ($_POST['adddomain']) |
261 | 261 | { |
262 | 262 | $GLOBALS['egw_domain'][lang('new')] = $GLOBALS['egw_setup']->header->domain_defaults( |
263 | 263 | $GLOBALS['egw_info']['server']['header_admin_user'], |
264 | - $GLOBALS['egw_info']['server']['header_admin_password'],$supported_db); |
|
264 | + $GLOBALS['egw_info']['server']['header_admin_password'], $supported_db); |
|
265 | 265 | } |
266 | 266 | // show the non-domain settings |
267 | 267 | //echo "<pre>".print_r($GLOBALS['egw_info']['server'],true)."</pre>\n"; |
268 | - foreach($GLOBALS['egw_info']['server'] as $name => $value) |
|
268 | + foreach ($GLOBALS['egw_info']['server'] as $name => $value) |
|
269 | 269 | { |
270 | - switch($name) |
|
270 | + switch ($name) |
|
271 | 271 | { |
272 | 272 | case 'db_persistent': |
273 | 273 | case 'show_domain_selectbox': |
274 | 274 | case 'mcrypt_enabled': |
275 | - $setup_tpl->set_var($name.($GLOBALS['egw_info']['server'][$name] ? '_yes' : '_no'),' selected="selected"'); |
|
275 | + $setup_tpl->set_var($name.($GLOBALS['egw_info']['server'][$name] ? '_yes' : '_no'), ' selected="selected"'); |
|
276 | 276 | break; |
277 | 277 | default: |
278 | - if (!is_array($value)) $setup_tpl->set_var($name,htmlspecialchars($value)); |
|
278 | + if (!is_array($value)) $setup_tpl->set_var($name, htmlspecialchars($value)); |
|
279 | 279 | break; |
280 | 280 | } |
281 | 281 | } |
@@ -284,48 +284,48 @@ discard block |
||
284 | 284 | ); |
285 | 285 | if ($GLOBALS['egw_info']['server']['session_handler'] && !isset($supported_session_handler[$GLOBALS['egw_info']['server']['session_handler']])) |
286 | 286 | { |
287 | - $supported_session_handler[$GLOBALS['egw_info']['server']['session_handler']] = lang("Custom handler: %1",$GLOBALS['egw_info']['server']['session_handler']); |
|
287 | + $supported_session_handler[$GLOBALS['egw_info']['server']['session_handler']] = lang("Custom handler: %1", $GLOBALS['egw_info']['server']['session_handler']); |
|
288 | 288 | } |
289 | 289 | $options = array(); |
290 | - foreach($supported_session_handler as $type => $label) |
|
290 | + foreach ($supported_session_handler as $type => $label) |
|
291 | 291 | { |
292 | - $options[] = '<option ' . ($type == $GLOBALS['egw_info']['server']['session_handler'] ? |
|
293 | - 'selected="selected" ' : '') . 'value="' . $type . '">' . $label . '</option>'; |
|
292 | + $options[] = '<option '.($type == $GLOBALS['egw_info']['server']['session_handler'] ? |
|
293 | + 'selected="selected" ' : '').'value="'.$type.'">'.$label.'</option>'; |
|
294 | 294 | } |
295 | - $setup_tpl->set_var('session_options',implode("\n",$options)); |
|
295 | + $setup_tpl->set_var('session_options', implode("\n", $options)); |
|
296 | 296 | |
297 | 297 | // showing the settings of all domains |
298 | - foreach($GLOBALS['egw_domain'] as $domain => $data) |
|
298 | + foreach ($GLOBALS['egw_domain'] as $domain => $data) |
|
299 | 299 | { |
300 | - $setup_tpl->set_var('db_domain',htmlspecialchars($domain)); |
|
301 | - foreach($data as $name => $value) |
|
300 | + $setup_tpl->set_var('db_domain', htmlspecialchars($domain)); |
|
301 | + foreach ($data as $name => $value) |
|
302 | 302 | { |
303 | 303 | if ($name == 'db_port' && !$value) // Set default here if the admin didn't set a port yet |
304 | 304 | { |
305 | 305 | $value = $GLOBALS['egw_setup']->header->default_db_ports[$data['db_type']]; |
306 | 306 | } |
307 | - $setup_tpl->set_var($name,htmlspecialchars($value)); |
|
307 | + $setup_tpl->set_var($name, htmlspecialchars($value)); |
|
308 | 308 | } |
309 | 309 | $dbtype_options = ''; |
310 | - foreach($supported_db as $db) |
|
310 | + foreach ($supported_db as $db) |
|
311 | 311 | { |
312 | - $dbtype_options .= '<option ' . ($db == $data['db_type'] ? 'selected="selected" ' : ''). |
|
313 | - 'value="' . $db . '">' . $GLOBALS['egw_setup']->header->db_fullnames[$db] . "</option>\n"; |
|
312 | + $dbtype_options .= '<option '.($db == $data['db_type'] ? 'selected="selected" ' : ''). |
|
313 | + 'value="'.$db.'">'.$GLOBALS['egw_setup']->header->db_fullnames[$db]."</option>\n"; |
|
314 | 314 | } |
315 | - $setup_tpl->set_var('dbtype_options',$dbtype_options); |
|
315 | + $setup_tpl->set_var('dbtype_options', $dbtype_options); |
|
316 | 316 | |
317 | - $setup_tpl->parse('domains','domain',True); |
|
317 | + $setup_tpl->parse('domains', 'domain', True); |
|
318 | 318 | } |
319 | - if(is_writeable('../header.inc.php') || !file_exists('../header.inc.php') && is_writeable('../')) |
|
319 | + if (is_writeable('../header.inc.php') || !file_exists('../header.inc.php') && is_writeable('../')) |
|
320 | 320 | { |
321 | - $setup_tpl->set_var('actions',lang('%1, %2 or %3 the configuration file.', |
|
321 | + $setup_tpl->set_var('actions', lang('%1, %2 or %3 the configuration file.', |
|
322 | 322 | '<input type="submit" name="action[write]" value="'.htmlspecialchars(lang('Write')).'" />', |
323 | 323 | '<input type="submit" name="action[download]" value="'.htmlspecialchars(lang('Download')).'" />', |
324 | 324 | '<input type="submit" name="action[view]" value="'.htmlspecialchars(lang('View')).'" />')); |
325 | 325 | } |
326 | 326 | else |
327 | 327 | { |
328 | - $setup_tpl->set_var('actions',lang('Cannot create the header.inc.php due to file permission restrictions.<br /> Instead you can %1 or %2 the file.', |
|
328 | + $setup_tpl->set_var('actions', lang('Cannot create the header.inc.php due to file permission restrictions.<br /> Instead you can %1 or %2 the file.', |
|
329 | 329 | '<input type="submit" name="action[download]" value="'.htmlspecialchars(lang('Download')).'" />', |
330 | 330 | '<input type="submit" name="action[view]" value="'.htmlspecialchars(lang('View')).'" />')); |
331 | 331 | } |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | 'lang_Yes' => lang('Yes'), |
388 | 388 | 'lang_No' => lang('No') |
389 | 389 | )); |
390 | - $setup_tpl->pfp('out','manageheader'); |
|
390 | + $setup_tpl->pfp('out', 'manageheader'); |
|
391 | 391 | |
392 | 392 | $GLOBALS['egw_setup']->html->show_footer(); |
393 | 393 | } |
@@ -23,17 +23,23 @@ discard block |
||
23 | 23 | if (!isset($config['vfs_fstab']) || $config['vfs_fstab'] == json_encode($default=array( |
24 | 24 | '/' => 'sqlfs://$host/', |
25 | 25 | '/apps' => 'links://$host/apps', |
26 | - )) || $config['vfs_fstab'] == serialize($default)) // detect old serialized value too |
|
26 | + )) || $config['vfs_fstab'] == serialize($default)) |
|
27 | + { |
|
28 | + // detect old serialized value too |
|
27 | 29 | { |
28 | 30 | $config['vfs_storage_mode'] = 'fs'; |
29 | 31 | } |
32 | + } |
|
30 | 33 | elseif($config['vfs_fstab'] == json_encode($default_db=array( |
31 | 34 | '/' => 'sqlfs://$host/?storage=db', |
32 | 35 | '/apps' => 'links://$host/apps?storage=db', |
33 | - )) || $config['vfs_fstab'] == serialize($default_db)) // detect old serialized value too |
|
36 | + )) || $config['vfs_fstab'] == serialize($default_db)) |
|
37 | + { |
|
38 | + // detect old serialized value too |
|
34 | 39 | { |
35 | 40 | $config['vfs_storage_mode'] = 'db'; |
36 | 41 | } |
42 | + } |
|
37 | 43 | else |
38 | 44 | { |
39 | 45 | $config['vfs_storage_mode'] = 'custom'; |
@@ -45,11 +51,14 @@ discard block |
||
45 | 51 | 'custom' => lang('Custom set via %1','filemanager/cli.php mount'), |
46 | 52 | ) as $name => $label) |
47 | 53 | { |
48 | - if ($name != 'custom' || $name === $config['vfs_storage_mode']) // dont show custom, if not custom |
|
54 | + if ($name != 'custom' || $name === $config['vfs_storage_mode']) |
|
55 | + { |
|
56 | + // dont show custom, if not custom |
|
49 | 57 | { |
50 | 58 | $options .= '<option value="'.$name.($name === $config['vfs_storage_mode'] ? '" selected="selected' : ''). |
51 | 59 | '">'.htmlspecialchars($label)."</options>\n"; |
52 | 60 | } |
61 | + } |
|
53 | 62 | } |
54 | 63 | //echo "<pre>".htmlspecialchars($options)."</pre>\n"; |
55 | 64 | return $options; |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | */ |
21 | 21 | function vfs_storage_mode_options($config) |
22 | 22 | { |
23 | - if (!isset($config['vfs_fstab']) || $config['vfs_fstab'] == json_encode($default=array( |
|
23 | + if (!isset($config['vfs_fstab']) || $config['vfs_fstab'] == json_encode($default = array( |
|
24 | 24 | '/' => 'sqlfs://$host/', |
25 | 25 | '/apps' => 'links://$host/apps', |
26 | 26 | )) || $config['vfs_fstab'] == serialize($default)) // detect old serialized value too |
27 | 27 | { |
28 | 28 | $config['vfs_storage_mode'] = 'fs'; |
29 | 29 | } |
30 | - elseif($config['vfs_fstab'] == json_encode($default_db=array( |
|
30 | + elseif ($config['vfs_fstab'] == json_encode($default_db = array( |
|
31 | 31 | '/' => 'sqlfs://$host/?storage=db', |
32 | 32 | '/apps' => 'links://$host/apps?storage=db', |
33 | 33 | )) || $config['vfs_fstab'] == serialize($default_db)) // detect old serialized value too |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | $config['vfs_storage_mode'] = 'custom'; |
40 | 40 | } |
41 | 41 | //_debug_array(array_intersect_key($config,array('vfs_fstab'=>1,'vfs_storage_mode'=>1))); |
42 | - foreach(array( |
|
42 | + foreach (array( |
|
43 | 43 | 'fs' => lang('Filesystem (default)'), |
44 | 44 | 'db' => lang('Database').' (problems with files > 1MB)', |
45 | - 'custom' => lang('Custom set via %1','filemanager/cli.php mount'), |
|
45 | + 'custom' => lang('Custom set via %1', 'filemanager/cli.php mount'), |
|
46 | 46 | ) as $name => $label) |
47 | 47 | { |
48 | 48 | if ($name != 'custom' || $name === $config['vfs_storage_mode']) // dont show custom, if not custom |
@@ -57,24 +57,24 @@ discard block |
||
57 | 57 | |
58 | 58 | function encryptalgo($config) |
59 | 59 | { |
60 | - if(@function_exists('mcrypt_list_algorithms')) |
|
60 | + if (@function_exists('mcrypt_list_algorithms')) |
|
61 | 61 | { |
62 | 62 | $listed = array(); |
63 | - if(!isset($config['mcrypt_algo'])) |
|
63 | + if (!isset($config['mcrypt_algo'])) |
|
64 | 64 | { |
65 | - $config['mcrypt_algo'] = 'tripledes'; /* MCRYPT_TRIPLEDES */ |
|
65 | + $config['mcrypt_algo'] = 'tripledes'; /* MCRYPT_TRIPLEDES */ |
|
66 | 66 | } |
67 | 67 | $algos = @mcrypt_list_algorithms(); |
68 | 68 | $found = False; |
69 | 69 | |
70 | 70 | $out = ''; |
71 | - while(list($key,$value) = each($algos)) |
|
71 | + while (list($key, $value) = each($algos)) |
|
72 | 72 | { |
73 | 73 | $found = True; |
74 | 74 | /* Only show each once - seems this is a problem in some installs */ |
75 | - if(!in_array($value,$listed)) |
|
75 | + if (!in_array($value, $listed)) |
|
76 | 76 | { |
77 | - if($config['mcrypt_algo'] == $value) |
|
77 | + if ($config['mcrypt_algo'] == $value) |
|
78 | 78 | { |
79 | 79 | $selected = ' selected="selected"'; |
80 | 80 | } |
@@ -84,29 +84,29 @@ discard block |
||
84 | 84 | } |
85 | 85 | $descr = strtoupper($value); |
86 | 86 | |
87 | - $out .= '<option value="' . $value . '"' . $selected . '>' . $descr . '</option>' . "\n"; |
|
87 | + $out .= '<option value="'.$value.'"'.$selected.'>'.$descr.'</option>'."\n"; |
|
88 | 88 | $listed[] = $value; |
89 | 89 | } |
90 | 90 | } |
91 | - if(!$found) |
|
91 | + if (!$found) |
|
92 | 92 | { |
93 | 93 | /* Something is wrong with their mcrypt install or php.ini */ |
94 | - $out = '<option value="">' . lang('no algorithms available') . '</option>' . "\n"; |
|
94 | + $out = '<option value="">'.lang('no algorithms available').'</option>'."\n"; |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | else |
98 | 98 | { |
99 | - $out = '<option value="tripledes">TRIPLEDES</option>' . "\n"; |
|
99 | + $out = '<option value="tripledes">TRIPLEDES</option>'."\n"; |
|
100 | 100 | } |
101 | 101 | return $out; |
102 | 102 | } |
103 | 103 | |
104 | 104 | function encryptmode($config) |
105 | 105 | { |
106 | - if(@function_exists('mcrypt_list_modes')) |
|
106 | + if (@function_exists('mcrypt_list_modes')) |
|
107 | 107 | { |
108 | 108 | $listed = array(); |
109 | - if(!isset($config['mcrypt_mode'])) |
|
109 | + if (!isset($config['mcrypt_mode'])) |
|
110 | 110 | { |
111 | 111 | $config['mcrypt_mode'] = 'cbc'; /* MCRYPT_MODE_CBC */ |
112 | 112 | } |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | $found = False; |
115 | 115 | |
116 | 116 | $out = ''; |
117 | - while(list($key,$value) = each($modes)) |
|
117 | + while (list($key, $value) = each($modes)) |
|
118 | 118 | { |
119 | 119 | $found = True; |
120 | 120 | /* Only show each once - seems this is a problem in some installs */ |
121 | - if(!in_array($value,$listed)) |
|
121 | + if (!in_array($value, $listed)) |
|
122 | 122 | { |
123 | - if($config['mcrypt_mode'] == $value) |
|
123 | + if ($config['mcrypt_mode'] == $value) |
|
124 | 124 | { |
125 | 125 | $selected = ' selected="selected"'; |
126 | 126 | } |
@@ -130,34 +130,34 @@ discard block |
||
130 | 130 | } |
131 | 131 | $descr = strtoupper($value); |
132 | 132 | |
133 | - $out .= '<option value="' . $value . '"' . $selected . '>' . $descr . '</option>' . "\n"; |
|
133 | + $out .= '<option value="'.$value.'"'.$selected.'>'.$descr.'</option>'."\n"; |
|
134 | 134 | $listed[] = $value; |
135 | 135 | } |
136 | 136 | } |
137 | - if(!$found) |
|
137 | + if (!$found) |
|
138 | 138 | { |
139 | 139 | /* Something is wrong with their mcrypt install or php.ini */ |
140 | - $out = '<option value="" selected="selected">' . lang('no modes available') . '</option>' . "\n"; |
|
140 | + $out = '<option value="" selected="selected">'.lang('no modes available').'</option>'."\n"; |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | else |
144 | 144 | { |
145 | - $out = '<option value="cbc" selected="selected">CBC</option>' . "\n"; |
|
145 | + $out = '<option value="cbc" selected="selected">CBC</option>'."\n"; |
|
146 | 146 | } |
147 | 147 | return $out; |
148 | 148 | } |
149 | 149 | |
150 | -function passwdhashes($config,$return_hashes=false) |
|
150 | +function passwdhashes($config, $return_hashes = false) |
|
151 | 151 | { |
152 | - $hashes = sql_passwdhashes($config,true); |
|
152 | + $hashes = sql_passwdhashes($config, true); |
|
153 | 153 | if (isset($hashes['crypt'])) |
154 | 154 | { |
155 | - $hashes['des'] = 'des (=crypt)'; // old LDAP name for crypt |
|
155 | + $hashes['des'] = 'des (=crypt)'; // old LDAP name for crypt |
|
156 | 156 | } |
157 | 157 | return $return_hashes ? $hashes : _options_from($hashes, $config['ldap_encryption_type'] ? $config['ldap_encryption_type'] : 'des'); |
158 | 158 | } |
159 | 159 | |
160 | -function sql_passwdhashes($config, $return_hashes=false, &$securest=null) |
|
160 | +function sql_passwdhashes($config, $return_hashes = false, &$securest = null) |
|
161 | 161 | { |
162 | 162 | $hashes = Api\Auth::passwdhashes($securest); |
163 | 163 | |
@@ -172,15 +172,15 @@ discard block |
||
172 | 172 | */ |
173 | 173 | function auth_types($config) |
174 | 174 | { |
175 | - return _options_from(setup_cmd_config::auth_types(),$config['auth_type']); |
|
175 | + return _options_from(setup_cmd_config::auth_types(), $config['auth_type']); |
|
176 | 176 | } |
177 | 177 | function auth_type_groupdav($config) |
178 | 178 | { |
179 | - return _options_from(setup_cmd_config::auth_types(),$config['auth_type_groupdav']); |
|
179 | + return _options_from(setup_cmd_config::auth_types(), $config['auth_type_groupdav']); |
|
180 | 180 | } |
181 | 181 | function auth_type_activesync($config) |
182 | 182 | { |
183 | - return _options_from(setup_cmd_config::auth_types(),$config['auth_type_activesync']); |
|
183 | + return _options_from(setup_cmd_config::auth_types(), $config['auth_type_activesync']); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
@@ -201,12 +201,12 @@ discard block |
||
201 | 201 | * @param string $selected value of selected optino |
202 | 202 | * @return string |
203 | 203 | */ |
204 | -function _options_from(array $options,$selected) |
|
204 | +function _options_from(array $options, $selected) |
|
205 | 205 | { |
206 | - foreach($options as $value => $label) |
|
206 | + foreach ($options as $value => $label) |
|
207 | 207 | { |
208 | - $out .= '<option value="' . htmlspecialchars($value) . '"' . |
|
209 | - ($selected == $value ? ' selected="selected"' : '') . '>' . $label . '</option>' . "\n"; |
|
208 | + $out .= '<option value="'.htmlspecialchars($value).'"'. |
|
209 | + ($selected == $value ? ' selected="selected"' : '').'>'.$label.'</option>'."\n"; |
|
210 | 210 | } |
211 | 211 | return $out; |
212 | 212 | } |
@@ -74,7 +74,10 @@ discard block |
||
74 | 74 | $GLOBALS['egw_info']['server']['header_admin_password'] = ''; |
75 | 75 | $GLOBALS['egw_info']['server']['setup_acl'] = ''; |
76 | 76 | |
77 | - if ($domain) $GLOBALS['egw_domain'][$domain] = $this->domain_defaults(); |
|
77 | + if ($domain) |
|
78 | + { |
|
79 | + $GLOBALS['egw_domain'][$domain] = $this->domain_defaults(); |
|
80 | + } |
|
78 | 81 | |
79 | 82 | $GLOBALS['egw_info']['server']['show_domain_selectbox'] = false; |
80 | 83 | $GLOBALS['egw_info']['server']['db_persistent'] = True; |
@@ -87,7 +90,10 @@ discard block |
||
87 | 90 | function domain_defaults($user='admin',$passwd='',$supported_db=null) |
88 | 91 | { |
89 | 92 | $null = null; |
90 | - if (is_null($supported_db)) $supported_db = $this->check_db_support($null); |
|
93 | + if (is_null($supported_db)) |
|
94 | + { |
|
95 | + $supported_db = $this->check_db_support($null); |
|
96 | + } |
|
91 | 97 | $default_db = count($supported_db) ? $supported_db[0] : 'mysqli'; |
92 | 98 | |
93 | 99 | return array( |
@@ -170,7 +176,10 @@ discard block |
||
170 | 176 | $var = array('DB_DOMAIN' => $domain); |
171 | 177 | foreach($data as $name => $value) |
172 | 178 | { |
173 | - if ($name == 'db_port' && !$value) $value = $this->default_db_ports[$data['db_type']]; |
|
179 | + if ($name == 'db_port' && !$value) |
|
180 | + { |
|
181 | + $value = $this->default_db_ports[$data['db_type']]; |
|
182 | + } |
|
174 | 183 | if ($name == 'config_passwd') |
175 | 184 | { |
176 | 185 | $var['CONFIG_PASS'] = self::is_hashed($value) ? $value : Api\Auth::encrypt_sql($value, $most_secure_pw_hash); |
@@ -188,7 +197,10 @@ discard block |
||
188 | 197 | $var = Array(); |
189 | 198 | foreach($egw_info['server'] as $name => $value) |
190 | 199 | { |
191 | - if ($name == 'header_admin_password' && $value && !self::is_hashed($value)) $value = Api\Auth::encrypt_sql($value, $most_secure_pw_hash); |
|
200 | + if ($name == 'header_admin_password' && $value && !self::is_hashed($value)) |
|
201 | + { |
|
202 | + $value = Api\Auth::encrypt_sql($value, $most_secure_pw_hash); |
|
203 | + } |
|
192 | 204 | if ($name == 'versions') |
193 | 205 | { |
194 | 206 | $name = 'mcrypt_version'; |
@@ -185,7 +185,7 @@ |
||
185 | 185 | } |
186 | 186 | $tpl->set_var('domain',''); |
187 | 187 | |
188 | - $var = Array(); |
|
188 | + $var = array(); |
|
189 | 189 | foreach($egw_info['server'] as $name => $value) |
190 | 190 | { |
191 | 191 | if ($name == 'header_admin_password' && $value && !self::is_hashed($value)) $value = Api\Auth::encrypt_sql($value, $most_secure_pw_hash); |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @param string $domain ='default' domain to set |
65 | 65 | */ |
66 | - function defaults($domain='default') |
|
66 | + function defaults($domain = 'default') |
|
67 | 67 | { |
68 | 68 | $egw_root = realpath(__DIR__.'/../..'); |
69 | 69 | $GLOBALS['egw_info']['server']['server_root'] = $GLOBALS['egw_info']['server']['include_root'] = $egw_root; |
70 | - define('EGW_SERVER_ROOT',$egw_root); // this is usally already defined by setup and cant be changed |
|
71 | - define('EGW_INCLUDE_ROOT',$egw_root); |
|
70 | + define('EGW_SERVER_ROOT', $egw_root); // this is usally already defined by setup and cant be changed |
|
71 | + define('EGW_INCLUDE_ROOT', $egw_root); |
|
72 | 72 | |
73 | 73 | $GLOBALS['egw_info']['server']['header_admin_user'] = 'admin'; |
74 | 74 | $GLOBALS['egw_info']['server']['header_admin_password'] = ''; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $GLOBALS['egw_info']['server']['mcrypt_iv'] = $this->generate_mcyrpt_iv(); |
85 | 85 | } |
86 | 86 | |
87 | - function domain_defaults($user='admin',$passwd='',$supported_db=null) |
|
87 | + function domain_defaults($user = 'admin', $passwd = '', $supported_db = null) |
|
88 | 88 | { |
89 | 89 | $null = null; |
90 | 90 | if (is_null($supported_db)) $supported_db = $this->check_db_support($null); |
@@ -109,19 +109,19 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @return array with errors or null if no errors |
111 | 111 | */ |
112 | - function validation_errors($path=EGW_SERVER_ROOT) |
|
112 | + function validation_errors($path = EGW_SERVER_ROOT) |
|
113 | 113 | { |
114 | 114 | $errors = null; |
115 | 115 | |
116 | 116 | if (!is_dir($path) || !is_readable($path) || !is_dir($path.'/api')) |
117 | 117 | { |
118 | - $errors[] = lang("%1 '%2' does NOT exist, is not readable by the webserver or contains no EGroupware installation!",lang('Server root'),$path); |
|
118 | + $errors[] = lang("%1 '%2' does NOT exist, is not readable by the webserver or contains no EGroupware installation!", lang('Server root'), $path); |
|
119 | 119 | } |
120 | - if(!$GLOBALS['egw_info']['server']['header_admin_password']) |
|
120 | + if (!$GLOBALS['egw_info']['server']['header_admin_password']) |
|
121 | 121 | { |
122 | 122 | $errors[] = lang("You didn't enter a header admin password"); |
123 | 123 | } |
124 | - if(!$GLOBALS['egw_info']['server']['header_admin_user']) |
|
124 | + if (!$GLOBALS['egw_info']['server']['header_admin_user']) |
|
125 | 125 | { |
126 | 126 | $errors[] = lang("You didn't enter a header admin username"); |
127 | 127 | } |
@@ -131,15 +131,15 @@ discard block |
||
131 | 131 | } |
132 | 132 | else |
133 | 133 | { |
134 | - foreach($GLOBALS['egw_domain'] as $domain => $data) |
|
134 | + foreach ($GLOBALS['egw_domain'] as $domain => $data) |
|
135 | 135 | { |
136 | 136 | if (!$data['config_passwd']) |
137 | 137 | { |
138 | - $errors[] = lang("You didn't enter a config password for domain %1",$domain); |
|
138 | + $errors[] = lang("You didn't enter a config password for domain %1", $domain); |
|
139 | 139 | } |
140 | - if(!$data['config_user']) |
|
140 | + if (!$data['config_user']) |
|
141 | 141 | { |
142 | - $errors[] = lang("You didn't enter a config username for domain %1",$domain); |
|
142 | + $errors[] = lang("You didn't enter a config username for domain %1", $domain); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | } |
@@ -156,19 +156,19 @@ discard block |
||
156 | 156 | * @param array $egw_domain info about the existing EGw domains / DB instances |
157 | 157 | * @return string content of header.inc.php |
158 | 158 | */ |
159 | - function generate($egw_info,$egw_domain) |
|
159 | + function generate($egw_info, $egw_domain) |
|
160 | 160 | { |
161 | - $tpl = new Framework\Template('../', 'keep'); // 'keep' to not loose '{hash}' prefix of password-hashes! |
|
161 | + $tpl = new Framework\Template('../', 'keep'); // 'keep' to not loose '{hash}' prefix of password-hashes! |
|
162 | 162 | $tpl->set_file(array('header' => 'header.inc.php.template')); |
163 | - $tpl->set_block('header','domain','domain'); |
|
163 | + $tpl->set_block('header', 'domain', 'domain'); |
|
164 | 164 | |
165 | 165 | $most_secure_pw_hash = null; |
166 | 166 | Api\Auth::passwdhashes($most_secure_pw_hash); |
167 | 167 | |
168 | - foreach($egw_domain as $domain => $data) |
|
168 | + foreach ($egw_domain as $domain => $data) |
|
169 | 169 | { |
170 | 170 | $var = array('DB_DOMAIN' => $domain); |
171 | - foreach($data as $name => $value) |
|
171 | + foreach ($data as $name => $value) |
|
172 | 172 | { |
173 | 173 | if ($name == 'db_port' && !$value) $value = $this->default_db_ports[$data['db_type']]; |
174 | 174 | if ($name == 'config_passwd') |
@@ -181,12 +181,12 @@ discard block |
||
181 | 181 | } |
182 | 182 | } |
183 | 183 | $tpl->set_var($var); |
184 | - $tpl->parse('domains','domain',True); |
|
184 | + $tpl->parse('domains', 'domain', True); |
|
185 | 185 | } |
186 | - $tpl->set_var('domain',''); |
|
186 | + $tpl->set_var('domain', ''); |
|
187 | 187 | |
188 | 188 | $var = Array(); |
189 | - foreach($egw_info['server'] as $name => $value) |
|
189 | + foreach ($egw_info['server'] as $name => $value) |
|
190 | 190 | { |
191 | 191 | if ($name == 'header_admin_password' && $value && !self::is_hashed($value)) $value = Api\Auth::encrypt_sql($value, $most_secure_pw_hash); |
192 | 192 | if ($name == 'versions') |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } |
209 | 209 | $tpl->set_var($var); |
210 | 210 | |
211 | - return $tpl->parse('out','header'); |
|
211 | + return $tpl->parse('out', 'header'); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -227,18 +227,18 @@ discard block |
||
227 | 227 | return $iv; |
228 | 228 | }*/ |
229 | 229 | $size = 30; |
230 | - srand((double)microtime()*1000000); |
|
230 | + srand((double)microtime() * 1000000); |
|
231 | 231 | $random_char = array( |
232 | - '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f', |
|
233 | - 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', |
|
234 | - 'w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L', |
|
235 | - 'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' |
|
232 | + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', |
|
233 | + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', |
|
234 | + 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', |
|
235 | + 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' |
|
236 | 236 | ); |
237 | 237 | |
238 | 238 | $iv = ''; |
239 | - for($i=0; $i < $size; $i++) |
|
239 | + for ($i = 0; $i < $size; $i++) |
|
240 | 240 | { |
241 | - $iv .= $random_char[rand(1,count($random_char))]; |
|
241 | + $iv .= $random_char[rand(1, count($random_char))]; |
|
242 | 242 | } |
243 | 243 | //error_log(__METHOD__."() size=$size returning ".array2string($iv)); |
244 | 244 | return $iv; |
@@ -247,15 +247,15 @@ discard block |
||
247 | 247 | function check_db_support(&$detected) |
248 | 248 | { |
249 | 249 | $supported_db = $detected = array(); |
250 | - foreach(array( |
|
250 | + foreach (array( |
|
251 | 251 | // short => array(extension,func_to_check,supported_db(s)) |
252 | - 'mysqli' => array('mysql','mysqli_connect','mysqli'), |
|
253 | - 'mysql' => array('mysql','mysql_connect','mysql'), |
|
254 | - 'mysqlt' => array('mysql','mysql_connect','mysqlt'), |
|
255 | - 'pgsql' => array('pgsql','pg_connect','pgsql'), |
|
256 | - 'mssql' => array('mssql','mssql_connect','mssql'), |
|
257 | - 'odbc' => array('odbc',false,'sapdb','odbc_mssql','odbc_oracle'), |
|
258 | - 'oracle' => array('oci8',false,'oracle'), |
|
252 | + 'mysqli' => array('mysql', 'mysqli_connect', 'mysqli'), |
|
253 | + 'mysql' => array('mysql', 'mysql_connect', 'mysql'), |
|
254 | + 'mysqlt' => array('mysql', 'mysql_connect', 'mysqlt'), |
|
255 | + 'pgsql' => array('pgsql', 'pg_connect', 'pgsql'), |
|
256 | + 'mssql' => array('mssql', 'mssql_connect', 'mssql'), |
|
257 | + 'odbc' => array('odbc', false, 'sapdb', 'odbc_mssql', 'odbc_oracle'), |
|
258 | + 'oracle' => array('oci8', false, 'oracle'), |
|
259 | 259 | ) as $db => $data) |
260 | 260 | { |
261 | 261 | $ext = array_shift($data); |
@@ -263,12 +263,12 @@ discard block |
||
263 | 263 | $name = isset($this->db_fullnames[$db]) ? $this->db_fullnames[$db] : strtoupper($db); |
264 | 264 | if (check_load_extension($ext) || $func_to_check && function_exists($func_to_check)) |
265 | 265 | { |
266 | - $detected[] = lang('You appear to have %1 support.',$name); |
|
267 | - $supported_db = array_merge($supported_db,$data); |
|
266 | + $detected[] = lang('You appear to have %1 support.', $name); |
|
267 | + $supported_db = array_merge($supported_db, $data); |
|
268 | 268 | } |
269 | 269 | else |
270 | 270 | { |
271 | - $detected[] .= lang('No %1 support found. Disabling',$name); |
|
271 | + $detected[] .= lang('No %1 support found. Disabling', $name); |
|
272 | 272 | } |
273 | 273 | } |
274 | 274 | return $supported_db; |
@@ -291,9 +291,9 @@ discard block |
||
291 | 291 | // some constanst for pre php4.3 |
292 | 292 | if (!defined('PHP_SHLIB_SUFFIX')) |
293 | 293 | { |
294 | - define('PHP_SHLIB_SUFFIX',strtoupper(substr(PHP_OS, 0,3)) == 'WIN' ? 'dll' : 'so'); |
|
294 | + define('PHP_SHLIB_SUFFIX', strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' ? 'dll' : 'so'); |
|
295 | 295 | } |
296 | 296 | if (!defined('PHP_SHLIB_PREFIX')) |
297 | 297 | { |
298 | - define('PHP_SHLIB_PREFIX',PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : ''); |
|
298 | + define('PHP_SHLIB_PREFIX', PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : ''); |
|
299 | 299 | } |