Passed
Push — 17.1 ( 431f3f...4dae72 )
by Ralf
01:23 queued 12s
created
emailadmin/setup/tables_current.inc.php 1 patch
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -15,96 +15,96 @@  discard block
 block discarded – undo
15 15
 $phpgw_baseline = array(
16 16
 	'egw_emailadmin' => array(
17 17
 		'fd' => array(
18
-			'ea_profile_id' => array('type' => 'auto','nullable' => False,'comment' => 'the id of the profile; in programm its used as its negative counterpart'),
19
-			'ea_smtp_server' => array('type' => 'varchar','precision' => '80','comment' => 'smtp server name or ip-address'),
20
-			'ea_smtp_type' => array('type' => 'varchar','precision' => '56','comment' => 'smtp server type; designed to specify the corresponding php class to be used/loaded'),
21
-			'ea_smtp_port' => array('type' => 'int','precision' => '4','comment' => 'port to be used'),
22
-			'ea_smtp_auth' => array('type' => 'varchar','precision' => '3','comment' => 'multistate flag to indicate authentication required'),
23
-			'ea_editforwardingaddress' => array('type' => 'varchar','precision' => '3','comment' => 'yes/no flag to indicate if a user is allowed to edit its own forwardingaddresses; server side restrictions must be met, and a suitable smtp server type selected'),
24
-			'ea_smtp_ldap_server' => array('type' => 'varchar','precision' => '80','comment' => 'unused'),
25
-			'ea_smtp_ldap_basedn' => array('type' => 'varchar','precision' => '200','comment' => 'unused'),
26
-			'ea_smtp_ldap_admindn' => array('type' => 'varchar','precision' => '200','comment' => 'unused'),
27
-			'ea_smtp_ldap_adminpw' => array('type' => 'varchar','precision' => '30','comment' => 'unused'),
28
-			'ea_smtp_ldap_use_default' => array('type' => 'varchar','precision' => '3','comment' => 'unused'),
29
-			'ea_imap_server' => array('type' => 'varchar','precision' => '80','comment' => 'imap server name or ip address'),
30
-			'ea_imap_type' => array('type' => 'varchar','precision' => '56','comment' => 'imap server type, designed to specify the corresponding mail class to be loaded/used'),
31
-			'ea_imap_port' => array('type' => 'int','precision' => '4','comment' => 'imap server port'),
32
-			'ea_imap_login_type' => array('type' => 'varchar','precision' => '20','comment' => 'logintype to be used for authentication vs. the imap server, for this profile'),
33
-			'ea_imap_tsl_auth' => array('type' => 'varchar','precision' => '3','comment' => 'flag to indicate wether to use certificate validation; only affects secure connections'),
34
-			'ea_imap_tsl_encryption' => array('type' => 'varchar','precision' => '3','comment' => 'wether to use encryption 0=none, 1=STARTTLS, 2=TLS, 3=SSL'),
35
-			'ea_imap_enable_cyrus' => array('type' => 'varchar','precision' => '3','comment' => 'flag to indicate if we have some server/system integration for account/email management'),
36
-			'ea_imap_admin_user' => array('type' => 'varchar','precision' => '40','comment' => 'use this username for authentication on administrative purposes; or timed actions (sieve) for a user'),
37
-			'ea_imap_admin_pw' => array('type' => 'varchar','precision' => '40','comment' => 'use this password for authentication on administrative purposes; or timed actions (sieve) for a user'),
38
-			'ea_imap_enable_sieve' => array('type' => 'varchar','precision' => '3','comment' => 'flag to indicate that sieve support is assumed, and may be allowed to be utilized by the users affected by this profile'),
39
-			'ea_imap_sieve_server' => array('type' => 'varchar','precision' => '80','comment' => 'sieve server name or ip-address'),
40
-			'ea_imap_sieve_port' => array('type' => 'int','precision' => '4','comment' => 'sieve server port'),
41
-			'ea_description' => array('type' => 'varchar','precision' => '200','comment' => 'textual descriptor used for readable distinction of profiles'),
42
-			'ea_default_domain' => array('type' => 'varchar','precision' => '100','comment' => 'default domain string, used when vmailmanager is used as auth type for imap (also for smtp if auth is required)'),
43
-			'ea_organisation_name' => array('type' => 'varchar','precision' => '100','comment' => 'textual organization string, may be used in mail header'),
44
-			'ea_user_defined_identities' => array('type' => 'varchar','precision' => '3','comment' => 'yes/no flag to indicate if this profile is allowing the utiliszation of user defined identities'),
45
-			'ea_user_defined_accounts' => array('type' => 'varchar','precision' => '3','comment' => 'yes/no flag to indicate if this profile is allowing the utilization of user defined mail accounts'),
46
-			'ea_order' => array('type' => 'int','precision' => '4','comment' => 'helper to define the order of the profiles'),
47
-			'ea_appname' => array('type' => 'varchar','precision' => '80','comment' => 'appname the profile is to be used for; of no practical use, as of my knowledge, was designed to allow notification to use a specific profile'),
48
-			'ea_group' => array('type' => 'varchar','precision' => '80','comment' => 'the usergroup (primary) the given profile should be applied to','meta' => 'group'),
49
-			'ea_user' => array('type' => 'varchar','precision' => '80','comment' => 'the user the given profile should be applied to','meta' => 'user'),
50
-			'ea_active' => array('type' => 'int','precision' => '4','comment' => 'flag to indicate that a profile is active'),
51
-			'ea_smtp_auth_username' => array('type' => 'varchar','precision' => '128','comment' => 'depending on smtp auth type, use this username for authentication; may hold a semicolon separated emailaddress, to specify the emailaddress to be used on sending e.g.:username;[email protected]'),
52
-			'ea_smtp_auth_password' => array('type' => 'varchar','precision' => '80','comment' => 'depending on smtp auth type, the password to be used for authentication'),
53
-			'ea_user_defined_signatures' => array('type' => 'varchar','precision' => '3','comment' => 'flag to indicate, that this profile allows its users to edit and use own signatures (rights to preferences-app needed)'),
54
-			'ea_default_signature' => array('type' => 'text','comment' => 'the default signature (text or html)'),
55
-			'ea_imap_auth_username' => array('type' => 'varchar','precision' => '80','comment' => 'depending on the imap auth type use this username for authentication purposes'),
56
-			'ea_imap_auth_password' => array('type' => 'varchar','precision' => '80','comment' => 'depending on the imap auth type use this password for authentication purposes'),
57
-			'ea_stationery_active_templates' => array('type' => 'text','comment' => 'stationery templates available for the profile')
18
+			'ea_profile_id' => array('type' => 'auto', 'nullable' => False, 'comment' => 'the id of the profile; in programm its used as its negative counterpart'),
19
+			'ea_smtp_server' => array('type' => 'varchar', 'precision' => '80', 'comment' => 'smtp server name or ip-address'),
20
+			'ea_smtp_type' => array('type' => 'varchar', 'precision' => '56', 'comment' => 'smtp server type; designed to specify the corresponding php class to be used/loaded'),
21
+			'ea_smtp_port' => array('type' => 'int', 'precision' => '4', 'comment' => 'port to be used'),
22
+			'ea_smtp_auth' => array('type' => 'varchar', 'precision' => '3', 'comment' => 'multistate flag to indicate authentication required'),
23
+			'ea_editforwardingaddress' => array('type' => 'varchar', 'precision' => '3', 'comment' => 'yes/no flag to indicate if a user is allowed to edit its own forwardingaddresses; server side restrictions must be met, and a suitable smtp server type selected'),
24
+			'ea_smtp_ldap_server' => array('type' => 'varchar', 'precision' => '80', 'comment' => 'unused'),
25
+			'ea_smtp_ldap_basedn' => array('type' => 'varchar', 'precision' => '200', 'comment' => 'unused'),
26
+			'ea_smtp_ldap_admindn' => array('type' => 'varchar', 'precision' => '200', 'comment' => 'unused'),
27
+			'ea_smtp_ldap_adminpw' => array('type' => 'varchar', 'precision' => '30', 'comment' => 'unused'),
28
+			'ea_smtp_ldap_use_default' => array('type' => 'varchar', 'precision' => '3', 'comment' => 'unused'),
29
+			'ea_imap_server' => array('type' => 'varchar', 'precision' => '80', 'comment' => 'imap server name or ip address'),
30
+			'ea_imap_type' => array('type' => 'varchar', 'precision' => '56', 'comment' => 'imap server type, designed to specify the corresponding mail class to be loaded/used'),
31
+			'ea_imap_port' => array('type' => 'int', 'precision' => '4', 'comment' => 'imap server port'),
32
+			'ea_imap_login_type' => array('type' => 'varchar', 'precision' => '20', 'comment' => 'logintype to be used for authentication vs. the imap server, for this profile'),
33
+			'ea_imap_tsl_auth' => array('type' => 'varchar', 'precision' => '3', 'comment' => 'flag to indicate wether to use certificate validation; only affects secure connections'),
34
+			'ea_imap_tsl_encryption' => array('type' => 'varchar', 'precision' => '3', 'comment' => 'wether to use encryption 0=none, 1=STARTTLS, 2=TLS, 3=SSL'),
35
+			'ea_imap_enable_cyrus' => array('type' => 'varchar', 'precision' => '3', 'comment' => 'flag to indicate if we have some server/system integration for account/email management'),
36
+			'ea_imap_admin_user' => array('type' => 'varchar', 'precision' => '40', 'comment' => 'use this username for authentication on administrative purposes; or timed actions (sieve) for a user'),
37
+			'ea_imap_admin_pw' => array('type' => 'varchar', 'precision' => '40', 'comment' => 'use this password for authentication on administrative purposes; or timed actions (sieve) for a user'),
38
+			'ea_imap_enable_sieve' => array('type' => 'varchar', 'precision' => '3', 'comment' => 'flag to indicate that sieve support is assumed, and may be allowed to be utilized by the users affected by this profile'),
39
+			'ea_imap_sieve_server' => array('type' => 'varchar', 'precision' => '80', 'comment' => 'sieve server name or ip-address'),
40
+			'ea_imap_sieve_port' => array('type' => 'int', 'precision' => '4', 'comment' => 'sieve server port'),
41
+			'ea_description' => array('type' => 'varchar', 'precision' => '200', 'comment' => 'textual descriptor used for readable distinction of profiles'),
42
+			'ea_default_domain' => array('type' => 'varchar', 'precision' => '100', 'comment' => 'default domain string, used when vmailmanager is used as auth type for imap (also for smtp if auth is required)'),
43
+			'ea_organisation_name' => array('type' => 'varchar', 'precision' => '100', 'comment' => 'textual organization string, may be used in mail header'),
44
+			'ea_user_defined_identities' => array('type' => 'varchar', 'precision' => '3', 'comment' => 'yes/no flag to indicate if this profile is allowing the utiliszation of user defined identities'),
45
+			'ea_user_defined_accounts' => array('type' => 'varchar', 'precision' => '3', 'comment' => 'yes/no flag to indicate if this profile is allowing the utilization of user defined mail accounts'),
46
+			'ea_order' => array('type' => 'int', 'precision' => '4', 'comment' => 'helper to define the order of the profiles'),
47
+			'ea_appname' => array('type' => 'varchar', 'precision' => '80', 'comment' => 'appname the profile is to be used for; of no practical use, as of my knowledge, was designed to allow notification to use a specific profile'),
48
+			'ea_group' => array('type' => 'varchar', 'precision' => '80', 'comment' => 'the usergroup (primary) the given profile should be applied to', 'meta' => 'group'),
49
+			'ea_user' => array('type' => 'varchar', 'precision' => '80', 'comment' => 'the user the given profile should be applied to', 'meta' => 'user'),
50
+			'ea_active' => array('type' => 'int', 'precision' => '4', 'comment' => 'flag to indicate that a profile is active'),
51
+			'ea_smtp_auth_username' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'depending on smtp auth type, use this username for authentication; may hold a semicolon separated emailaddress, to specify the emailaddress to be used on sending e.g.:username;[email protected]'),
52
+			'ea_smtp_auth_password' => array('type' => 'varchar', 'precision' => '80', 'comment' => 'depending on smtp auth type, the password to be used for authentication'),
53
+			'ea_user_defined_signatures' => array('type' => 'varchar', 'precision' => '3', 'comment' => 'flag to indicate, that this profile allows its users to edit and use own signatures (rights to preferences-app needed)'),
54
+			'ea_default_signature' => array('type' => 'text', 'comment' => 'the default signature (text or html)'),
55
+			'ea_imap_auth_username' => array('type' => 'varchar', 'precision' => '80', 'comment' => 'depending on the imap auth type use this username for authentication purposes'),
56
+			'ea_imap_auth_password' => array('type' => 'varchar', 'precision' => '80', 'comment' => 'depending on the imap auth type use this password for authentication purposes'),
57
+			'ea_stationery_active_templates' => array('type' => 'text', 'comment' => 'stationery templates available for the profile')
58 58
 		),
59 59
 		'pk' => array('ea_profile_id'),
60 60
 		'fk' => array(),
61
-		'ix' => array('ea_appname','ea_group'),
61
+		'ix' => array('ea_appname', 'ea_group'),
62 62
 		'uc' => array()
63 63
 	),
64 64
 	'egw_mailaccounts' => array(
65 65
 		'fd' => array(
66
-			'mail_id' => array('type' => 'auto','nullable' => False,'comment' => 'the id'),
67
-			'account_id' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False,'comment' => 'account id of the owner, can be user AND group'),
68
-			'mail_type' => array('type' => 'int','precision' => '1','nullable' => False,'comment' => '0=active, 1=alias, 2=forward, 3=forwardOnly, 4=quota'),
69
-			'mail_value' => array('type' => 'ascii','precision' => '128','nullable' => False,'comment' => 'the value (that should be) corresponding to the mail_type')
66
+			'mail_id' => array('type' => 'auto', 'nullable' => False, 'comment' => 'the id'),
67
+			'account_id' => array('type' => 'int', 'meta' => 'account', 'precision' => '4', 'nullable' => False, 'comment' => 'account id of the owner, can be user AND group'),
68
+			'mail_type' => array('type' => 'int', 'precision' => '1', 'nullable' => False, 'comment' => '0=active, 1=alias, 2=forward, 3=forwardOnly, 4=quota'),
69
+			'mail_value' => array('type' => 'ascii', 'precision' => '128', 'nullable' => False, 'comment' => 'the value (that should be) corresponding to the mail_type')
70 70
 		),
71 71
 		'pk' => array('mail_id'),
72 72
 		'fk' => array(),
73
-		'ix' => array('mail_value',array('account_id','mail_type')),
73
+		'ix' => array('mail_value', array('account_id', 'mail_type')),
74 74
 		'uc' => array()
75 75
 	),
76 76
 	'egw_ea_accounts' => array(
77 77
 		'fd' => array(
78
-			'acc_id' => array('type' => 'auto','nullable' => False),
79
-			'acc_name' => array('type' => 'varchar','precision' => '80','comment' => 'description'),
80
-			'ident_id' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'standard identity'),
81
-			'acc_imap_host' => array('type' => 'ascii','precision' => '128','nullable' => False,'comment' => 'imap hostname'),
82
-			'acc_imap_ssl' => array('type' => 'int','precision' => '1','nullable' => False,'default' => '0','comment' => '0=none, 1=starttls, 2=tls, 3=ssl, &8=validate certificate'),
83
-			'acc_imap_port' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '143','comment' => 'imap port'),
84
-			'acc_sieve_enabled' => array('type' => 'bool','default' => '0','comment' => 'sieve enabled'),
85
-			'acc_sieve_host' => array('type' => 'ascii','precision' => '128','comment' => 'sieve host, default imap_host'),
86
-			'acc_sieve_port' => array('type' => 'int','precision' => '4','default' => '4190'),
87
-			'acc_folder_sent' => array('type' => 'varchar','precision' => '128','comment' => 'sent folder'),
88
-			'acc_folder_trash' => array('type' => 'varchar','precision' => '128','comment' => 'trash folder'),
89
-			'acc_folder_draft' => array('type' => 'varchar','precision' => '128','comment' => 'draft folder'),
90
-			'acc_folder_template' => array('type' => 'varchar','precision' => '128','comment' => 'template folder'),
91
-			'acc_smtp_host' => array('type' => 'varchar','precision' => '128','comment' => 'smtp hostname'),
92
-			'acc_smtp_ssl' => array('type' => 'int','precision' => '1','nullable' => False,'default' => '0','comment' => '0=none, 1=starttls, 2=tls, 3=ssl, &8=validate certificate'),
93
-			'acc_smtp_port' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '25','comment' => 'smtp port'),
94
-			'acc_smtp_type' => array('type' => 'ascii','precision' => '32','default' => 'emailadmin_smtp','comment' => 'smtp class to use'),
95
-			'acc_imap_type' => array('type' => 'ascii','precision' => '32','default' => 'emailadmin_imap','comment' => 'imap class to use'),
96
-			'acc_imap_logintype' => array('type' => 'ascii','precision' => '20','comment' => 'standard, vmailmgr, admin, uidNumber'),
97
-			'acc_domain' => array('type' => 'varchar','precision' => '100','comment' => 'domain name'),
98
-			'acc_further_identities' => array('type' => 'bool','nullable' => False,'default' => '1','comment' => '0=no, 1=yes'),
99
-			'acc_user_editable' => array('type' => 'bool','nullable' => False,'default' => '1','comment' => '0=no, 1=yes'),
100
-			'acc_sieve_ssl' => array('type' => 'int','precision' => '1','default' => '1','comment' => '0=none, 1=starttls, 2=tls, 3=ssl, &8=validate certificate'),
101
-			'acc_modified' => array('type' => 'timestamp','nullable' => False,'default' => 'current_timestamp'),
102
-			'acc_modifier' => array('type' => 'int','meta' => 'user','precision' => '4'),
103
-			'acc_smtp_auth_session' => array('type' => 'bool','comment' => '0=no, 1=yes, use username/pw from current user'),
104
-			'acc_folder_junk' => array('type' => 'varchar','precision' => '128','comment' => 'junk folder'),
105
-			'acc_imap_default_quota' => array('type' => 'int','precision' => '4','comment' => 'default quota, if no user specific one set'),
106
-			'acc_imap_timeout' => array('type' => 'int','precision' => '2','comment' => 'timeout for imap connection'),
107
-			'acc_user_forward' => array('type' => 'bool','default' => '0','comment' => 'allow user to define forwards')
78
+			'acc_id' => array('type' => 'auto', 'nullable' => False),
79
+			'acc_name' => array('type' => 'varchar', 'precision' => '80', 'comment' => 'description'),
80
+			'ident_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'standard identity'),
81
+			'acc_imap_host' => array('type' => 'ascii', 'precision' => '128', 'nullable' => False, 'comment' => 'imap hostname'),
82
+			'acc_imap_ssl' => array('type' => 'int', 'precision' => '1', 'nullable' => False, 'default' => '0', 'comment' => '0=none, 1=starttls, 2=tls, 3=ssl, &8=validate certificate'),
83
+			'acc_imap_port' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '143', 'comment' => 'imap port'),
84
+			'acc_sieve_enabled' => array('type' => 'bool', 'default' => '0', 'comment' => 'sieve enabled'),
85
+			'acc_sieve_host' => array('type' => 'ascii', 'precision' => '128', 'comment' => 'sieve host, default imap_host'),
86
+			'acc_sieve_port' => array('type' => 'int', 'precision' => '4', 'default' => '4190'),
87
+			'acc_folder_sent' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'sent folder'),
88
+			'acc_folder_trash' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'trash folder'),
89
+			'acc_folder_draft' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'draft folder'),
90
+			'acc_folder_template' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'template folder'),
91
+			'acc_smtp_host' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'smtp hostname'),
92
+			'acc_smtp_ssl' => array('type' => 'int', 'precision' => '1', 'nullable' => False, 'default' => '0', 'comment' => '0=none, 1=starttls, 2=tls, 3=ssl, &8=validate certificate'),
93
+			'acc_smtp_port' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '25', 'comment' => 'smtp port'),
94
+			'acc_smtp_type' => array('type' => 'ascii', 'precision' => '32', 'default' => 'emailadmin_smtp', 'comment' => 'smtp class to use'),
95
+			'acc_imap_type' => array('type' => 'ascii', 'precision' => '32', 'default' => 'emailadmin_imap', 'comment' => 'imap class to use'),
96
+			'acc_imap_logintype' => array('type' => 'ascii', 'precision' => '20', 'comment' => 'standard, vmailmgr, admin, uidNumber'),
97
+			'acc_domain' => array('type' => 'varchar', 'precision' => '100', 'comment' => 'domain name'),
98
+			'acc_further_identities' => array('type' => 'bool', 'nullable' => False, 'default' => '1', 'comment' => '0=no, 1=yes'),
99
+			'acc_user_editable' => array('type' => 'bool', 'nullable' => False, 'default' => '1', 'comment' => '0=no, 1=yes'),
100
+			'acc_sieve_ssl' => array('type' => 'int', 'precision' => '1', 'default' => '1', 'comment' => '0=none, 1=starttls, 2=tls, 3=ssl, &8=validate certificate'),
101
+			'acc_modified' => array('type' => 'timestamp', 'nullable' => False, 'default' => 'current_timestamp'),
102
+			'acc_modifier' => array('type' => 'int', 'meta' => 'user', 'precision' => '4'),
103
+			'acc_smtp_auth_session' => array('type' => 'bool', 'comment' => '0=no, 1=yes, use username/pw from current user'),
104
+			'acc_folder_junk' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'junk folder'),
105
+			'acc_imap_default_quota' => array('type' => 'int', 'precision' => '4', 'comment' => 'default quota, if no user specific one set'),
106
+			'acc_imap_timeout' => array('type' => 'int', 'precision' => '2', 'comment' => 'timeout for imap connection'),
107
+			'acc_user_forward' => array('type' => 'bool', 'default' => '0', 'comment' => 'allow user to define forwards')
108 108
 		),
109 109
 		'pk' => array('acc_id'),
110 110
 		'fk' => array(),
@@ -113,29 +113,29 @@  discard block
 block discarded – undo
113 113
 	),
114 114
 	'egw_ea_credentials' => array(
115 115
 		'fd' => array(
116
-			'cred_id' => array('type' => 'auto','nullable' => False),
117
-			'acc_id' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'into egw_ea_accounts'),
118
-			'cred_type' => array('type' => 'int','precision' => '1','nullable' => False,'comment' => '&1=imap, &2=smtp, &4=admin'),
119
-			'account_id' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'comment' => 'account_id or 0=all'),
120
-			'cred_username' => array('type' => 'varchar','precision' => '80','nullable' => False,'comment' => 'username'),
121
-			'cred_password' => array('type' => 'varchar','precision' => '80','comment' => 'password encrypted'),
122
-			'cred_pw_enc' => array('type' => 'int','precision' => '1','default' => '0','comment' => '0=not, 1=user pw, 2=system')
116
+			'cred_id' => array('type' => 'auto', 'nullable' => False),
117
+			'acc_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'into egw_ea_accounts'),
118
+			'cred_type' => array('type' => 'int', 'precision' => '1', 'nullable' => False, 'comment' => '&1=imap, &2=smtp, &4=admin'),
119
+			'account_id' => array('type' => 'int', 'meta' => 'user', 'precision' => '4', 'nullable' => False, 'comment' => 'account_id or 0=all'),
120
+			'cred_username' => array('type' => 'varchar', 'precision' => '80', 'nullable' => False, 'comment' => 'username'),
121
+			'cred_password' => array('type' => 'varchar', 'precision' => '80', 'comment' => 'password encrypted'),
122
+			'cred_pw_enc' => array('type' => 'int', 'precision' => '1', 'default' => '0', 'comment' => '0=not, 1=user pw, 2=system')
123 123
 		),
124 124
 		'pk' => array('cred_id'),
125 125
 		'fk' => array(),
126 126
 		'ix' => array(),
127
-		'uc' => array(array('acc_id','account_id','cred_type'))
127
+		'uc' => array(array('acc_id', 'account_id', 'cred_type'))
128 128
 	),
129 129
 	'egw_ea_identities' => array(
130 130
 		'fd' => array(
131
-			'ident_id' => array('type' => 'auto','nullable' => False),
132
-			'acc_id' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'for which account'),
133
-			'ident_realname' => array('type' => 'varchar','precision' => '128','nullable' => False,'comment' => 'real name'),
134
-			'ident_email' => array('type' => 'varchar','precision' => '128','comment' => 'email address'),
135
-			'ident_org' => array('type' => 'varchar','precision' => '128','comment' => 'organisation'),
136
-			'ident_signature' => array('type' => 'text','comment' => 'signature text'),
137
-			'account_id' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False,'default' => '0','comment' => '0=all users of give mail account'),
138
-			'ident_name' => array('type' => 'varchar','precision' => '128','comment' => 'name of identity to display')
131
+			'ident_id' => array('type' => 'auto', 'nullable' => False),
132
+			'acc_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'for which account'),
133
+			'ident_realname' => array('type' => 'varchar', 'precision' => '128', 'nullable' => False, 'comment' => 'real name'),
134
+			'ident_email' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'email address'),
135
+			'ident_org' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'organisation'),
136
+			'ident_signature' => array('type' => 'text', 'comment' => 'signature text'),
137
+			'account_id' => array('type' => 'int', 'meta' => 'account', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => '0=all users of give mail account'),
138
+			'ident_name' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'name of identity to display')
139 139
 		),
140 140
 		'pk' => array('ident_id'),
141 141
 		'fk' => array(),
@@ -144,24 +144,24 @@  discard block
 block discarded – undo
144 144
 	),
145 145
 	'egw_ea_valid' => array(
146 146
 		'fd' => array(
147
-			'acc_id' => array('type' => 'int','precision' => '4','nullable' => False),
148
-			'account_id' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False)
147
+			'acc_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
148
+			'account_id' => array('type' => 'int', 'meta' => 'account', 'precision' => '4', 'nullable' => False)
149 149
 		),
150 150
 		'pk' => array(),
151 151
 		'fk' => array(),
152
-		'ix' => array(array('account_id','acc_id')),
153
-		'uc' => array(array('acc_id','account_id'))
152
+		'ix' => array(array('account_id', 'acc_id')),
153
+		'uc' => array(array('acc_id', 'account_id'))
154 154
 	),
155 155
 	'egw_ea_notifications' => array(
156 156
 		'fd' => array(
157
-			'notif_id' => array('type' => 'auto','nullable' => False),
158
-			'acc_id' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'mail account'),
159
-			'account_id' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'comment' => 'user account'),
160
-			'notif_folder' => array('type' => 'varchar','precision' => '255','nullable' => False,'comment' => 'folder name')
157
+			'notif_id' => array('type' => 'auto', 'nullable' => False),
158
+			'acc_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'mail account'),
159
+			'account_id' => array('type' => 'int', 'meta' => 'user', 'precision' => '4', 'nullable' => False, 'comment' => 'user account'),
160
+			'notif_folder' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'comment' => 'folder name')
161 161
 		),
162 162
 		'pk' => array('notif_id'),
163 163
 		'fk' => array(),
164
-		'ix' => array(array('account_id','acc_id')),
164
+		'ix' => array(array('account_id', 'acc_id')),
165 165
 		'uc' => array()
166 166
 	)
167 167
 );
Please login to merge, or discard this patch.
emailadmin/setup/tables_update.inc.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -214,12 +214,12 @@
 block discarded – undo
214 214
 
215 215
 function emailadmin_upgrade1_4_001()
216 216
 {
217
-    $GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin','ea_user_defined_identities',array(
218
-        'type' => 'varchar',
219
-        'precision' => '3'
220
-    ));
217
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin','ea_user_defined_identities',array(
218
+		'type' => 'varchar',
219
+		'precision' => '3'
220
+	));
221 221
 
222
-    return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.5.001';
222
+	return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.5.001';
223 223
 }
224 224
 
225 225
 
Please login to merge, or discard this patch.
Spacing   +227 added lines, -227 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 function emailadmin_upgrade0_0_3()
16 16
 {
17
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin','smtpType', array('type' => 'int', 'precision' => 4));
17
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin', 'smtpType', array('type' => 'int', 'precision' => 4));
18 18
 
19 19
 	return $setup_info['emailadmin']['currentver'] = '0.0.4';
20 20
 }
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
 function emailadmin_upgrade0_0_4()
24 24
 {
25
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin','defaultDomain', array('type' => 'varchar', 'precision' => 100));
25
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin', 'defaultDomain', array('type' => 'varchar', 'precision' => 100));
26 26
 
27 27
 	return $setup_info['emailadmin']['currentver'] = '0.0.5';
28 28
 }
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 
31 31
 function emailadmin_upgrade0_0_5()
32 32
 {
33
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin','organisationName', array('type' => 'varchar', 'precision' => 100));
34
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin','userDefinedAccounts', array('type' => 'varchar', 'precision' => 3));
33
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin', 'organisationName', array('type' => 'varchar', 'precision' => 100));
34
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin', 'userDefinedAccounts', array('type' => 'varchar', 'precision' => 3));
35 35
 
36 36
 	return $setup_info['emailadmin']['currentver'] = '0.0.6';
37 37
 }
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
 function emailadmin_upgrade0_0_6()
41 41
 {
42
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin','oldimapcclient',array(
42
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin', 'oldimapcclient', array(
43 43
 		'type' => 'varchar',
44 44
 		'precision' => '3'
45 45
 	));
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
 function emailadmin_upgrade0_0_007()
52 52
 {
53
-	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_emailadmin','oldimapcclient','imapoldcclient');
53
+	$GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_emailadmin', 'oldimapcclient', 'imapoldcclient');
54 54
 
55 55
 	return $GLOBALS['setup_info']['emailadmin']['currentver'] = '0.0.008';
56 56
 }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
 function emailadmin_upgrade1_0_0()
66 66
 {
67
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin','editforwardingaddress',array(
67
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin', 'editforwardingaddress', array(
68 68
 		'type' => 'varchar',
69 69
 		'precision' => '3'
70 70
 	));
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 
76 76
 function emailadmin_upgrade1_0_1()
77 77
 {
78
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin','ea_order', array('type' => 'int', 'precision' => 4));
78
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin', 'ea_order', array('type' => 'int', 'precision' => 4));
79 79
 
80 80
 	return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.0.2';
81 81
 }
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
 
84 84
 function emailadmin_upgrade1_0_2()
85 85
 {
86
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin','ea_appname', array('type' => 'varchar','precision' => '80'));
87
-	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin','ea_group', array('type' => 'varchar','precision' => '80'));
86
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin', 'ea_appname', array('type' => 'varchar', 'precision' => '80'));
87
+	$GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin', 'ea_group', array('type' => 'varchar', 'precision' => '80'));
88 88
 
89 89
 	return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.0.3';
90 90
 }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
 function emailadmin_upgrade1_0_3()
94 94
 {
95
-	$GLOBALS['egw_setup']->oProc->RenameTable('phpgw_emailadmin','egw_emailadmin');
95
+	$GLOBALS['egw_setup']->oProc->RenameTable('phpgw_emailadmin', 'egw_emailadmin');
96 96
 
97 97
 	return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.2';
98 98
 }
@@ -100,34 +100,34 @@  discard block
 block discarded – undo
100 100
 
101 101
 function emailadmin_upgrade1_2()
102 102
 {
103
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','profileID','ea_profile_id');
104
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','smtpServer','ea_smtp_server');
105
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','smtpType','ea_smtp_type');
106
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','smtpPort','ea_smtp_port');
107
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','smtpAuth','ea_smtp_auth');
108
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','editforwardingaddress','ea_editforwardingaddress');
109
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','smtpLDAPServer','ea_smtp_ldap_server');
110
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','smtpLDAPBaseDN','ea_smtp_ldap_basedn');
111
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','smtpLDAPAdminDN','ea_smtp_ldap_admindn');
112
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','smtpLDAPAdminPW','ea_smtp_ldap_adminpw');
113
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','smtpLDAPUseDefault','ea_smtp_ldap_use_default');
114
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapServer','ea_imap_server');
115
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapType','ea_imap_type');
116
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapPort','ea_imap_port');
117
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapLoginType','ea_imap_login_type');
118
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapTLSAuthentication','ea_imap_tsl_auth');
119
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapTLSEncryption','ea_imap_tsl_encryption');
120
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapEnableCyrusAdmin','ea_imap_enable_cyrus');
121
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapAdminUsername','ea_imap_admin_user');
122
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapAdminPW','ea_imap_admin_pw');
123
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapEnableSieve','ea_imap_enable_sieve');
124
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapSieveServer','ea_imap_sieve_server');
125
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapSievePort','ea_imap_sieve_port');
126
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','description','ea_description');
127
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','defaultDomain','ea_default_domain');
128
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','organisationName','ea_organisation_name');
129
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','userDefinedAccounts','ea_user_defined_accounts');
130
-	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapoldcclient','ea_imapoldcclient');
103
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'profileID', 'ea_profile_id');
104
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'smtpServer', 'ea_smtp_server');
105
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'smtpType', 'ea_smtp_type');
106
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'smtpPort', 'ea_smtp_port');
107
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'smtpAuth', 'ea_smtp_auth');
108
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'editforwardingaddress', 'ea_editforwardingaddress');
109
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'smtpLDAPServer', 'ea_smtp_ldap_server');
110
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'smtpLDAPBaseDN', 'ea_smtp_ldap_basedn');
111
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'smtpLDAPAdminDN', 'ea_smtp_ldap_admindn');
112
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'smtpLDAPAdminPW', 'ea_smtp_ldap_adminpw');
113
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'smtpLDAPUseDefault', 'ea_smtp_ldap_use_default');
114
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'imapServer', 'ea_imap_server');
115
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'imapType', 'ea_imap_type');
116
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'imapPort', 'ea_imap_port');
117
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'imapLoginType', 'ea_imap_login_type');
118
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'imapTLSAuthentication', 'ea_imap_tsl_auth');
119
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'imapTLSEncryption', 'ea_imap_tsl_encryption');
120
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'imapEnableCyrusAdmin', 'ea_imap_enable_cyrus');
121
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'imapAdminUsername', 'ea_imap_admin_user');
122
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'imapAdminPW', 'ea_imap_admin_pw');
123
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'imapEnableSieve', 'ea_imap_enable_sieve');
124
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'imapSieveServer', 'ea_imap_sieve_server');
125
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'imapSievePort', 'ea_imap_sieve_port');
126
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'description', 'ea_description');
127
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'defaultDomain', 'ea_default_domain');
128
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'organisationName', 'ea_organisation_name');
129
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'userDefinedAccounts', 'ea_user_defined_accounts');
130
+	$GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin', 'imapoldcclient', 'ea_imapoldcclient');
131 131
 
132 132
 	return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.2.001';
133 133
 }
@@ -145,45 +145,45 @@  discard block
 block discarded – undo
145 145
 		'type' => 'varchar',
146 146
 		'precision' => '80'
147 147
 	));*/
148
-	$GLOBALS['egw_setup']->oProc->RefreshTable('egw_emailadmin',array(
148
+	$GLOBALS['egw_setup']->oProc->RefreshTable('egw_emailadmin', array(
149 149
 		'fd' => array(
150
-			'ea_profile_id' => array('type' => 'auto','nullable' => False),
151
-			'ea_smtp_server' => array('type' => 'varchar','precision' => '80'),
152
-			'ea_smtp_type' => array('type' => 'int','precision' => '4'),
153
-			'ea_smtp_port' => array('type' => 'int','precision' => '4'),
154
-			'ea_smtp_auth' => array('type' => 'varchar','precision' => '3'),
155
-			'ea_editforwardingaddress' => array('type' => 'varchar','precision' => '3'),
156
-			'ea_smtp_ldap_server' => array('type' => 'varchar','precision' => '80'),
157
-			'ea_smtp_ldap_basedn' => array('type' => 'varchar','precision' => '200'),
158
-			'ea_smtp_ldap_admindn' => array('type' => 'varchar','precision' => '200'),
159
-			'ea_smtp_ldap_adminpw' => array('type' => 'varchar','precision' => '30'),
160
-			'ea_smtp_ldap_use_default' => array('type' => 'varchar','precision' => '3'),
161
-			'ea_imap_server' => array('type' => 'varchar','precision' => '80'),
162
-			'ea_imap_type' => array('type' => 'int','precision' => '4'),
163
-			'ea_imap_port' => array('type' => 'int','precision' => '4'),
164
-			'ea_imap_login_type' => array('type' => 'varchar','precision' => '20'),
165
-			'ea_imap_tsl_auth' => array('type' => 'varchar','precision' => '3'),
166
-			'ea_imap_tsl_encryption' => array('type' => 'varchar','precision' => '3'),
167
-			'ea_imap_enable_cyrus' => array('type' => 'varchar','precision' => '3'),
168
-			'ea_imap_admin_user' => array('type' => 'varchar','precision' => '40'),
169
-			'ea_imap_admin_pw' => array('type' => 'varchar','precision' => '40'),
170
-			'ea_imap_enable_sieve' => array('type' => 'varchar','precision' => '3'),
171
-			'ea_imap_sieve_server' => array('type' => 'varchar','precision' => '80'),
172
-			'ea_imap_sieve_port' => array('type' => 'int','precision' => '4'),
173
-			'ea_description' => array('type' => 'varchar','precision' => '200'),
174
-			'ea_default_domain' => array('type' => 'varchar','precision' => '100'),
175
-			'ea_organisation_name' => array('type' => 'varchar','precision' => '100'),
176
-			'ea_user_defined_accounts' => array('type' => 'varchar','precision' => '3'),
177
-			'ea_imapoldcclient' => array('type' => 'varchar','precision' => '3'),
178
-			'ea_order' => array('type' => 'int','precision' => '4'),
179
-			'ea_appname' => array('type' => 'varchar','precision' => '80'),
180
-			'ea_group' => array('type' => 'varchar','precision' => '80'),
181
-			'ea_smtp_auth_username' => array('type' => 'varchar','precision' => '80'),
182
-			'ea_smtp_auth_password' => array('type' => 'varchar','precision' => '80')
150
+			'ea_profile_id' => array('type' => 'auto', 'nullable' => False),
151
+			'ea_smtp_server' => array('type' => 'varchar', 'precision' => '80'),
152
+			'ea_smtp_type' => array('type' => 'int', 'precision' => '4'),
153
+			'ea_smtp_port' => array('type' => 'int', 'precision' => '4'),
154
+			'ea_smtp_auth' => array('type' => 'varchar', 'precision' => '3'),
155
+			'ea_editforwardingaddress' => array('type' => 'varchar', 'precision' => '3'),
156
+			'ea_smtp_ldap_server' => array('type' => 'varchar', 'precision' => '80'),
157
+			'ea_smtp_ldap_basedn' => array('type' => 'varchar', 'precision' => '200'),
158
+			'ea_smtp_ldap_admindn' => array('type' => 'varchar', 'precision' => '200'),
159
+			'ea_smtp_ldap_adminpw' => array('type' => 'varchar', 'precision' => '30'),
160
+			'ea_smtp_ldap_use_default' => array('type' => 'varchar', 'precision' => '3'),
161
+			'ea_imap_server' => array('type' => 'varchar', 'precision' => '80'),
162
+			'ea_imap_type' => array('type' => 'int', 'precision' => '4'),
163
+			'ea_imap_port' => array('type' => 'int', 'precision' => '4'),
164
+			'ea_imap_login_type' => array('type' => 'varchar', 'precision' => '20'),
165
+			'ea_imap_tsl_auth' => array('type' => 'varchar', 'precision' => '3'),
166
+			'ea_imap_tsl_encryption' => array('type' => 'varchar', 'precision' => '3'),
167
+			'ea_imap_enable_cyrus' => array('type' => 'varchar', 'precision' => '3'),
168
+			'ea_imap_admin_user' => array('type' => 'varchar', 'precision' => '40'),
169
+			'ea_imap_admin_pw' => array('type' => 'varchar', 'precision' => '40'),
170
+			'ea_imap_enable_sieve' => array('type' => 'varchar', 'precision' => '3'),
171
+			'ea_imap_sieve_server' => array('type' => 'varchar', 'precision' => '80'),
172
+			'ea_imap_sieve_port' => array('type' => 'int', 'precision' => '4'),
173
+			'ea_description' => array('type' => 'varchar', 'precision' => '200'),
174
+			'ea_default_domain' => array('type' => 'varchar', 'precision' => '100'),
175
+			'ea_organisation_name' => array('type' => 'varchar', 'precision' => '100'),
176
+			'ea_user_defined_accounts' => array('type' => 'varchar', 'precision' => '3'),
177
+			'ea_imapoldcclient' => array('type' => 'varchar', 'precision' => '3'),
178
+			'ea_order' => array('type' => 'int', 'precision' => '4'),
179
+			'ea_appname' => array('type' => 'varchar', 'precision' => '80'),
180
+			'ea_group' => array('type' => 'varchar', 'precision' => '80'),
181
+			'ea_smtp_auth_username' => array('type' => 'varchar', 'precision' => '80'),
182
+			'ea_smtp_auth_password' => array('type' => 'varchar', 'precision' => '80')
183 183
 		),
184 184
 		'pk' => array('ea_profile_id'),
185 185
 		'fk' => array(),
186
-		'ix' => array('ea_appname','ea_group'),
186
+		'ix' => array('ea_appname', 'ea_group'),
187 187
 		'uc' => array()
188 188
 	));
189 189
 
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 
200 200
 function emailadmin_upgrade1_4()
201 201
 {
202
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin','ea_user_defined_signatures',array(
202
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin', 'ea_user_defined_signatures', array(
203 203
 		'type' => 'varchar',
204 204
 		'precision' => '3'
205 205
 	));
206
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin','ea_default_signature',array(
206
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin', 'ea_default_signature', array(
207 207
 		'type' => 'varchar',
208 208
 		'precision' => '255'
209 209
 	));
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 
215 215
 function emailadmin_upgrade1_4_001()
216 216
 {
217
-    $GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin','ea_user_defined_identities',array(
217
+    $GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin', 'ea_user_defined_identities', array(
218 218
         'type' => 'varchar',
219 219
         'precision' => '3'
220 220
     ));
@@ -225,26 +225,26 @@  discard block
 block discarded – undo
225 225
 
226 226
 function emailadmin_upgrade1_5_001()
227 227
 {
228
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin','ea_user',array(
228
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin', 'ea_user', array(
229 229
 		'type' => 'varchar',
230 230
 		'precision' => '80'
231 231
 	));
232
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin','ea_active',array(
232
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin', 'ea_active', array(
233 233
 		'type' => 'int',
234 234
 		'precision' => '4'
235 235
 	));
236
-	$GLOBALS['phpgw_setup']->oProc->query("UPDATE egw_emailadmin set ea_user='0', ea_active=1",__LINE__,__FILE__);
236
+	$GLOBALS['phpgw_setup']->oProc->query("UPDATE egw_emailadmin set ea_user='0', ea_active=1", __LINE__, __FILE__);
237 237
 	return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.5.002';
238 238
 }
239 239
 
240 240
 
241 241
 function emailadmin_upgrade1_5_002()
242 242
 {
243
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin','ea_imap_auth_username',array(
243
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin', 'ea_imap_auth_username', array(
244 244
 		'type' => 'varchar',
245 245
 		'precision' => '80'
246 246
 	));
247
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin','ea_imap_auth_password',array(
247
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin', 'ea_imap_auth_password', array(
248 248
 		'type' => 'varchar',
249 249
 		'precision' => '80'
250 250
 	));
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
 function emailadmin_upgrade1_6()
268 268
 {
269
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_emailadmin','ea_default_signature',array(
269
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_emailadmin', 'ea_default_signature', array(
270 270
 		'type' => 'text'
271 271
 	));
272 272
 
@@ -275,32 +275,32 @@  discard block
 block discarded – undo
275 275
 
276 276
 function emailadmin_upgrade1_6_001()
277 277
 {
278
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin','ea_stationery_active_templates',array(
278
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin', 'ea_stationery_active_templates', array(
279 279
 		'type' => 'text'
280 280
 	));
281 281
 
282
-	return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.8';	// was '1.7.003';
282
+	return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.8'; // was '1.7.003';
283 283
 }
284 284
 
285 285
 function emailadmin_upgrade1_7_003()
286 286
 {
287
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_emailadmin','ea_imap_type',array(
287
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_emailadmin', 'ea_imap_type', array(
288 288
 		'type' => 'varchar',
289 289
 		'precision' => 56,
290 290
 	));
291
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_emailadmin','ea_smtp_type',array(
291
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_emailadmin', 'ea_smtp_type', array(
292 292
 		'type' => 'varchar',
293 293
 		'precision' => 56,
294 294
 	));
295 295
 	foreach (array('1'=>'defaultsmtp', '2'=>'postfixldap', '3'=>'postfixinetorgperson', '4'=>'smtpplesk', '5' =>'postfixdbmailuser') as $id => $newtype)
296 296
 	{
297
-		$GLOBALS['egw_setup']->oProc->query('update egw_emailadmin set ea_smtp_type=\''.$newtype.'\' where ea_smtp_type=\''.$id.'\'',__LINE__,__FILE__);
297
+		$GLOBALS['egw_setup']->oProc->query('update egw_emailadmin set ea_smtp_type=\''.$newtype.'\' where ea_smtp_type=\''.$id.'\'', __LINE__, __FILE__);
298 298
 	}
299 299
 	foreach (array('2'=>'defaultimap', '3'=>'cyrusimap', '4'=>'dbmailqmailuser', '5'=>'pleskimap', '6' =>'dbmaildbmailuser') as $id => $newtype)
300 300
 	{
301
-		$GLOBALS['egw_setup']->oProc->query('update egw_emailadmin set ea_imap_type=\''.$newtype.'\' where ea_imap_type=\''.$id.'\'',__LINE__,__FILE__);
301
+		$GLOBALS['egw_setup']->oProc->query('update egw_emailadmin set ea_imap_type=\''.$newtype.'\' where ea_imap_type=\''.$id.'\'', __LINE__, __FILE__);
302 302
 	}
303
-	return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.9.001';	// was '1.7.004';
303
+	return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.9.001'; // was '1.7.004';
304 304
 }
305 305
 
306 306
 function emailadmin_upgrade1_8()
@@ -317,52 +317,52 @@  discard block
 block discarded – undo
317 317
 
318 318
 function emailadmin_upgrade1_9_001()
319 319
 {
320
-	$GLOBALS['egw_setup']->oProc->RefreshTable('egw_emailadmin',array(
320
+	$GLOBALS['egw_setup']->oProc->RefreshTable('egw_emailadmin', array(
321 321
 		'fd' => array(
322
-				'ea_profile_id' => array('type' => 'auto','nullable' => False),
323
-				'ea_smtp_server' => array('type' => 'varchar','precision' => '80'),
324
-				'ea_smtp_type' => array('type' => 'varchar','precision' => '56'),
325
-				'ea_smtp_port' => array('type' => 'int','precision' => '4'),
326
-				'ea_smtp_auth' => array('type' => 'varchar','precision' => '3'),
327
-				'ea_editforwardingaddress' => array('type' => 'varchar','precision' => '3'),
328
-				'ea_smtp_ldap_server' => array('type' => 'varchar','precision' => '80'),
329
-				'ea_smtp_ldap_basedn' => array('type' => 'varchar','precision' => '200'),
330
-				'ea_smtp_ldap_admindn' => array('type' => 'varchar','precision' => '200'),
331
-				'ea_smtp_ldap_adminpw' => array('type' => 'varchar','precision' => '30'),
332
-				'ea_smtp_ldap_use_default' => array('type' => 'varchar','precision' => '3'),
333
-				'ea_imap_server' => array('type' => 'varchar','precision' => '80'),
334
-				'ea_imap_type' => array('type' => 'varchar','precision' => '56'),
335
-				'ea_imap_port' => array('type' => 'int','precision' => '4'),
336
-				'ea_imap_login_type' => array('type' => 'varchar','precision' => '20'),
337
-				'ea_imap_tsl_auth' => array('type' => 'varchar','precision' => '3'),
338
-				'ea_imap_tsl_encryption' => array('type' => 'varchar','precision' => '3'),
339
-				'ea_imap_enable_cyrus' => array('type' => 'varchar','precision' => '3'),
340
-				'ea_imap_admin_user' => array('type' => 'varchar','precision' => '40'),
341
-				'ea_imap_admin_pw' => array('type' => 'varchar','precision' => '40'),
342
-				'ea_imap_enable_sieve' => array('type' => 'varchar','precision' => '3'),
343
-				'ea_imap_sieve_server' => array('type' => 'varchar','precision' => '80'),
344
-				'ea_imap_sieve_port' => array('type' => 'int','precision' => '4'),
345
-				'ea_description' => array('type' => 'varchar','precision' => '200'),
346
-				'ea_default_domain' => array('type' => 'varchar','precision' => '100'),
347
-				'ea_organisation_name' => array('type' => 'varchar','precision' => '100'),
348
-				'ea_user_defined_identities' => array('type' => 'varchar','precision' => '3'),
349
-				'ea_user_defined_accounts' => array('type' => 'varchar','precision' => '3'),
350
-				'ea_order' => array('type' => 'int','precision' => '4'),
351
-				'ea_appname' => array('type' => 'varchar','precision' => '80'),
352
-				'ea_group' => array('type' => 'varchar','precision' => '80'),
353
-				'ea_user' => array('type' => 'varchar','precision' => '80'),
354
-				'ea_active' => array('type' => 'int','precision' => '4'),
355
-				'ea_smtp_auth_username' => array('type' => 'varchar','precision' => '80'),
356
-				'ea_smtp_auth_password' => array('type' => 'varchar','precision' => '80'),
357
-				'ea_user_defined_signatures' => array('type' => 'varchar','precision' => '3'),
322
+				'ea_profile_id' => array('type' => 'auto', 'nullable' => False),
323
+				'ea_smtp_server' => array('type' => 'varchar', 'precision' => '80'),
324
+				'ea_smtp_type' => array('type' => 'varchar', 'precision' => '56'),
325
+				'ea_smtp_port' => array('type' => 'int', 'precision' => '4'),
326
+				'ea_smtp_auth' => array('type' => 'varchar', 'precision' => '3'),
327
+				'ea_editforwardingaddress' => array('type' => 'varchar', 'precision' => '3'),
328
+				'ea_smtp_ldap_server' => array('type' => 'varchar', 'precision' => '80'),
329
+				'ea_smtp_ldap_basedn' => array('type' => 'varchar', 'precision' => '200'),
330
+				'ea_smtp_ldap_admindn' => array('type' => 'varchar', 'precision' => '200'),
331
+				'ea_smtp_ldap_adminpw' => array('type' => 'varchar', 'precision' => '30'),
332
+				'ea_smtp_ldap_use_default' => array('type' => 'varchar', 'precision' => '3'),
333
+				'ea_imap_server' => array('type' => 'varchar', 'precision' => '80'),
334
+				'ea_imap_type' => array('type' => 'varchar', 'precision' => '56'),
335
+				'ea_imap_port' => array('type' => 'int', 'precision' => '4'),
336
+				'ea_imap_login_type' => array('type' => 'varchar', 'precision' => '20'),
337
+				'ea_imap_tsl_auth' => array('type' => 'varchar', 'precision' => '3'),
338
+				'ea_imap_tsl_encryption' => array('type' => 'varchar', 'precision' => '3'),
339
+				'ea_imap_enable_cyrus' => array('type' => 'varchar', 'precision' => '3'),
340
+				'ea_imap_admin_user' => array('type' => 'varchar', 'precision' => '40'),
341
+				'ea_imap_admin_pw' => array('type' => 'varchar', 'precision' => '40'),
342
+				'ea_imap_enable_sieve' => array('type' => 'varchar', 'precision' => '3'),
343
+				'ea_imap_sieve_server' => array('type' => 'varchar', 'precision' => '80'),
344
+				'ea_imap_sieve_port' => array('type' => 'int', 'precision' => '4'),
345
+				'ea_description' => array('type' => 'varchar', 'precision' => '200'),
346
+				'ea_default_domain' => array('type' => 'varchar', 'precision' => '100'),
347
+				'ea_organisation_name' => array('type' => 'varchar', 'precision' => '100'),
348
+				'ea_user_defined_identities' => array('type' => 'varchar', 'precision' => '3'),
349
+				'ea_user_defined_accounts' => array('type' => 'varchar', 'precision' => '3'),
350
+				'ea_order' => array('type' => 'int', 'precision' => '4'),
351
+				'ea_appname' => array('type' => 'varchar', 'precision' => '80'),
352
+				'ea_group' => array('type' => 'varchar', 'precision' => '80'),
353
+				'ea_user' => array('type' => 'varchar', 'precision' => '80'),
354
+				'ea_active' => array('type' => 'int', 'precision' => '4'),
355
+				'ea_smtp_auth_username' => array('type' => 'varchar', 'precision' => '80'),
356
+				'ea_smtp_auth_password' => array('type' => 'varchar', 'precision' => '80'),
357
+				'ea_user_defined_signatures' => array('type' => 'varchar', 'precision' => '3'),
358 358
 				'ea_default_signature' => array('type' => 'text'),
359
-				'ea_imap_auth_username' => array('type' => 'varchar','precision' => '80'),
360
-				'ea_imap_auth_password' => array('type' => 'varchar','precision' => '80'),
359
+				'ea_imap_auth_username' => array('type' => 'varchar', 'precision' => '80'),
360
+				'ea_imap_auth_password' => array('type' => 'varchar', 'precision' => '80'),
361 361
 				'ea_stationery_active_templates' => array('type' => 'text')
362 362
 		),
363 363
 		'pk' => array('ea_profile_id'),
364 364
 		'fk' => array(),
365
-		'ix' => array('ea_appname','ea_group'),
365
+		'ix' => array('ea_appname', 'ea_group'),
366 366
 		'uc' => array()
367 367
 	));
368 368
 	return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.9.002';
@@ -371,13 +371,13 @@  discard block
 block discarded – undo
371 371
 function emailadmin_upgrade1_9_002()
372 372
 {
373 373
 	// convert serialized stationery templates setting to eTemplate store style
374
-	foreach($GLOBALS['egw_setup']->db->query('SELECT ea_profile_id,ea_stationery_active_templates FROM egw_emailadmin
375
-		WHERE ea_stationery_active_templates IS NOT NULL',__LINE__,__FILE__) as $row)
374
+	foreach ($GLOBALS['egw_setup']->db->query('SELECT ea_profile_id,ea_stationery_active_templates FROM egw_emailadmin
375
+		WHERE ea_stationery_active_templates IS NOT NULL',__LINE__, __FILE__) as $row)
376 376
 	{
377
-		if(is_array(($templates=unserialize($row['ea_stationery_active_templates']))))
377
+		if (is_array(($templates = unserialize($row['ea_stationery_active_templates']))))
378 378
 		{
379
-			$GLOBALS['egw_setup']->db->query('UPDATE egw_emailadmin SET ea_stationery_active_templates="'.implode(',',$templates).'"'
380
-				.' WHERE ea_profile_id='.(int)$row['ea_profile_id'],__LINE__,__FILE__);
379
+			$GLOBALS['egw_setup']->db->query('UPDATE egw_emailadmin SET ea_stationery_active_templates="'.implode(',', $templates).'"'
380
+				.' WHERE ea_profile_id='.(int)$row['ea_profile_id'], __LINE__, __FILE__);
381 381
 		}
382 382
 		unset($templates);
383 383
 	}
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 
388 388
 function emailadmin_upgrade1_9_003()
389 389
 {
390
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_emailadmin','ea_smtp_auth_username',array(
390
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_emailadmin', 'ea_smtp_auth_username', array(
391 391
 		'type' => 'varchar',
392 392
 		'precision' => '128',
393 393
 	));
@@ -402,16 +402,16 @@  discard block
 block discarded – undo
402 402
 
403 403
 function emailadmin_upgrade1_9_005()
404 404
 {
405
-	$GLOBALS['egw_setup']->oProc->CreateTable('egw_mailaccounts',array(
405
+	$GLOBALS['egw_setup']->oProc->CreateTable('egw_mailaccounts', array(
406 406
 		'fd' => array(
407
-			'mail_id' => array('type' => 'auto','nullable' => False),
408
-			'account_id' => array('type' => 'int','precision' => '4','nullable' => False),
409
-			'mail_type' => array('type' => 'int','precision' => '1','nullable' => False,'comment' => '0=active, 1=alias, 2=forward, 3=forwardOnly, 4=quota'),
410
-			'mail_value' => array('type' => 'varchar','precision' => '128','nullable' => False)
407
+			'mail_id' => array('type' => 'auto', 'nullable' => False),
408
+			'account_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
409
+			'mail_type' => array('type' => 'int', 'precision' => '1', 'nullable' => False, 'comment' => '0=active, 1=alias, 2=forward, 3=forwardOnly, 4=quota'),
410
+			'mail_value' => array('type' => 'varchar', 'precision' => '128', 'nullable' => False)
411 411
 		),
412 412
 		'pk' => array('mail_id'),
413 413
 		'fk' => array(),
414
-		'ix' => array('mail_value',array('account_id','mail_type')),
414
+		'ix' => array('mail_value', array('account_id', 'mail_type')),
415 415
 		'uc' => array()
416 416
 	));
417 417
 
@@ -421,34 +421,34 @@  discard block
 block discarded – undo
421 421
 
422 422
 function emailadmin_upgrade1_9_006()
423 423
 {
424
-	$GLOBALS['egw_setup']->oProc->CreateTable('egw_ea_accounts',array(
424
+	$GLOBALS['egw_setup']->oProc->CreateTable('egw_ea_accounts', array(
425 425
 		'fd' => array(
426
-			'acc_id' => array('type' => 'auto','nullable' => False),
427
-			'acc_name' => array('type' => 'varchar','precision' => '80','comment' => 'description'),
428
-			'ident_id' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'standard identity'),
429
-			'acc_imap_host' => array('type' => 'varchar','precision' => '128','nullable' => False,'comment' => 'imap hostname'),
430
-			'acc_imap_ssl' => array('type' => 'int','precision' => '1','nullable' => False,'default' => '0','comment' => '0=none, 1=starttls, 2=tls, 3=ssl, &8=validate certificate'),
431
-			'acc_imap_port' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '143','comment' => 'imap port'),
432
-			'acc_sieve_enabled' => array('type' => 'bool','default' => '0','comment' => 'sieve enabled'),
433
-			'acc_sieve_host' => array('type' => 'varchar','precision' => '128','comment' => 'sieve host, default imap_host'),
434
-			'acc_sieve_port' => array('type' => 'int','precision' => '4','default' => '4190'),
435
-			'acc_folder_sent' => array('type' => 'varchar','precision' => '128','comment' => 'sent folder'),
436
-			'acc_folder_trash' => array('type' => 'varchar','precision' => '128','comment' => 'trash folder'),
437
-			'acc_folder_draft' => array('type' => 'varchar','precision' => '128','comment' => 'draft folder'),
438
-			'acc_folder_template' => array('type' => 'varchar','precision' => '128','comment' => 'template folder'),
439
-			'acc_smtp_host' => array('type' => 'varchar','precision' => '128','comment' => 'smtp hostname'),
440
-			'acc_smtp_ssl' => array('type' => 'int','precision' => '1','nullable' => False,'default' => '0','comment' => '0=none, 1=starttls, 2=tls, 3=ssl, &8=validate certificate'),
441
-			'acc_smtp_port' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '25','comment' => 'smtp port'),
442
-			'acc_smtp_type' => array('type' => 'varchar','precision' => '32','default' => 'emailadmin_smtp','comment' => 'smtp class to use'),
443
-			'acc_imap_type' => array('type' => 'varchar','precision' => '32','default' => 'emailadmin_imap','comment' => 'imap class to use'),
444
-			'acc_imap_logintype' => array('type' => 'varchar','precision' => '20','comment' => 'standard, vmailmgr, admin, uidNumber'),
445
-			'acc_domain' => array('type' => 'varchar','precision' => '100','comment' => 'domain name'),
446
-			'acc_further_identities' => array('type' => 'bool','nullable' => False,'default' => '1','comment' => '0=no, 1=yes'),
447
-			'acc_user_editable' => array('type' => 'bool','nullable' => False,'default' => '1','comment' => '0=no, 1=yes'),
448
-			'acc_sieve_ssl' => array('type' => 'int','precision' => '1','default' => '1','comment' => '0=none, 1=starttls, 2=tls, 3=ssl, &8=validate certificate'),
449
-			'acc_modified' => array('type' => 'timestamp','nullable' => False,'default' => 'current_timestamp'),
450
-			'acc_modifier' => array('type' => 'int','meta' => 'user','precision' => '4'),
451
-			'acc_smtp_auth_session' => array('type' => 'bool','comment' => '0=no, 1=yes, use username/pw from current user')
426
+			'acc_id' => array('type' => 'auto', 'nullable' => False),
427
+			'acc_name' => array('type' => 'varchar', 'precision' => '80', 'comment' => 'description'),
428
+			'ident_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'standard identity'),
429
+			'acc_imap_host' => array('type' => 'varchar', 'precision' => '128', 'nullable' => False, 'comment' => 'imap hostname'),
430
+			'acc_imap_ssl' => array('type' => 'int', 'precision' => '1', 'nullable' => False, 'default' => '0', 'comment' => '0=none, 1=starttls, 2=tls, 3=ssl, &8=validate certificate'),
431
+			'acc_imap_port' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '143', 'comment' => 'imap port'),
432
+			'acc_sieve_enabled' => array('type' => 'bool', 'default' => '0', 'comment' => 'sieve enabled'),
433
+			'acc_sieve_host' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'sieve host, default imap_host'),
434
+			'acc_sieve_port' => array('type' => 'int', 'precision' => '4', 'default' => '4190'),
435
+			'acc_folder_sent' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'sent folder'),
436
+			'acc_folder_trash' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'trash folder'),
437
+			'acc_folder_draft' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'draft folder'),
438
+			'acc_folder_template' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'template folder'),
439
+			'acc_smtp_host' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'smtp hostname'),
440
+			'acc_smtp_ssl' => array('type' => 'int', 'precision' => '1', 'nullable' => False, 'default' => '0', 'comment' => '0=none, 1=starttls, 2=tls, 3=ssl, &8=validate certificate'),
441
+			'acc_smtp_port' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '25', 'comment' => 'smtp port'),
442
+			'acc_smtp_type' => array('type' => 'varchar', 'precision' => '32', 'default' => 'emailadmin_smtp', 'comment' => 'smtp class to use'),
443
+			'acc_imap_type' => array('type' => 'varchar', 'precision' => '32', 'default' => 'emailadmin_imap', 'comment' => 'imap class to use'),
444
+			'acc_imap_logintype' => array('type' => 'varchar', 'precision' => '20', 'comment' => 'standard, vmailmgr, admin, uidNumber'),
445
+			'acc_domain' => array('type' => 'varchar', 'precision' => '100', 'comment' => 'domain name'),
446
+			'acc_further_identities' => array('type' => 'bool', 'nullable' => False, 'default' => '1', 'comment' => '0=no, 1=yes'),
447
+			'acc_user_editable' => array('type' => 'bool', 'nullable' => False, 'default' => '1', 'comment' => '0=no, 1=yes'),
448
+			'acc_sieve_ssl' => array('type' => 'int', 'precision' => '1', 'default' => '1', 'comment' => '0=none, 1=starttls, 2=tls, 3=ssl, &8=validate certificate'),
449
+			'acc_modified' => array('type' => 'timestamp', 'nullable' => False, 'default' => 'current_timestamp'),
450
+			'acc_modifier' => array('type' => 'int', 'meta' => 'user', 'precision' => '4'),
451
+			'acc_smtp_auth_session' => array('type' => 'bool', 'comment' => '0=no, 1=yes, use username/pw from current user')
452 452
 		),
453 453
 		'pk' => array('acc_id'),
454 454
 		'fk' => array(),
@@ -462,20 +462,20 @@  discard block
 block discarded – undo
462 462
 
463 463
 function emailadmin_upgrade1_9_007()
464 464
 {
465
-	$GLOBALS['egw_setup']->oProc->CreateTable('egw_ea_credentials',array(
465
+	$GLOBALS['egw_setup']->oProc->CreateTable('egw_ea_credentials', array(
466 466
 		'fd' => array(
467
-			'cred_id' => array('type' => 'auto','nullable' => False),
468
-			'acc_id' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'into egw_ea_accounts'),
469
-			'cred_type' => array('type' => 'int','precision' => '1','nullable' => False,'comment' => '&1=imap, &2=smtp, &4=admin'),
470
-			'account_id' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'comment' => 'account_id or 0=all'),
471
-			'cred_username' => array('type' => 'varchar','precision' => '80','nullable' => False,'comment' => 'username'),
472
-			'cred_password' => array('type' => 'varchar','precision' => '80','comment' => 'password encrypted'),
473
-			'cred_pw_enc' => array('type' => 'int','precision' => '1','default' => '0','comment' => '0=not, 1=user pw, 2=system')
467
+			'cred_id' => array('type' => 'auto', 'nullable' => False),
468
+			'acc_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'into egw_ea_accounts'),
469
+			'cred_type' => array('type' => 'int', 'precision' => '1', 'nullable' => False, 'comment' => '&1=imap, &2=smtp, &4=admin'),
470
+			'account_id' => array('type' => 'int', 'meta' => 'user', 'precision' => '4', 'nullable' => False, 'comment' => 'account_id or 0=all'),
471
+			'cred_username' => array('type' => 'varchar', 'precision' => '80', 'nullable' => False, 'comment' => 'username'),
472
+			'cred_password' => array('type' => 'varchar', 'precision' => '80', 'comment' => 'password encrypted'),
473
+			'cred_pw_enc' => array('type' => 'int', 'precision' => '1', 'default' => '0', 'comment' => '0=not, 1=user pw, 2=system')
474 474
 		),
475 475
 		'pk' => array('cred_id'),
476 476
 		'fk' => array(),
477 477
 		'ix' => array(),
478
-		'uc' => array(array('acc_id','account_id','cred_type'))
478
+		'uc' => array(array('acc_id', 'account_id', 'cred_type'))
479 479
 	));
480 480
 
481 481
 	return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.9.008';
@@ -484,15 +484,15 @@  discard block
 block discarded – undo
484 484
 
485 485
 function emailadmin_upgrade1_9_008()
486 486
 {
487
-	$GLOBALS['egw_setup']->oProc->CreateTable('egw_ea_identities',array(
487
+	$GLOBALS['egw_setup']->oProc->CreateTable('egw_ea_identities', array(
488 488
 		'fd' => array(
489
-			'ident_id' => array('type' => 'auto','nullable' => False),
490
-			'acc_id' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'for which account'),
491
-			'ident_realname' => array('type' => 'varchar','precision' => '128','nullable' => False,'comment' => 'real name'),
492
-			'ident_email' => array('type' => 'varchar','precision' => '128','comment' => 'email address'),
493
-			'ident_org' => array('type' => 'varchar','precision' => '128','comment' => 'organisation'),
494
-			'ident_signature' => array('type' => 'text','comment' => 'signature text'),
495
-			'account_id' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False,'default' => '0','comment' => '0=all users of give mail account')
489
+			'ident_id' => array('type' => 'auto', 'nullable' => False),
490
+			'acc_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'for which account'),
491
+			'ident_realname' => array('type' => 'varchar', 'precision' => '128', 'nullable' => False, 'comment' => 'real name'),
492
+			'ident_email' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'email address'),
493
+			'ident_org' => array('type' => 'varchar', 'precision' => '128', 'comment' => 'organisation'),
494
+			'ident_signature' => array('type' => 'text', 'comment' => 'signature text'),
495
+			'account_id' => array('type' => 'int', 'meta' => 'account', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => '0=all users of give mail account')
496 496
 		),
497 497
 		'pk' => array('ident_id'),
498 498
 		'fk' => array(),
@@ -506,15 +506,15 @@  discard block
 block discarded – undo
506 506
 
507 507
 function emailadmin_upgrade1_9_009()
508 508
 {
509
-	$GLOBALS['egw_setup']->oProc->CreateTable('egw_ea_valid',array(
509
+	$GLOBALS['egw_setup']->oProc->CreateTable('egw_ea_valid', array(
510 510
 		'fd' => array(
511
-			'acc_id' => array('type' => 'int','precision' => '4','nullable' => False),
512
-			'account_id' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False)
511
+			'acc_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
512
+			'account_id' => array('type' => 'int', 'meta' => 'account', 'precision' => '4', 'nullable' => False)
513 513
 		),
514 514
 		'pk' => array(),
515 515
 		'fk' => array(),
516
-		'ix' => array(array('account_id','acc_id')),
517
-		'uc' => array(array('acc_id','account_id'))
516
+		'ix' => array(array('account_id', 'acc_id')),
517
+		'uc' => array(array('acc_id', 'account_id'))
518 518
 	));
519 519
 
520 520
 	return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.9.010';
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 	// migrate personal felamimail accounts, identities and signatures
546 546
 	try {
547 547
 		$db = $GLOBALS['egw_setup']->db;
548
-		foreach($db->select('egw_emailadmin', '*', array('ea_active' => 1), __LINE__, __FILE__, false,
548
+		foreach ($db->select('egw_emailadmin', '*', array('ea_active' => 1), __LINE__, __FILE__, false,
549 549
 			// order general profiles first, then group profiles and user specific ones last
550 550
 			'ORDER BY ea_group IS NULL AND ea_user IS NULL DESC,ea_group IS NULL,ea_user', 'emailadmin') as $row)
551 551
 		{
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 					'acc_imap_type' => emailadmin_account::getIcClass($row['ea_imap_type']),
587 587
 					'acc_imap_logintype' => $row['ea_imap_login_type'],
588 588
 					'acc_imap_host' => $row['ea_imap_server'],
589
-					'acc_imap_ssl' => $row['ea_imap_tsl_encryption'] | ($row['ea_imap_tsl_auth'] === 'yes' ? 8 : 0),
589
+					'acc_imap_ssl' => $row['ea_imap_tsl_encryption']|($row['ea_imap_tsl_auth'] === 'yes' ? 8 : 0),
590 590
 					'acc_imap_port' => $row['ea_imap_port'],
591 591
 					'acc_sieve_enabled' => $row['ea_imap_enable_sieve'] == 'yes',
592 592
 					'acc_sieve_host' => $row['ea_imap_sieve_server'],
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 					'acc_smtp_port' => $row['ea_smtp_port'],
603 603
 					'acc_domain' => $row['ea_default_domain'],
604 604
 					'acc_further_identities' => $row['ea_user_defined_identities'] == 'yes' ||
605
-						$row['ea_user_defined_signatures'] == 'yes',	// both together are now called identities
605
+						$row['ea_user_defined_signatures'] == 'yes', // both together are now called identities
606 606
 					'acc_user_editable' => false,
607 607
 					'acc_smtp_auth_session' => $row['ea_smtp_auth'] == 'ann' ||
608 608
 						$row['ea_smtp_auth'] == 'yes' && empty($row['ea_smtp_auth_username']),
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 		}
646 646
 		// ToDo: migrate all not yet via personal fmail profiles migrated signatures
647 647
 	}
648
-	catch(Exception $e) {
648
+	catch (Exception $e) {
649 649
 		// ignore all errors, eg. because FMail is not installed
650 650
 		echo "<p>".$e->getMessage()."</p>\n";
651 651
 	}
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
  * @param string $email optional email to be used to find matching account/identity with identical email or same domain
666 666
  * @return array with ident_* and acc_id
667 667
  */
668
-function emailadmin_std_identity($account_id, $email=null)
668
+function emailadmin_std_identity($account_id, $email = null)
669 669
 {
670 670
 	if ($email) list(, $domain) = explode('@', $email);
671 671
 	return $GLOBALS['egw_setup']->db->select('egw_ea_accounts', 'egw_ea_identities.*',
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 	{
693 693
 		try {
694 694
 			// migrate real fmail accounts, but not yet identities (fm_ic_hostname is NULL)
695
-			foreach($db->select('egw_felamimail_accounts', '*', 'fm_ic_hostname IS NOT NULL', __LINE__, __FILE__, false, '', 'felamimail') as $row)
695
+			foreach ($db->select('egw_felamimail_accounts', '*', 'fm_ic_hostname IS NOT NULL', __LINE__, __FILE__, false, '', 'felamimail') as $row)
696 696
 			{
697 697
 				$prefs = new preferences($row['fm_owner']);
698 698
 				$all_prefs = $prefs->read_repository();
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
 					'acc_name' => $row['fm_emailaddress'],
723 723
 					'ident_id' => $ident_id,
724 724
 					'acc_imap_host' => $row['fm_ic_hostname'],
725
-					'acc_imap_ssl' => $row['fm_ic_encryption'] | ($row['fm_ic_validatecertificate'] ? 8 : 0),
725
+					'acc_imap_ssl' => $row['fm_ic_encryption']|($row['fm_ic_validatecertificate'] ? 8 : 0),
726 726
 					'acc_imap_port' => $row['fm_ic_port'],
727 727
 					'acc_sieve_enabled' => $row['fm_ic_enable_sieve'],
728 728
 					'acc_sieve_host' => $row['fm_ic_sieve_server'],
@@ -761,11 +761,11 @@  discard block
 block discarded – undo
761 761
 			}
762 762
 
763 763
 			// migrate fmail identities (fm_ic_hostname is NULL), not real fmail account done above
764
-			foreach($db->select('egw_felamimail_accounts', '*', 'fm_ic_hostname IS NULL', __LINE__, __FILE__, false, '', 'felamimail') as $row)
764
+			foreach ($db->select('egw_felamimail_accounts', '*', 'fm_ic_hostname IS NULL', __LINE__, __FILE__, false, '', 'felamimail') as $row)
765 765
 			{
766 766
 				if (!($std_identity = emailadmin_std_identity($row['fm_owner'])))
767 767
 				{
768
-					continue;	// no account found to add identity to
768
+					continue; // no account found to add identity to
769 769
 				}
770 770
 				// create standard identity for account
771 771
 				$identity = array(
@@ -783,13 +783,13 @@  discard block
 block discarded – undo
783 783
 
784 784
 			// migrate all not yet as standard-signatures migrated signatures to identities of first migrated fmail profile
785 785
 			// completing them with realname, email and org from standard-signature of given account
786
-			foreach($db->select('egw_felamimail_signatures', '*',
786
+			foreach ($db->select('egw_felamimail_signatures', '*',
787 787
 				"fm_signatureid NOT IN (SELECT fm_signatureid FROM egw_felamimail_accounts)",
788 788
 				__LINE__, __FILE__, false, '', 'felamimail') as $row)
789 789
 			{
790 790
 				if (!($std_identity = emailadmin_std_identity($row['fm_accountid'])))
791 791
 				{
792
-					continue;	// ignore signatures for whos owner (fm_accountid!) we have no personal profile
792
+					continue; // ignore signatures for whos owner (fm_accountid!) we have no personal profile
793 793
 				}
794 794
 				$identity = $std_identity; unset($identity['ident_id']);
795 795
 				$identity['ident_realname'] = $std_identity['ident_realname'].' ('.$row['fm_description'].')';
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 				$db->insert('egw_ea_identities', $identity, false, __LINE__, __FILE__, 'emailadmin');
799 799
 			}
800 800
 		}
801
-		catch(Exception $e) {
801
+		catch (Exception $e) {
802 802
 			// ignore all errors, eg. because FMail is not installed
803 803
 			echo "<p>".$e->getMessage()."</p>\n";
804 804
 		}
@@ -808,17 +808,17 @@  discard block
 block discarded – undo
808 808
 
809 809
 function emailadmin_upgrade1_9_015()
810 810
 {
811
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_ea_accounts','acc_folder_junk',array(
811
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_ea_accounts', 'acc_folder_junk', array(
812 812
 		'type' => 'varchar',
813 813
 		'precision' => '128',
814 814
 		'comment' => 'junk folder'
815 815
 	));
816
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_ea_accounts','acc_imap_default_quota',array(
816
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_ea_accounts', 'acc_imap_default_quota', array(
817 817
 		'type' => 'int',
818 818
 		'precision' => '4',
819 819
 		'comment' => 'default quota, if no user specific one set'
820 820
 	));
821
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_ea_accounts','acc_imap_timeout',array(
821
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_ea_accounts', 'acc_imap_timeout', array(
822 822
 		'type' => 'int',
823 823
 		'precision' => '2',
824 824
 		'comment' => 'timeout for imap connection'
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 
831 831
 function emailadmin_upgrade1_9_016()
832 832
 {
833
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_ea_identities','ident_name',array(
833
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_ea_identities', 'ident_name', array(
834 834
 		'type' => 'varchar',
835 835
 		'precision' => '128',
836 836
 		'comment' => 'name of identity to display'
@@ -842,16 +842,16 @@  discard block
 block discarded – undo
842 842
 
843 843
 function emailadmin_upgrade1_9_017()
844 844
 {
845
-	$GLOBALS['egw_setup']->oProc->CreateTable('egw_ea_notifications',array(
845
+	$GLOBALS['egw_setup']->oProc->CreateTable('egw_ea_notifications', array(
846 846
 		'fd' => array(
847
-			'notif_id' => array('type' => 'auto','nullable' => False),
848
-			'acc_id' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'mail account'),
849
-			'account_id' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'comment' => 'user account'),
850
-			'notif_folder' => array('type' => 'varchar','precision' => '255','nullable' => False,'comment' => 'folder name')
847
+			'notif_id' => array('type' => 'auto', 'nullable' => False),
848
+			'acc_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'mail account'),
849
+			'account_id' => array('type' => 'int', 'meta' => 'user', 'precision' => '4', 'nullable' => False, 'comment' => 'user account'),
850
+			'notif_folder' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'comment' => 'folder name')
851 851
 		),
852 852
 		'pk' => array('notif_id'),
853 853
 		'fk' => array(),
854
-		'ix' => array(array('account_id','acc_id')),
854
+		'ix' => array(array('account_id', 'acc_id')),
855 855
 		'uc' => array()
856 856
 	));
857 857
 
@@ -861,13 +861,13 @@  discard block
 block discarded – undo
861 861
 
862 862
 function emailadmin_upgrade1_9_018()
863 863
 {
864
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_ea_accounts','acc_smtp_type',array(
864
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_ea_accounts', 'acc_smtp_type', array(
865 865
 		'type' => 'varchar',
866 866
 		'precision' => '32',
867 867
 		'default' => 'emailadmin_smtp',
868 868
 		'comment' => 'smtp class to use'
869 869
 	));
870
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_ea_accounts','acc_imap_type',array(
870
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_ea_accounts', 'acc_imap_type', array(
871 871
 		'type' => 'varchar',
872 872
 		'precision' => '32',
873 873
 		'default' => 'emailadmin_imap',
@@ -886,15 +886,15 @@  discard block
 block discarded – undo
886 886
 
887 887
 function emailadmin_upgrade14_1()
888 888
 {
889
-	$GLOBALS['egw_setup']->oProc->RefreshTable('egw_ea_valid',array(
889
+	$GLOBALS['egw_setup']->oProc->RefreshTable('egw_ea_valid', array(
890 890
 		'fd' => array(
891
-			'acc_id' => array('type' => 'int','precision' => '4','nullable' => False),
892
-			'account_id' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False)
891
+			'acc_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False),
892
+			'account_id' => array('type' => 'int', 'meta' => 'account', 'precision' => '4', 'nullable' => False)
893 893
 		),
894 894
 		'pk' => array(),
895 895
 		'fk' => array(),
896
-		'ix' => array(array('account_id','acc_id')),
897
-		'uc' => array(array('acc_id','account_id'))
896
+		'ix' => array(array('account_id', 'acc_id')),
897
+		'uc' => array(array('acc_id', 'account_id'))
898 898
 	));
899 899
 
900 900
 	return $GLOBALS['setup_info']['emailadmin']['currentver'] = '14.2';
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
 
903 903
 function emailadmin_upgrade14_2()
904 904
 {
905
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_mailaccounts','mail_value',array(
905
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_mailaccounts', 'mail_value', array(
906 906
 		'type' => 'ascii',
907 907
 		'precision' => '128',
908 908
 		'nullable' => False,
@@ -915,30 +915,30 @@  discard block
 block discarded – undo
915 915
 
916 916
 function emailadmin_upgrade14_2_001()
917 917
 {
918
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_ea_accounts','acc_imap_host',array(
918
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_ea_accounts', 'acc_imap_host', array(
919 919
 		'type' => 'ascii',
920 920
 		'precision' => '128',
921 921
 		'nullable' => False,
922 922
 		'comment' => 'imap hostname'
923 923
 	));
924
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_ea_accounts','acc_sieve_host',array(
924
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_ea_accounts', 'acc_sieve_host', array(
925 925
 		'type' => 'ascii',
926 926
 		'precision' => '128',
927 927
 		'comment' => 'sieve host, default imap_host'
928 928
 	));
929
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_ea_accounts','acc_smtp_type',array(
929
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_ea_accounts', 'acc_smtp_type', array(
930 930
 		'type' => 'ascii',
931 931
 		'precision' => '32',
932 932
 		'default' => 'emailadmin_smtp',
933 933
 		'comment' => 'smtp class to use'
934 934
 	));
935
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_ea_accounts','acc_imap_type',array(
935
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_ea_accounts', 'acc_imap_type', array(
936 936
 		'type' => 'ascii',
937 937
 		'precision' => '32',
938 938
 		'default' => 'emailadmin_imap',
939 939
 		'comment' => 'imap class to use'
940 940
 	));
941
-	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_ea_accounts','acc_imap_logintype',array(
941
+	$GLOBALS['egw_setup']->oProc->AlterColumn('egw_ea_accounts', 'acc_imap_logintype', array(
942 942
 		'type' => 'ascii',
943 943
 		'precision' => '20',
944 944
 		'comment' => 'standard, vmailmgr, admin, uidNumber'
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
  */
955 955
 function emailadmin_upgrade14_3()
956 956
 {
957
-	$GLOBALS['egw_setup']->oProc->AddColumn('egw_ea_accounts','acc_user_forward',array(
957
+	$GLOBALS['egw_setup']->oProc->AddColumn('egw_ea_accounts', 'acc_user_forward', array(
958 958
 		'type' => 'bool',
959 959
 		'default' => '0',
960 960
 		'comment' => 'allow user to define forwards'
Please login to merge, or discard this patch.
Braces   +16 added lines, -4 removed lines patch added patch discarded remove patch
@@ -611,7 +611,10 @@  discard block
 block discarded – undo
611 611
 				$acc_id = $db->get_last_insert_id('egw_ea_accounts', 'acc_id');
612 612
 
613 613
 				// remember acc_id by owner, to be able to base credential only profiles on them
614
-				if ($owner <= 0 && !isset($acc_ids[$owner])) $acc_ids[(string)$owner] = $acc_id;
614
+				if ($owner <= 0 && !isset($acc_ids[$owner]))
615
+				{
616
+					$acc_ids[(string)$owner] = $acc_id;
617
+				}
615 618
 
616 619
 				// update above created identity with account acc_id
617 620
 				$db->update('egw_ea_identities', array('acc_id' => $acc_id), array('ident_id' => $ident_id), __LINE__, __FILE__, 'emailadmin');
@@ -623,7 +626,10 @@  discard block
 block discarded – undo
623 626
 				), false, __LINE__, __FILE__, 'emailadmin');
624 627
 			}
625 628
 			// credentials are either stored for specific user or all users (account_id=0), not group-specific
626
-			if (!($owner > 0)) $owner = 0;
629
+			if (!($owner > 0))
630
+			{
631
+				$owner = 0;
632
+			}
627 633
 			// add imap credentials if necessary
628 634
 			$cred_type = $row['ea_smpt_auth'] != 'no' && $row['ea_imap_auth_username'] && $row['ea_smtp_auth_username'] &&
629 635
 				$row['ea_imap_auth_username'] == $row['ea_smtp_auth_username'] &&
@@ -667,7 +673,10 @@  discard block
 block discarded – undo
667 673
  */
668 674
 function emailadmin_std_identity($account_id, $email=null)
669 675
 {
670
-	if ($email) list(, $domain) = explode('@', $email);
676
+	if ($email)
677
+	{
678
+		list(, $domain) = explode('@', $email);
679
+	}
671 680
 	return $GLOBALS['egw_setup']->db->select('egw_ea_accounts', 'egw_ea_identities.*',
672 681
 		'egw_ea_valid.account_id IN (0,'.(int)$account_id.') AND egw_ea_identities.account_id IN (0,'.(int)$account_id.')',
673 682
 		__LINE__, __FILE__, 0,
@@ -739,7 +748,10 @@  discard block
 block discarded – undo
739 748
 				$db->insert('egw_ea_accounts', $account, false, __LINE__, __FILE__, 'emailadmin');
740 749
 				$acc_id = $db->get_last_insert_id('egw_ea_accounts', 'acc_id');
741 750
 				$identity['acc_id'] = $acc_id;
742
-				if (!isset($std_identity[$row['fm_owner']])) $std_identity[$row['fm_owner']] = $identity;
751
+				if (!isset($std_identity[$row['fm_owner']]))
752
+				{
753
+					$std_identity[$row['fm_owner']] = $identity;
754
+				}
743 755
 				// update above created identity with account acc_id
744 756
 				$db->update('egw_ea_identities', array('acc_id' => $acc_id), array('ident_id' => $ident_id), __LINE__, __FILE__, 'emailadmin');
745 757
 
Please login to merge, or discard this patch.
doc/rpm-build/checkout-build-archives.php 4 patches
Upper-Lower-Casing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 	}
404 404
 
405 405
 	$archives = config_translate('upload');
406
-	echo "Uploading $archives to $config[upload_url]\n";
406
+	echo "uploading $archives to $config[upload_url]\n";
407 407
 
408 408
 	foreach(glob($archives, GLOB_BRACE) as $path)
409 409
 	{
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 		{
430 430
 			continue;
431 431
 		}
432
-		if ($verbose) echo "Uploading $path as $content_type\n";
432
+		if ($verbose) echo "uploading $path as $content_type\n";
433 433
 		$name = basename($path);
434 434
 		github_api($config['upload_url'], array(
435 435
 			'name' => $name,
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 	curl_setopt($c, CURLOPT_URL, $url);
493 493
 
494 494
 	if (is_string($data)) $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data;
495
-	if ($verbose) echo "Sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n";
495
+	if ($verbose) echo "sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n";
496 496
 
497 497
 	if (($response = curl_exec($c)) === false)
498 498
 	{
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 		if (!$is_regexp && strpos($log->paths->path, $pattern) !== false ||
727 727
 			$is_regexp && preg_match($pattern, $log->paths->path, $matches))
728 728
 		{
729
-			if ($verbose) echo "Revision {$log['revision']} matches".($matches?': '.$matches[1] : '')."\n";
729
+			if ($verbose) echo "revision {$log['revision']} matches".($matches?': '.$matches[1] : '')."\n";
730 730
 			return (int)$log['revision'];
731 731
 		}
732 732
 	}
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
 			if ($content != $content_was)
808 808
 			{
809 809
 				file_put_contents($path,$content);
810
-				if ($verbose) echo "Updated $path\n";
810
+				if ($verbose) echo "updated $path\n";
811 811
 				++$n;
812 812
 			}
813 813
 		}
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
 	}
943 943
 	foreach($config['types'] as $type)
944 944
 	{
945
-		echo "Creating $type archives\n";
945
+		echo "creating $type archives\n";
946 946
 		$tar_type = $type == 'tar.bz2' ? 'j' : 'z';
947 947
 
948 948
 		$file = $config['sourcedir'].'/'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.'.$type;
@@ -1064,7 +1064,7 @@  discard block
 block discarded – undo
1064 1064
 
1065 1065
 	if (($cmd = config_translate('patchCmd')) && $cmd[0] != '#')
1066 1066
 	{
1067
-		echo "Running $cmd\n";
1067
+		echo "running $cmd\n";
1068 1068
 		run_cmd($cmd);
1069 1069
 	}
1070 1070
 	// fix permissions
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -562,6 +562,7 @@  discard block
 block discarded – undo
562 562
  *
563 563
  * @param string $name
564 564
  * @param string $value =null value to use, default $config[$name]
565
+ * @return string
565 566
  */
566 567
 function config_translate($name, $value=null)
567 568
 {
@@ -1336,7 +1337,7 @@  discard block
 block discarded – undo
1336 1337
  * 2b) otherwise throws with $cmd as message and exit-code
1337 1338
  *
1338 1339
  * @param string $cmd
1339
- * @param array& $output=null $output of command, only if !$verbose !!!
1340
+ * @param array& $output $output of command, only if !$verbose !!!
1340 1341
  * @param int|array $no_bailout =null exit code(s) to NOT bail out
1341 1342
  * @throws Exception on non-zero exit-code not matching $no_bailout
1342 1343
  * @return int exit code of $cmd
Please login to merge, or discard this patch.
Spacing   +176 added lines, -176 removed lines patch added patch discarded remove patch
@@ -13,15 +13,15 @@  discard block
 block discarded – undo
13 13
 {
14 14
 	die('<h1>checkout-build-archives.php must NOT be called as web-page --> exiting !!!</h1>');
15 15
 }
16
-date_default_timezone_set('Europe/Berlin');	// to get ride of 5.3 warnings
16
+date_default_timezone_set('Europe/Berlin'); // to get ride of 5.3 warnings
17 17
 
18 18
 $verbose = 0;
19 19
 $config = array(
20 20
 	'packagename' => 'egroupware-epl',
21
-	'version' => '17.1',        // '17.1'
21
+	'version' => '17.1', // '17.1'
22 22
 	'packaging' => date('Ymd'), // '20160520'
23
-	'branch'  => 'master',        // checked out branch
24
-	'tag' => '$version.$packaging',	// name of tag
23
+	'branch'  => 'master', // checked out branch
24
+	'tag' => '$version.$packaging', // name of tag
25 25
 	'checkoutdir' => realpath(__DIR__.'/../..'),
26 26
 	'egw_buildroot' => '/tmp/build_root/epl_17.1_buildroot',
27 27
 	'sourcedir' => '/home/download/stylite-epl/egroupware-epl-17.1',
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
 	'svnalias' => 'aliases/default-ssh',    // default alias
34 34
 	'extra' => array('$stylitebase/$svnbranch/stylite', '$stylitebase/$svnbranch/esyncpro', '$stylitebase/trunk/archive'),//, '$stylitebase/$svnbranch/groups'), //,'svn+ssh://[email protected]/stylite/trunk/eventmgr'),
35 35
 	*/
36
-	'extra' => array('functions' => array('stylite'), 'esyncpro', 'archive',	// create an extra archive for given apps
36
+	'extra' => array('functions' => array('stylite'), 'esyncpro', 'archive', // create an extra archive for given apps
37 37
 		// these apps are placed in egroupware-epl-contrib archive
38 38
 		'contrib' => array('phpgwapi', 'etemplate', 'jdots', 'phpbrain', 'wiki', 'sambaadmin', 'sitemgr', 'phpfreechat')),
39
-	'aliasdir' => 'egroupware',             // directory created by the alias
40
-	'types' => array('tar.bz2','tar.gz','zip','all.tar.bz2'),
39
+	'aliasdir' => 'egroupware', // directory created by the alias
40
+	'types' => array('tar.bz2', 'tar.gz', 'zip', 'all.tar.bz2'),
41 41
 	// add given extra-apps or (uncompressed!) archives to above all.tar.bz2 archive
42 42
 	'all-add' => array('contrib', '/home/stylite/epl-trunk/phpfreechat_data_public.tar'),
43 43
 	// diverse binaries we need
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
 	'after-checkout' => 'rm -rf */source */templates/*/source',
58 58
 	'packager' => '[email protected]',
59 59
 	'obs' => '/home/stylite/obs/stylite-epl-trunk',
60
-	'obs_package_alias' => '',	// name used in obs package, if different from packagename
61
-	'changelog' => false,   // eg. '* 1. Zeile\n* 2. Zeile' for debian.changes
60
+	'obs_package_alias' => '', // name used in obs package, if different from packagename
61
+	'changelog' => false, // eg. '* 1. Zeile\n* 2. Zeile' for debian.changes
62 62
 	'changelog_packager' => 'Ralf Becker <[email protected]>',
63 63
 	'editchangelog' => '* ',
64 64
 	//'sfuser' => 'ralfbecker',
@@ -67,23 +67,23 @@  discard block
 block discarded – undo
67 67
 	'upload' => '$sourcedir/*egroupware-epl{,-contrib}-$version.$packaging*',
68 68
 	'copychangelog' => '$sourcedir/README', //'$sfuser,[email protected]:/home/frs/project/e/eg/egroupware/README',
69 69
 	'skip' => array(),
70
-	'run' => array('checkout','editchangelog','tag','copy','virusscan','create','sign','obs','copychangelog'),
70
+	'run' => array('checkout', 'editchangelog', 'tag', 'copy', 'virusscan', 'create', 'sign', 'obs', 'copychangelog'),
71 71
 	'patchCmd' => '# run cmd after copy eg. "cd $egw_buildroot; patch -p1 /path/to/patch"',
72
-	'github_user' => 'ralfbecker',	// Github user for following token
73
-	'github_token' => '',	// Github repo personal access token from above user
72
+	'github_user' => 'ralfbecker', // Github user for following token
73
+	'github_token' => '', // Github repo personal access token from above user
74 74
 );
75 75
 
76 76
 // process config from command line
77 77
 $argv = $_SERVER['argv'];
78 78
 $prog = array_shift($argv);
79 79
 
80
-while(($arg = array_shift($argv)))
80
+while (($arg = array_shift($argv)))
81 81
 {
82 82
 	if ($arg == '-v' || $arg == '--verbose')
83 83
 	{
84 84
 		++$verbose;
85 85
 	}
86
-	elseif($arg == '-h' || $arg == '--help')
86
+	elseif ($arg == '-h' || $arg == '--help')
87 87
 	{
88 88
 		if (in_array('editchangelog', $config['skip']) || !in_array('editchangelog', $config['run']))
89 89
 		{
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
 		}
92 92
 		usage();
93 93
 	}
94
-	elseif(substr($arg,0,2) == '--' && isset($config[$name=substr($arg,2)]))
94
+	elseif (substr($arg, 0, 2) == '--' && isset($config[$name = substr($arg, 2)]))
95 95
 	{
96 96
 		$value = array_shift($argv);
97
-		switch($name)
97
+		switch ($name)
98 98
 		{
99 99
 			case 'extra':	// stored as array and allow to add/delete items with +/- prefix
100 100
 			case 'types':
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 				{
118 118
 					$value = array_unique(preg_split('/[ ,]+/', $value));
119 119
 				}
120
-				switch($op)
120
+				switch ($op)
121 121
 				{
122 122
 					case '+':
123 123
 						$config[$name] = array_unique(array_merge($config[$name], $value));
@@ -135,14 +135,14 @@  discard block
 block discarded – undo
135 135
 			case 'release':
136 136
 			case 'copychangelog':
137 137
 				$config[$name] = $value;
138
-				if ($value) array_unshift($config['run'],$name);
138
+				if ($value) array_unshift($config['run'], $name);
139 139
 				break;
140 140
 
141 141
 			case 'editchangelog':
142 142
 				$config[$name] = $value ? $value : true;
143
-				if (!in_array('editchangelog',$config['run']))
143
+				if (!in_array('editchangelog', $config['run']))
144 144
 				{
145
-					array_unshift($config['run'],'editchangelog');
145
+					array_unshift($config['run'], 'editchangelog');
146 146
 				}
147 147
 				break;
148 148
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 				{
152 152
 					usage("Path '$value' not found!");
153 153
 				}
154
-				if (!in_array('obs',$config['run'])) $config['run'][] = 'obs';
154
+				if (!in_array('obs', $config['run'])) $config['run'][] = 'obs';
155 155
 				// fall through
156 156
 			default:
157 157
 				$config[$name] = $value;
@@ -169,16 +169,16 @@  discard block
 block discarded – undo
169 169
 }
170 170
 $svn = $config['svn'];
171 171
 
172
-$run = array_diff($config['run'],$config['skip']);
172
+$run = array_diff($config['run'], $config['skip']);
173 173
 
174 174
 // if we dont edit the changelog, set packaging from changelog
175 175
 if (!in_array('editchangelog', $run))
176 176
 {
177 177
 	parse_current_changelog(true);
178 178
 }
179
-foreach($run as $func)
179
+foreach ($run as $func)
180 180
 {
181
-	chdir(dirname(__FILE__));	// make relative filenames work, if other command changes dir
181
+	chdir(dirname(__FILE__)); // make relative filenames work, if other command changes dir
182 182
 	call_user_func('do_'.$func);
183 183
 }
184 184
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
  * @param string $prefix ='* ' prefix, which if not presend should be added to all log messages
194 194
  * @return string with changelog
195 195
  */
196
-function get_changelog_from_git($_path, $log_pattern=null, &$last_tag=null, $prefix='* ')
196
+function get_changelog_from_git($_path, $log_pattern = null, &$last_tag = null, $prefix = '* ')
197 197
 {
198 198
 	//echo __FUNCTION__."('$branch_url','$log_pattern','$revision','$prefix')\n";
199 199
 	global $config;
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		$output = null;
216 216
 		run_cmd($cmd, $output);
217 217
 
218
-		foreach($output as $line)
218
+		foreach ($output as $line)
219 219
 		{
220 220
 			if (substr($line, 0, 4) == "    " && ($msg = _match_log_pattern(substr($line, 4), $log_pattern, $prefix)))
221 221
 			{
@@ -248,13 +248,13 @@  discard block
 block discarded – undo
248 248
 	{
249 249
 		throw new Exception("checkout directory '{$config['checkoutdir']} does NOT exists or is NO directory!");
250 250
 	}
251
-	if (!($mrconfig = file_get_contents($path=$config['checkoutdir'].'/.mrconfig')))
251
+	if (!($mrconfig = file_get_contents($path = $config['checkoutdir'].'/.mrconfig')))
252 252
 	{
253 253
 		throw new Exception("$path not found!");
254 254
 	}
255 255
 	$module = $baseurl = null;
256 256
 	$modules = array();
257
-	foreach(explode("\n", $mrconfig) as $line)
257
+	foreach (explode("\n", $mrconfig) as $line)
258 258
 	{
259 259
 		$matches = null;
260 260
 		if (isset($baseurl))
@@ -343,9 +343,9 @@  discard block
 block discarded – undo
343 343
 	}
344 344
 	chdir($config['checkoutdir']);
345 345
 
346
-	$config['tag'] = config_translate('tag');	// allow to use config vars like $version in tag
346
+	$config['tag'] = config_translate('tag'); // allow to use config vars like $version in tag
347 347
 
348
-	if (empty($config['tag'])) return;	// otherwise we copy everything in svn root!
348
+	if (empty($config['tag'])) return; // otherwise we copy everything in svn root!
349 349
 
350 350
 	echo "Creating tag and pushing $config[tag]\n";
351 351
 
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 	// might require more then one run, as pushed tags need to be picked up by packagist
361 361
 	$output = $ret = null;
362 362
 	$timeout = 10;
363
-	for($try=1; $try < 10 && run_cmd($config['composer'].' update egroupware/\*', $output, 2); ++$try)
363
+	for ($try = 1; $try < 10 && run_cmd($config['composer'].' update egroupware/\*', $output, 2); ++$try)
364 364
 	{
365 365
 		echo "$try. retry in $timeout seconds ...\n";
366 366
 		sleep($timeout);
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 {
380 380
 	global $config;
381 381
 
382
-	if (!($json = file_get_contents($path=$config['checkoutdir'].'/composer.json')))
382
+	if (!($json = file_get_contents($path = $config['checkoutdir'].'/composer.json')))
383 383
 	{
384 384
 		throw new Exception("Can NOT read $path to update with new version!");
385 385
 	}
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
  */
407 407
 function do_release()
408 408
 {
409
-	global $config,$verbose;
409
+	global $config, $verbose;
410 410
 
411 411
 	// push local changes to Github incl. tag (tags of apps are already pushed by do_tag)
412 412
 	if ($verbose) echo "Pushing changes and tags\n";
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 		'body' => $config['changelog'],
432 432
 	);
433 433
 	$response = github_api("/repos/EGroupware/egroupware/releases", $data);
434
-	$config['upload_url'] = preg_replace('/{\?[^}]+}$/', '', $response['upload_url']);	// remove {?name,label} template
434
+	$config['upload_url'] = preg_replace('/{\?[^}]+}$/', '', $response['upload_url']); // remove {?name,label} template
435 435
 
436 436
 	do_upload();
437 437
 }
@@ -441,33 +441,33 @@  discard block
 block discarded – undo
441 441
  */
442 442
 function do_upload()
443 443
 {
444
-	global $config,$verbose;
444
+	global $config, $verbose;
445 445
 
446 446
 	if (empty($config['upload_url']))
447 447
 	{
448 448
 		$response = github_api("/repos/EGroupware/egroupware/releases", array(), 'GET');
449
-		$config['upload_url'] = preg_replace('/{\?[^}]+}$/', '', $response[0]['upload_url']);	// remove {?name,label} template
449
+		$config['upload_url'] = preg_replace('/{\?[^}]+}$/', '', $response[0]['upload_url']); // remove {?name,label} template
450 450
 	}
451 451
 
452 452
 	$archives = config_translate('upload');
453 453
 	echo "Uploading $archives to $config[upload_url]\n";
454 454
 
455
-	foreach(glob($archives, GLOB_BRACE) as $path)
455
+	foreach (glob($archives, GLOB_BRACE) as $path)
456 456
 	{
457 457
 		$label = null;
458 458
 		if (substr($path, -4) == '.zip')
459 459
 		{
460 460
 			$content_type = 'application/zip';
461 461
 		}
462
-		elseif(substr($path, -7) == '.tar.gz')
462
+		elseif (substr($path, -7) == '.tar.gz')
463 463
 		{
464 464
 			$content_type = 'application/x-gzip';
465 465
 		}
466
-		elseif(substr($path, -8) == '.tar.bz2')
466
+		elseif (substr($path, -8) == '.tar.bz2')
467 467
 		{
468 468
 			$content_type = 'application/x-bzip2';
469 469
 		}
470
-		elseif(substr($path, -8) == '.txt.asc')
470
+		elseif (substr($path, -8) == '.txt.asc')
471 471
 		{
472 472
 			$content_type = 'text/plain';
473 473
 			$label = 'Signed hashes of downloads';
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 
487 487
 	if (!empty($config['release']))
488 488
 	{
489
-		$target = config_translate('release');	// allow to use config vars like $svnbranch in module
489
+		$target = config_translate('release'); // allow to use config vars like $svnbranch in module
490 490
 		$cmd = $config['rsync'].' '.$archives.' '.$target;
491 491
 		if ($verbose) echo $cmd."\n";
492 492
 		passthru($cmd);
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
  * @throws Exception
505 505
  * @return array with response
506 506
  */
507
-function github_api($_url, $data, $method='POST', $upload=null, $content_type=null)
507
+function github_api($_url, $data, $method = 'POST', $upload = null, $content_type = null)
508 508
 {
509 509
 	global $config, $verbose;
510 510
 
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 	curl_setopt($c, CURLOPT_TIMEOUT, 240);
518 518
 	curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
519 519
 
520
-	switch($method)
520
+	switch ($method)
521 521
 	{
522 522
 		case 'POST':
523 523
 			curl_setopt($c, CURLOPT_POST, true);
@@ -525,13 +525,13 @@  discard block
 block discarded – undo
525 525
 			curl_setopt($c, CURLOPT_POSTFIELDS, $data);
526 526
 			break;
527 527
 		case 'GET':
528
-			if(count($data)) $url .= '?' . http_build_query($data);
528
+			if (count($data)) $url .= '?'.http_build_query($data);
529 529
 			break;
530 530
 		case 'FILE':
531 531
 			curl_setopt($c, CURLOPT_HTTPHEADER, array("Content-type: $content_type"));
532 532
 			curl_setopt($c, CURLOPT_POST, true);
533 533
 			curl_setopt($c, CURLOPT_POSTFIELDS, file_get_contents($upload));
534
-			if(count($data)) $url .= '?' . http_build_query($data);
534
+			if (count($data)) $url .= '?'.http_build_query($data);
535 535
 			break;
536 536
 		default:
537 537
 			throw new Exception(__FUNCTION__.": Unknown/unimplemented method=$method!");
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 	curl_setopt($c, CURLOPT_URL, $url);
540 540
 
541 541
 	if (is_string($data)) $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data;
542
-	if ($verbose) echo "Sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n";
542
+	if ($verbose) echo "Sending $method request to $url ".(isset($short_data) && $method != 'GET' ? $short_data : '')."\n";
543 543
 
544 544
 	if (($response = curl_exec($c)) === false)
545 545
 	{
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 		curl_setopt($c, CURLOPT_HEADER, true);
548 548
 		curl_setopt($c, CURLOPT_RETURNTRANSFER, false);
549 549
 		curl_exec($c);
550
-		throw new Exception("$method request to $url failed ".(isset($short_data)&&$method!='GET'?$short_data:''));
550
+		throw new Exception("$method request to $url failed ".(isset($short_data) && $method != 'GET' ? $short_data : ''));
551 551
 	}
552 552
 
553 553
 	if ($verbose) echo (strlen($response) > 200 ? substr($response, 0, 200).' ...' : $response)."\n";
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
  * @param string $name
564 564
  * @param string $value =null value to use, default $config[$name]
565 565
  */
566
-function config_translate($name, $value=null)
566
+function config_translate($name, $value = null)
567 567
 {
568 568
 	global $config;
569 569
 
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 	if (is_string($value) && strpos($value, '$') !== false)
572 572
 	{
573 573
 		$translate = array();
574
-		foreach($config as $n => $val)
574
+		foreach ($config as $n => $val)
575 575
 		{
576 576
 			if (is_string($val)) $translate['$'.$n] = $val;
577 577
 		}
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
  */
598 598
 function do_editchangelog()
599 599
 {
600
-	global $config,$svn;
600
+	global $config, $svn;
601 601
 
602 602
 	echo "Querying changelog from Git/SVN\n";
603 603
 	if (!isset($config['modules']))
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 	// query changelog per repo
608 608
 	$changelog = '';
609 609
 	$last_tag = null;
610
-	foreach($config['modules'] as $branch_url => $modules)
610
+	foreach ($config['modules'] as $branch_url => $modules)
611 611
 	{
612 612
 		$revision = null;
613 613
 		if (substr($branch_url, -4) == '.git')
@@ -624,15 +624,15 @@  discard block
 block discarded – undo
624 624
 	{
625 625
 		$changelog = "Could not query changelog for $config[version], eg. no last tag found!\n";
626 626
 	}
627
-	$logfile = tempnam('/tmp','checkout-build-archives');
628
-	file_put_contents($logfile,$changelog);
627
+	$logfile = tempnam('/tmp', 'checkout-build-archives');
628
+	file_put_contents($logfile, $changelog);
629 629
 	$cmd = $config['editor'].' '.escapeshellarg($logfile);
630 630
 	passthru($cmd);
631 631
 	$config['changelog'] = file_get_contents($logfile);
632 632
 	// remove trailing newlines
633
-	while (substr($config['changelog'],-1) == "\n")
633
+	while (substr($config['changelog'], -1) == "\n")
634 634
 	{
635
-		$config['changelog'] = substr($config['changelog'],0,-1);
635
+		$config['changelog'] = substr($config['changelog'], 0, -1);
636 636
 	}
637 637
 	// allow user to abort, by deleting the changelog
638 638
 	if (strlen($config['changelog']) <= 2)
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 	}
648 648
 	file_put_contents($changelog, update_changelog(file_get_contents($changelog)));
649 649
 
650
-	update_api_setup($api_setup=$config['checkoutdir'].'/api/setup/setup.inc.php');
650
+	update_api_setup($api_setup = $config['checkoutdir'].'/api/setup/setup.inc.php');
651 651
 
652 652
 	if (file_exists($config['checkoutdir'].'/.git'))
653 653
 	{
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 	run_cmd($cmd);
661 661
 
662 662
 	// update obs changelogs (so all changlogs are updated in case of a later error and changelog step can be skiped)
663
-	do_obs(true);	// true: only update debian.changes in obs checkouts
663
+	do_obs(true); // true: only update debian.changes in obs checkouts
664 664
 }
665 665
 
666 666
 /**
@@ -674,41 +674,41 @@  discard block
 block discarded – undo
674 674
  * @param string $prefix ='* ' prefix, which if not presend should be added to all log messages
675 675
  * @return string with changelog
676 676
  */
677
-function get_changelog_from_svn($branch_url, $log_pattern=null, &$revision=null, $prefix='* ')
677
+function get_changelog_from_svn($branch_url, $log_pattern = null, &$revision = null, $prefix = '* ')
678 678
 {
679 679
 	//echo __FUNCTION__."('$branch_url','$log_pattern','$revision','$prefix')\n";
680
-	global $config,$verbose,$svn;
680
+	global $config, $verbose, $svn;
681 681
 
682 682
 	if (is_null($revision))
683 683
 	{
684
-		list($tags_url,$branch) = preg_split('#/(branches/|trunk)#',$branch_url);
684
+		list($tags_url, $branch) = preg_split('#/(branches/|trunk)#', $branch_url);
685 685
 		if (empty($branch)) $branch = $config['version'];
686 686
 		$tags_url .= '/tags';
687
-		$pattern='|/tags/('.preg_quote($config['version'], '|').'\.[0-9.]+)|';
687
+		$pattern = '|/tags/('.preg_quote($config['version'], '|').'\.[0-9.]+)|';
688 688
 		$matches = null;
689
-		$revision = get_last_svn_tag($tags_url,$pattern,$matches);
689
+		$revision = get_last_svn_tag($tags_url, $pattern, $matches);
690 690
 		$tag = $matches[1];
691 691
 	}
692
-	elseif(!is_numeric($revision))
692
+	elseif (!is_numeric($revision))
693 693
 	{
694
-		$revision = get_last_svn_tag($tags_url,$tag=$revision);
694
+		$revision = get_last_svn_tag($tags_url, $tag = $revision);
695 695
 	}
696 696
 	$cmd = $svn.' log --xml -r '.escapeshellarg($revision.':HEAD').' '.escapeshellarg($branch_url);
697 697
 	if (($v = $verbose))
698 698
 	{
699 699
 		echo "Querying SVN for log from r$revision".($tag ? " ($tag)" : '').":\n$cmd\n";
700
-		$verbose = false;	// otherwise no $output!
700
+		$verbose = false; // otherwise no $output!
701 701
 	}
702 702
 	$output = array();
703
-	run_cmd($cmd,$output);
703
+	run_cmd($cmd, $output);
704 704
 	$verbose = $v;
705
-	array_shift($output);	// remove the command
705
+	array_shift($output); // remove the command
706 706
 
707
-	$xml = simplexml_load_string($output=implode("\n",$output));
707
+	$xml = simplexml_load_string($output = implode("\n", $output));
708 708
 	$message = '';
709
-	foreach($xml as $log)
709
+	foreach ($xml as $log)
710 710
 	{
711
-		if (!($msg = _match_log_pattern($log->msg, $log_pattern, $prefix))) continue;	// no match --> ignore
711
+		if (!($msg = _match_log_pattern($log->msg, $log_pattern, $prefix))) continue; // no match --> ignore
712 712
 
713 713
 		$message .= $msg."\n";
714 714
 	}
@@ -725,25 +725,25 @@  discard block
 block discarded – undo
725 725
  * @param string $prefix ='* '
726 726
  * @return string
727 727
  */
728
-function _match_log_pattern($msg, $log_pattern, $prefix='* ')
728
+function _match_log_pattern($msg, $log_pattern, $prefix = '* ')
729 729
 {
730 730
 	$pattern_len = strlen($log_pattern);
731 731
 	$prefix_len = strlen($prefix);
732 732
 
733 733
 	$matches = null;
734
-	if ($log_pattern[0] == '/' && preg_match($log_pattern,$msg,$matches))
734
+	if ($log_pattern[0] == '/' && preg_match($log_pattern, $msg, $matches))
735 735
 	{
736 736
 		$msg = $matches[1];
737 737
 	}
738
-	elseif($log_pattern && $log_pattern[0] != '/' && substr($msg,0,$pattern_len) == $log_pattern)
738
+	elseif ($log_pattern && $log_pattern[0] != '/' && substr($msg, 0, $pattern_len) == $log_pattern)
739 739
 	{
740
-		list($msg) = explode("\n",$msg);
740
+		list($msg) = explode("\n", $msg);
741 741
 	}
742
-	elseif($log_pattern)
742
+	elseif ($log_pattern)
743 743
 	{
744 744
 		return null;
745 745
 	}
746
-	if ($prefix_len && substr($msg,0,$prefix_len) != $prefix) $msg = $prefix.$msg;
746
+	if ($prefix_len && substr($msg, 0, $prefix_len) != $prefix) $msg = $prefix.$msg;
747 747
 
748 748
 	return $msg;
749 749
 }
@@ -757,30 +757,30 @@  discard block
 block discarded – undo
757 757
  * @param array &$matches=null on return matches of preg_match
758 758
  * @return int revision of last svn tag matching pattern
759 759
  */
760
-function get_last_svn_tag($tags_url,$pattern,&$matches=null)
760
+function get_last_svn_tag($tags_url, $pattern, &$matches = null)
761 761
 {
762
-	global $verbose,$svn;
762
+	global $verbose, $svn;
763 763
 
764 764
 	$cmd = $svn.' log --xml --limit 40 -v '.escapeshellarg($tags_url);
765 765
 	if (($v = $verbose))
766 766
 	{
767 767
 		echo "Querying SVN for last tags\n$cmd\n";
768
-		$verbose = false;	// otherwise no $output!
768
+		$verbose = false; // otherwise no $output!
769 769
 	}
770 770
 	$output = array();
771
-	run_cmd($cmd,$output);
771
+	run_cmd($cmd, $output);
772 772
 	$verbose = $v;
773
-	array_shift($output);	// remove the command
773
+	array_shift($output); // remove the command
774 774
 
775
-	$xml = simplexml_load_string($output=implode("\n",$output));
775
+	$xml = simplexml_load_string($output = implode("\n", $output));
776 776
 	$is_regexp = $pattern[0] == substr($pattern, -1);
777
-	foreach($xml as $log)
777
+	foreach ($xml as $log)
778 778
 	{
779 779
 		//print_r($log);
780 780
 		if (!$is_regexp && strpos($log->paths->path, $pattern) !== false ||
781 781
 			$is_regexp && preg_match($pattern, $log->paths->path, $matches))
782 782
 		{
783
-			if ($verbose) echo "Revision {$log['revision']} matches".($matches?': '.$matches[1] : '')."\n";
783
+			if ($verbose) echo "Revision {$log['revision']} matches".($matches ? ': '.$matches[1] : '')."\n";
784 784
 			return (int)$log['revision'];
785 785
 		}
786 786
 	}
@@ -792,9 +792,9 @@  discard block
 block discarded – undo
792 792
  *
793 793
  * @param boolean $only_update_changelog =false true update debian.changes, but nothing else, nor commit it
794 794
  */
795
-function do_obs($only_update_changelog=false)
795
+function do_obs($only_update_changelog = false)
796 796
 {
797
-	global $config,$verbose;
797
+	global $config, $verbose;
798 798
 
799 799
 	if (!is_dir($config['obs']))
800 800
 	{
@@ -804,25 +804,25 @@  discard block
 block discarded – undo
804 804
 	run_cmd('osc up '.$config['obs']);
805 805
 
806 806
 	$n = 0;
807
-	foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($config['obs'])) as $path)
807
+	foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($config['obs'])) as $path)
808 808
 	{
809 809
 		if (basename(dirname($path)) == '.osc' ||
810 810
 			!preg_match('/\/('.preg_quote($config['packagename']).
811 811
 				($config['obs_package_alias'] ? '|'.preg_quote($config['obs_package_alias']) : '').
812
-				')[a-z-]*-('.preg_quote($config['version']).'|trunk)/',$path))
812
+				')[a-z-]*-('.preg_quote($config['version']).'|trunk)/', $path))
813 813
 		{
814 814
 			continue;
815 815
 		}
816 816
 		$matches = null;
817
-		if (preg_match('/\/('.preg_quote($config['packagename']).'[a-z-]*)-'.preg_quote($config['version']).'\.[0-9.]+[0-9](\.tar\.(gz|bz2))$/',$path,$matches) &&
818
-			file_exists($new_name=$config['sourcedir'].'/'.$matches[1].'-'.$config['version'].'.'.$config['packaging'].$matches[2]))
817
+		if (preg_match('/\/('.preg_quote($config['packagename']).'[a-z-]*)-'.preg_quote($config['version']).'\.[0-9.]+[0-9](\.tar\.(gz|bz2))$/', $path, $matches) &&
818
+			file_exists($new_name = $config['sourcedir'].'/'.$matches[1].'-'.$config['version'].'.'.$config['packaging'].$matches[2]))
819 819
 		{
820 820
 			if (basename($path) != basename($new_name))
821 821
 			{
822 822
 				unlink($path);
823 823
 				if ($verbose) echo "rm $path\n";
824 824
 			}
825
-			copy($new_name,dirname($path).'/'.basename($new_name));
825
+			copy($new_name, dirname($path).'/'.basename($new_name));
826 826
 			if ($verbose) echo "cp $new_name ".dirname($path)."/\n";
827 827
 			++$n;
828 828
 		}
@@ -832,35 +832,35 @@  discard block
 block discarded – undo
832 832
 			$config['changelog'] = parse_current_changelog();
833 833
 		}
834 834
 		// updating dsc, spec and changelog files
835
-		if (!$only_update_changelog && (substr($path,-4) == '.dsc' || substr($path,-5) == '.spec') ||
835
+		if (!$only_update_changelog && (substr($path, -4) == '.dsc' || substr($path, -5) == '.spec') ||
836 836
 			!empty($config['changelog']) && basename($path) == 'debian.changes')
837 837
 		{
838 838
 			$content = $content_was = file_get_contents($path);
839 839
 
840
-			if (substr($path,-4) == '.dsc' || substr($path,-5) == '.spec')
840
+			if (substr($path, -4) == '.dsc' || substr($path, -5) == '.spec')
841 841
 			{
842
-				$content = preg_replace('/^Version: '.preg_quote($config['version']).'\.[0-9.]+[0-9]/m','Version: '.$config['version'].'.'.$config['packaging'],$content);
842
+				$content = preg_replace('/^Version: '.preg_quote($config['version']).'\.[0-9.]+[0-9]/m', 'Version: '.$config['version'].'.'.$config['packaging'], $content);
843 843
 			}
844
-			if (substr($path,-4) == '.dsc')
844
+			if (substr($path, -4) == '.dsc')
845 845
 			{
846 846
 				$content = preg_replace('/^(Debtransform-Tar: '.preg_quote($config['packagename']).'[a-z-]*)-'.
847 847
 					preg_quote($config['version']).'\.[0-9.]+[0-9](\.tar\.(gz|bz2))$/m',
848
-					'\\1-'.$config['version'].'.'.$config['packaging'].'\\2',$content);
848
+					'\\1-'.$config['version'].'.'.$config['packaging'].'\\2', $content);
849 849
 			}
850
-			if (basename($path) == 'debian.changes' && strpos($content,$config['version'].'.'.$config['packaging']) === false)
850
+			if (basename($path) == 'debian.changes' && strpos($content, $config['version'].'.'.$config['packaging']) === false)
851 851
 			{
852 852
 				$content = update_changelog($content);
853 853
 			}
854
-			if (!empty($config['changelog']) && substr($path,-5) == '.spec' &&
855
-				($pos_changelog = strpos($content,'%changelog')) !== false)
854
+			if (!empty($config['changelog']) && substr($path, -5) == '.spec' &&
855
+				($pos_changelog = strpos($content, '%changelog')) !== false)
856 856
 			{
857 857
 				$pos_changelog += strlen("%changelog\n");
858
-				$content = substr($content,0,$pos_changelog).' *'.date('D M d Y').' '.$config['changelog_packager']."\n".
859
-					$config['changelog']."\n".substr($content,$pos_changelog);
858
+				$content = substr($content, 0, $pos_changelog).' *'.date('D M d Y').' '.$config['changelog_packager']."\n".
859
+					$config['changelog']."\n".substr($content, $pos_changelog);
860 860
 			}
861 861
 			if ($content != $content_was)
862 862
 			{
863
-				file_put_contents($path,$content);
863
+				file_put_contents($path, $content);
864 864
 				if ($verbose) echo "Updated $path\n";
865 865
 				++$n;
866 866
 			}
@@ -881,33 +881,33 @@  discard block
 block discarded – undo
881 881
  * @param boolean $set_packaging =false true: set packaging from last changelog entry
882 882
  * @return string changelog entries without header and footer lines
883 883
  */
884
-function parse_current_changelog($set_packaging=false)
884
+function parse_current_changelog($set_packaging = false)
885 885
 {
886 886
 	global $config;
887 887
 
888 888
 	$changelog = file_get_contents($config['checkoutdir'].'/doc/rpm-build/debian.changes');
889 889
 	$lines = explode("\n", $changelog, 100);
890 890
 	$matches = null;
891
-	foreach($lines as $n => $line)
891
+	foreach ($lines as $n => $line)
892 892
 	{
893
-		if (preg_match($preg='/^'.preg_quote($config['packagename']).' \('.preg_quote($config['version']).'\.'.
893
+		if (preg_match($preg = '/^'.preg_quote($config['packagename']).' \('.preg_quote($config['version']).'\.'.
894 894
 			($set_packaging ? '([0-9]+)' : preg_quote($config['packaging'])).'/', $line, $matches))
895 895
 		{
896 896
 			if ($set_packaging)
897 897
 			{
898 898
 				$config['packaging'] = $matches[1];
899 899
 			}
900
-			$n += empty($lines[$n+1]) ? 2 : 1;	// overead empty line behind header
900
+			$n += empty($lines[$n + 1]) ? 2 : 1; // overead empty line behind header
901 901
 			$logentry = '';
902
-			while($lines[$n])	// entry is terminated by empty line
902
+			while ($lines[$n])	// entry is terminated by empty line
903 903
 			{
904 904
 				$logentry .= (substr($lines[$n], 0, 2) == '  ' ? substr($lines[$n], 2) : $lines[$n])."\n";
905 905
 				++$n;
906 906
 			}
907
-			return substr($logentry, 0, -1);	// remove training "\n"
907
+			return substr($logentry, 0, -1); // remove training "\n"
908 908
 		}
909 909
 	}
910
-	return null;	// paragraph for current version NOT found
910
+	return null; // paragraph for current version NOT found
911 911
 }
912 912
 
913 913
 /**
@@ -921,8 +921,8 @@  discard block
 block discarded – undo
921 921
 	global $config;
922 922
 
923 923
 	list($header) = explode("\n", $content);
924
-	$new_header = preg_replace('/\('.preg_quote($config['version']).'\.[0-9.]+[0-9](.*)\)/','('.$config['version'].'.'.$config['packaging'].'\\1)', $header);
925
-	if (substr($config['changelog'],0,2) != '  ') $config['changelog'] = '  '.implode("\n  ",explode("\n",$config['changelog']));
924
+	$new_header = preg_replace('/\('.preg_quote($config['version']).'\.[0-9.]+[0-9](.*)\)/', '('.$config['version'].'.'.$config['packaging'].'\\1)', $header);
925
+	if (substr($config['changelog'], 0, 2) != '  ') $config['changelog'] = '  '.implode("\n  ", explode("\n", $config['changelog']));
926 926
 	$content = $new_header."\n\n".$config['changelog'].
927 927
 		"\n\n -- ".$config['changelog_packager'].'  '.date('r')."\n\n".$content;
928 928
 
@@ -960,9 +960,9 @@  discard block
 block discarded – undo
960 960
 {
961 961
 	global $config;
962 962
 
963
-	if (substr($config['sourcedir'],0,2) == '~/')	// sha1_file cant deal with '~/rpm'
963
+	if (substr($config['sourcedir'], 0, 2) == '~/')	// sha1_file cant deal with '~/rpm'
964 964
 	{
965
-		$config['sourcedir'] = getenv('HOME').substr($config['sourcedir'],1);
965
+		$config['sourcedir'] = getenv('HOME').substr($config['sourcedir'], 1);
966 966
 	}
967 967
 	$sumsfile = $config['sourcedir'].'/sha1sum-'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.txt';
968 968
 
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
 	if (file_exists($sumsfile.'.asc')) unlink($sumsfile.'.asc');
982 982
 	$cmd = $config['gpg'].' --local-user '.$config['packager'].' --clearsign '.$sumsfile;
983 983
 	run_cmd($cmd);
984
-	unlink($sumsfile);	// delete the unsigned file
984
+	unlink($sumsfile); // delete the unsigned file
985 985
 }
986 986
 
987 987
 /**
@@ -991,22 +991,22 @@  discard block
 block discarded – undo
991 991
 {
992 992
 	global $config;
993 993
 
994
-	if (!file_exists($config['sourcedir'])) mkdir($config['sourcedir'],0755,true);
995
-	if (substr($config['sourcedir'],0,2) == '~/')	// sha1_file cant deal with '~/rpm'
994
+	if (!file_exists($config['sourcedir'])) mkdir($config['sourcedir'], 0755, true);
995
+	if (substr($config['sourcedir'], 0, 2) == '~/')	// sha1_file cant deal with '~/rpm'
996 996
 	{
997
-		$config['sourcedir'] = getenv('HOME').substr($config['sourcedir'],1);
997
+		$config['sourcedir'] = getenv('HOME').substr($config['sourcedir'], 1);
998 998
 	}
999 999
 	$sumsfile = $config['sourcedir'].'/sha1sum-'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.txt';
1000 1000
 	$sums = '';
1001 1001
 
1002 1002
 	chdir($config['egw_buildroot']);
1003 1003
 
1004
-	if($config['extra'])
1004
+	if ($config['extra'])
1005 1005
 	{
1006 1006
 		$exclude = $exclude_all = array();
1007
-		foreach($config['extra'] as $name => $modules)
1007
+		foreach ($config['extra'] as $name => $modules)
1008 1008
 		{
1009
-			foreach((array)$modules as $module)
1009
+			foreach ((array)$modules as $module)
1010 1010
 			{
1011 1011
 				$exclude[] = basename($module);
1012 1012
 				if (!empty($config['all-add']) && !in_array($module, $config['all-add']) && (is_int($name) || !in_array($name, $config['all-add'])))
@@ -1016,24 +1016,24 @@  discard block
 block discarded – undo
1016 1016
 			}
1017 1017
 		}
1018 1018
 		$exclude_extra = ' --exclude=egroupware/'.implode(' --exclude=egroupware/', $exclude);
1019
-		$exclude_all_extra =  $exclude_all ? ' --exclude=egroupware/'.implode(' --exclude=egroupware/', $exclude_all) : '';
1019
+		$exclude_all_extra = $exclude_all ? ' --exclude=egroupware/'.implode(' --exclude=egroupware/', $exclude_all) : '';
1020 1020
 	}
1021
-	foreach($config['types'] as $type)
1021
+	foreach ($config['types'] as $type)
1022 1022
 	{
1023 1023
 		echo "Creating $type archives\n";
1024 1024
 		$tar_type = $type == 'tar.bz2' ? 'j' : 'z';
1025 1025
 
1026 1026
 		$file = $config['sourcedir'].'/'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.'.$type;
1027
-		switch($type)
1027
+		switch ($type)
1028 1028
 		{
1029 1029
 			case 'all.tar.bz2':	// single tar-ball for debian builds not easily supporting to use multiple
1030 1030
 				$file = $config['sourcedir'].'/'.$config['packagename'].'-all-'.$config['version'].'.'.$config['packaging'].'.tar';
1031 1031
 				$cmd = $config['tar'].' --owner=root --group=root -cf '.$file.$exclude_all_extra.' egroupware';
1032 1032
 				if (!empty($config['all-add']))
1033 1033
 				{
1034
-					foreach((array)$config['all-add'] as $add)
1034
+					foreach ((array)$config['all-add'] as $add)
1035 1035
 					{
1036
-						if (substr($add, -4) != '.tar') continue;	// probably a module
1036
+						if (substr($add, -4) != '.tar') continue; // probably a module
1037 1037
 						if (!($tar = realpath($add))) throw new Exception("File '$add' not found!");
1038 1038
 						$cmd .= '; '.$config['tar'].' --owner=root --group=root -Af '.$file.' '.$tar;
1039 1039
 					}
@@ -1057,15 +1057,15 @@  discard block
 block discarded – undo
1057 1057
 		run_cmd($cmd);
1058 1058
 		$sums .= sha1_file($file)."\t".basename($file)."\n";
1059 1059
 
1060
-		foreach($config['extra'] as $name => $modules)
1060
+		foreach ($config['extra'] as $name => $modules)
1061 1061
 		{
1062 1062
 			if (is_numeric($name)) $name = $modules;
1063 1063
 			$dirs = ' egroupware/'.implode(' egroupware/', (array)$modules);
1064 1064
 			$file = $config['sourcedir'].'/'.$config['packagename'].'-'.$name.'-'.$config['version'].'.'.$config['packaging'].'.'.$type;
1065
-			switch($type)
1065
+			switch ($type)
1066 1066
 			{
1067 1067
 				case 'all.tar.bz2':
1068
-					break;	// nothing to do
1068
+					break; // nothing to do
1069 1069
 				case 'tar.bz2':
1070 1070
 				case 'tar.gz':
1071 1071
 					$cmd = $config['tar'].' --owner=root --group=root -c'.$tar_type.'f '.$file.$dirs;
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
 		}
1081 1081
 	}
1082 1082
 	// writing sha1sum file
1083
-	file_put_contents($sumsfile,$sums);
1083
+	file_put_contents($sumsfile, $sums);
1084 1084
 }
1085 1085
 
1086 1086
 /**
@@ -1088,7 +1088,7 @@  discard block
 block discarded – undo
1088 1088
  */
1089 1089
 function do_virusscan()
1090 1090
 {
1091
-	global $config,$verbose;
1091
+	global $config, $verbose;
1092 1092
 
1093 1093
 	if (!file_exists($config['clamscan']) || !is_executable($config['clamscan']))
1094 1094
 	{
@@ -1102,7 +1102,7 @@  discard block
 block discarded – undo
1102 1102
 		$cmd = '/usr/bin/sudo '.$config['freshclam'];
1103 1103
 		if (!$verbose && function_exists('posix_getuid') && posix_getuid()) echo $cmd."\n";
1104 1104
 		$output = null;
1105
-		run_cmd($cmd,$output,1);	// 1 = ignore already up to date database
1105
+		run_cmd($cmd, $output, 1); // 1 = ignore already up to date database
1106 1106
 	}
1107 1107
 	echo "Starting virusscan\n";
1108 1108
 	$cmd = $config['clamscan'].' --quiet -r '.$config['egw_buildroot'];
@@ -1159,12 +1159,12 @@  discard block
 block discarded – undo
1159 1159
  */
1160 1160
 function do_svncheckout()
1161 1161
 {
1162
-	global $config,$svn;
1162
+	global $config, $svn;
1163 1163
 
1164 1164
 	echo "Starting svn checkout/update\n";
1165 1165
 	if (!file_exists($config['checkoutdir']))
1166 1166
 	{
1167
-		mkdir($config['checkoutdir'],0755,true);
1167
+		mkdir($config['checkoutdir'], 0755, true);
1168 1168
 	}
1169 1169
 	elseif (!is_dir($config['checkoutdir']) || !is_writable($config['checkoutdir']))
1170 1170
 	{
@@ -1179,17 +1179,17 @@  discard block
 block discarded – undo
1179 1179
 		{
1180 1180
 			get_modules_per_repo();
1181 1181
 		}
1182
-		$config['svntag'] = config_translate('svntag');	// in case svntag command did not run, translate tag name
1182
+		$config['svntag'] = config_translate('svntag'); // in case svntag command did not run, translate tag name
1183 1183
 
1184 1184
 		if (file_exists($config['aliasdir']))
1185 1185
 		{
1186
-			system('/bin/rm -rf .svn '.$config['aliasdir']);	// --> remove the whole checkout, as we dont implement switching tags
1186
+			system('/bin/rm -rf .svn '.$config['aliasdir']); // --> remove the whole checkout, as we dont implement switching tags
1187 1187
 			clearstatcache();
1188 1188
 		}
1189
-		foreach($config['modules'] as $repo => $modules)
1189
+		foreach ($config['modules'] as $repo => $modules)
1190 1190
 		{
1191 1191
 			$cmd = $svn.' co ';
1192
-			foreach($modules as $path => $url)
1192
+			foreach ($modules as $path => $url)
1193 1193
 			{
1194 1194
 				if ($path == $config['aliasdir'])
1195 1195
 				{
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
 					$cmd = $svn.' co ';
1200 1200
 					continue;
1201 1201
 				}
1202
-				if(file_exists($config['aliasdir']))
1202
+				if (file_exists($config['aliasdir']))
1203 1203
 				{
1204 1204
 					die("'egroupware' applications must be first one in externals!\n");
1205 1205
 				}
@@ -1217,16 +1217,16 @@  discard block
 block discarded – undo
1217 1217
 			// check if correct branch
1218 1218
 			$cmd = 'LANG=C '.$svn.' info';
1219 1219
 			$output = $ret = null;
1220
-			exec($cmd,$output,$ret);
1221
-			foreach($output as $line)
1220
+			exec($cmd, $output, $ret);
1221
+			foreach ($output as $line)
1222 1222
 			{
1223
-				if ($ret || substr($line,0,5) == 'URL: ')
1223
+				if ($ret || substr($line, 0, 5) == 'URL: ')
1224 1224
 				{
1225
-					$url = substr($line,5);
1226
-					if ($ret || substr($url,0,strlen($svnbranch)) != $svnbranch)	// wrong branch (or no svn dir)
1225
+					$url = substr($line, 5);
1226
+					if ($ret || substr($url, 0, strlen($svnbranch)) != $svnbranch)	// wrong branch (or no svn dir)
1227 1227
 					{
1228 1228
 						echo "Checkout is of wrong branch --> deleting it\n";
1229
-						system('/bin/rm -rf .svn '.$config['aliasdir']);	// --> remove the whole checkout
1229
+						system('/bin/rm -rf .svn '.$config['aliasdir']); // --> remove the whole checkout
1230 1230
 						clearstatcache();
1231 1231
 					}
1232 1232
 					break;
@@ -1238,10 +1238,10 @@  discard block
 block discarded – undo
1238 1238
 		run_cmd($cmd);
1239 1239
 
1240 1240
 		chdir($config['aliasdir']);
1241
-		foreach($config['extra'] as $module)
1241
+		foreach ($config['extra'] as $module)
1242 1242
 		{
1243
-			$module = config_translate(null, $module);	// allow to use config vars like $svnbranch in module
1244
-			$url = strpos($module,'://') === false ? $svnbranch.'/' : '';
1243
+			$module = config_translate(null, $module); // allow to use config vars like $svnbranch in module
1244
+			$url = strpos($module, '://') === false ? $svnbranch.'/' : '';
1245 1245
 			$url .= $module;
1246 1246
 			$cmd = $svn.' co '.$url;
1247 1247
 			run_cmd($cmd);
@@ -1266,7 +1266,7 @@  discard block
 block discarded – undo
1266 1266
  */
1267 1267
 function get_modules_per_svn_repo()
1268 1268
 {
1269
-	global $config,$svn,$verbose;
1269
+	global $config, $svn, $verbose;
1270 1270
 
1271 1271
 	// process alias/externals
1272 1272
 	$svnbranch = $config['svnbase'].'/'.$config['svnbranch'];
@@ -1274,27 +1274,27 @@  discard block
 block discarded – undo
1274 1274
 	$cmd = $svn.' propget svn:externals --strict '.$url;
1275 1275
 	if ($verbose) echo $cmd."\n";
1276 1276
 	$output = $ret = null;
1277
-	exec($cmd,$output,$ret);
1277
+	exec($cmd, $output, $ret);
1278 1278
 	$config['modules'] = array();
1279
-	foreach($output as $line)
1279
+	foreach ($output as $line)
1280 1280
 	{
1281 1281
 		$line = trim($line);
1282 1282
 		if (empty($line) || $line[0] == '#') continue;
1283
-		list($path,$url) = preg_split('/[ \t\r\n]+/',$line);
1283
+		list($path, $url) = preg_split('/[ \t\r\n]+/', $line);
1284 1284
 		$matches = null;
1285
-		if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) die("Invalid SVN URL: $url\n");
1285
+		if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/', $url, $matches)) die("Invalid SVN URL: $url\n");
1286 1286
 		$repo = $matches[1];
1287 1287
 		if ($repo == 'http://svn.egroupware.org/egroupware') $repo = 'svn+ssh://[email protected]/egroupware';
1288 1288
 		$config['modules'][$repo][$path] = $url;
1289 1289
 	}
1290 1290
 	// process extra modules
1291
-	foreach($config['extra'] as $module)
1291
+	foreach ($config['extra'] as $module)
1292 1292
 	{
1293
-		$module = config_translate(null, $module);	// allow to use config vars like $svnbranch in module
1294
-		$url = strpos($module,'://') === false ? $svnbranch.'/' : '';
1293
+		$module = config_translate(null, $module); // allow to use config vars like $svnbranch in module
1294
+		$url = strpos($module, '://') === false ? $svnbranch.'/' : '';
1295 1295
 		$url .= $module;
1296
-		if (strpos($module,'://') !== false) $module = basename($module);
1297
-		if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) die("Invalid SVN URL: $url\n");
1296
+		if (strpos($module, '://') !== false) $module = basename($module);
1297
+		if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/', $url, $matches)) die("Invalid SVN URL: $url\n");
1298 1298
 		$repo = $matches[1];
1299 1299
 		if ($repo == 'http://svn.egroupware.org/egroupware') $repo = 'svn+ssh://[email protected]/egroupware';
1300 1300
 		$config['modules'][$repo][$config['aliasdir'].'/'.$module] = $url;
@@ -1308,11 +1308,11 @@  discard block
 block discarded – undo
1308 1308
  */
1309 1309
 function do_svntag()
1310 1310
 {
1311
-	global $config,$svn;
1311
+	global $config, $svn;
1312 1312
 
1313
-	if (empty($config['svntag'])) return;	// otherwise we copy everything in svn root!
1313
+	if (empty($config['svntag'])) return; // otherwise we copy everything in svn root!
1314 1314
 
1315
-	$config['svntag'] = config_translate('svntag');	// allow to use config vars like $version in tag
1315
+	$config['svntag'] = config_translate('svntag'); // allow to use config vars like $version in tag
1316 1316
 
1317 1317
 	echo "Creating SVN tag $config[svntag]\n";
1318 1318
 	if (!isset($config['modules']))
@@ -1320,9 +1320,9 @@  discard block
 block discarded – undo
1320 1320
 		get_modules_per_repo();
1321 1321
 	}
1322 1322
 	// create tags (per repo)
1323
-	foreach($config['modules'] as $repo => $modules)
1323
+	foreach ($config['modules'] as $repo => $modules)
1324 1324
 	{
1325
-		$cmd = $svn.' cp --parents -m '.escapeshellarg('Creating '.$config['svntag']).' '.implode(' ',$modules).' '.$repo.'/'.$config['svntag'].'/';
1325
+		$cmd = $svn.' cp --parents -m '.escapeshellarg('Creating '.$config['svntag']).' '.implode(' ', $modules).' '.$repo.'/'.$config['svntag'].'/';
1326 1326
 		run_cmd($cmd);
1327 1327
 	}
1328 1328
 }
@@ -1341,7 +1341,7 @@  discard block
 block discarded – undo
1341 1341
  * @throws Exception on non-zero exit-code not matching $no_bailout
1342 1342
  * @return int exit code of $cmd
1343 1343
  */
1344
-function run_cmd($cmd,array &$output=null,$no_bailout=null)
1344
+function run_cmd($cmd, array &$output = null, $no_bailout = null)
1345 1345
 {
1346 1346
 	global $verbose;
1347 1347
 
@@ -1349,18 +1349,18 @@  discard block
 block discarded – undo
1349 1349
 	{
1350 1350
 		echo $cmd."\n";
1351 1351
 		$ret = null;
1352
-		system($cmd,$ret);
1352
+		system($cmd, $ret);
1353 1353
 	}
1354 1354
 	else
1355 1355
 	{
1356 1356
 		$output[] = $cmd;
1357
-		exec($cmd,$output,$ret);
1358
-		if ($verbose) echo implode("\n",$output)."\n";
1357
+		exec($cmd, $output, $ret);
1358
+		if ($verbose) echo implode("\n", $output)."\n";
1359 1359
 	}
1360
-	if ($ret && !in_array($ret,(array)$no_bailout))
1360
+	if ($ret && !in_array($ret, (array)$no_bailout))
1361 1361
 	{
1362
-		if (!$verbose) echo implode("\n",$output)."\n";
1363
-		throw new Exception("Error during '$cmd' --> aborting",$ret);
1362
+		if (!$verbose) echo implode("\n", $output)."\n";
1363
+		throw new Exception("Error during '$cmd' --> aborting", $ret);
1364 1364
 	}
1365 1365
 	return $ret;
1366 1366
 }
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
 			return 'NULL';
1388 1388
 		case 'object':
1389 1389
 		case 'array':
1390
-			return str_replace(array("\n",'    '/*,'Array'*/),'',print_r($var,true));
1390
+			return str_replace(array("\n", '    '/*,'Array'*/), '', print_r($var, true));
1391 1391
 	}
1392 1392
 	return 'UNKNOWN TYPE!';
1393 1393
 }
@@ -1397,9 +1397,9 @@  discard block
 block discarded – undo
1397 1397
  *
1398 1398
  * @param string $error =null optional error-message
1399 1399
  */
1400
-function usage($error=null)
1400
+function usage($error = null)
1401 1401
 {
1402
-	global $prog,$config,$verbose;
1402
+	global $prog, $config, $verbose;
1403 1403
 
1404 1404
 	echo "Usage: $prog [-h|--help] [-v|--verbose] [options, ...]\n\n";
1405 1405
 	echo "options and their defaults:\n";
@@ -1409,12 +1409,12 @@  discard block
 block discarded – undo
1409 1409
 	}
1410 1410
 	else
1411 1411
 	{
1412
-		unset($config['modules']);	// they give an error, because of nested array and are quite lengthy
1412
+		unset($config['modules']); // they give an error, because of nested array and are quite lengthy
1413 1413
 	}
1414
-	foreach($config as $name => $default)
1414
+	foreach ($config as $name => $default)
1415 1415
 	{
1416
-		if (is_array($default)) $default = json_encode ($default, JSON_UNESCAPED_SLASHES);
1417
-		echo '--'.str_pad($name,20).$default."\n";
1416
+		if (is_array($default)) $default = json_encode($default, JSON_UNESCAPED_SLASHES);
1417
+		echo '--'.str_pad($name, 20).$default."\n";
1418 1418
 	}
1419 1419
 	if ($error)
1420 1420
 	{
Please login to merge, or discard this patch.
Braces   +236 added lines, -58 removed lines patch added patch discarded remove patch
@@ -9,10 +9,13 @@  discard block
 block discarded – undo
9 9
  * @copyright (c) 2009-19 by Ralf Becker <[email protected]>
10 10
  */
11 11
 
12
-if (php_sapi_name() !== 'cli')	// security precaution: forbit calling setup-cli as web-page
12
+if (php_sapi_name() !== 'cli')
13
+{
14
+	// security precaution: forbit calling setup-cli as web-page
13 15
 {
14 16
 	die('<h1>checkout-build-archives.php must NOT be called as web-page --> exiting !!!</h1>');
15 17
 }
18
+}
16 19
 date_default_timezone_set('Europe/Berlin');	// to get ride of 5.3 warnings
17 20
 
18 21
 $verbose = 0;
@@ -135,7 +138,10 @@  discard block
 block discarded – undo
135 138
 			case 'release':
136 139
 			case 'copychangelog':
137 140
 				$config[$name] = $value;
138
-				if ($value) array_unshift($config['run'],$name);
141
+				if ($value)
142
+				{
143
+					array_unshift($config['run'],$name);
144
+				}
139 145
 				break;
140 146
 
141 147
 			case 'editchangelog':
@@ -151,7 +157,10 @@  discard block
 block discarded – undo
151 157
 				{
152 158
 					usage("Path '$value' not found!");
153 159
 				}
154
-				if (!in_array('obs',$config['run'])) $config['run'][] = 'obs';
160
+				if (!in_array('obs',$config['run']))
161
+				{
162
+					$config['run'][] = 'obs';
163
+				}
155 164
 				// fall through
156 165
 			default:
157 166
 				$config[$name] = $value;
@@ -211,7 +220,10 @@  discard block
 block discarded – undo
211 220
 	if (!empty($last_tag))
212 221
 	{
213 222
 		$cmd = $config['git'].' log '.escapeshellarg($last_tag.'..HEAD');
214
-		if (getcwd() != $path) $cmd = 'cd '.$path.'; '.$cmd;
223
+		if (getcwd() != $path)
224
+		{
225
+			$cmd = 'cd '.$path.'; '.$cmd;
226
+		}
215 227
 		$output = null;
216 228
 		run_cmd($cmd, $output);
217 229
 
@@ -242,7 +254,10 @@  discard block
 block discarded – undo
242 254
 {
243 255
 	global $config, $verbose;
244 256
 
245
-	if ($verbose) echo "Get modules from .mrconfig in checkoutdir $config[checkoutdir]\n";
257
+	if ($verbose)
258
+	{
259
+		echo "Get modules from .mrconfig in checkoutdir $config[checkoutdir]\n";
260
+	}
246 261
 
247 262
 	if (!is_dir($config['checkoutdir']))
248 263
 	{
@@ -273,12 +288,21 @@  discard block
 block discarded – undo
273 288
 		elseif (isset($module) && preg_match('/^checkout\s*=\s*(git\s+clone\s+(-b\s+[0-9.]+\s+)?((git|http)[^ ]+)|svn\s+checkout\s+((svn|http)[^ ]+))/', $line, $matches))
274 289
 		{
275 290
 			$repo = $url = substr($matches[1], 0, 3) == 'svn' ? $matches[5] : $matches[3];
276
-			if (substr($matches[1], 0, 3) == 'svn') $repo = preg_replace('#/(trunk|branches)/.*$#', '', $repo);
291
+			if (substr($matches[1], 0, 3) == 'svn')
292
+			{
293
+				$repo = preg_replace('#/(trunk|branches)/.*$#', '', $repo);
294
+			}
277 295
 			$modules[$repo][$config['aliasdir'].($module ? '/'.$module : '')] = $url;
278
-			if ($module === '' && !isset($baseurl)) $baseurl = str_replace('/egroupware.git', '', $url);
296
+			if ($module === '' && !isset($baseurl))
297
+			{
298
+				$baseurl = str_replace('/egroupware.git', '', $url);
299
+			}
279 300
 		}
280 301
 	}
281
-	if ($verbose) print_r($modules);
302
+	if ($verbose)
303
+	{
304
+		print_r($modules);
305
+	}
282 306
 	return $modules;
283 307
 }
284 308
 
@@ -345,7 +369,11 @@  discard block
 block discarded – undo
345 369
 
346 370
 	$config['tag'] = config_translate('tag');	// allow to use config vars like $version in tag
347 371
 
348
-	if (empty($config['tag'])) return;	// otherwise we copy everything in svn root!
372
+	if (empty($config['tag']))
373
+	{
374
+		return;
375
+	}
376
+	// otherwise we copy everything in svn root!
349 377
 
350 378
 	echo "Creating tag and pushing $config[tag]\n";
351 379
 
@@ -409,7 +437,10 @@  discard block
 block discarded – undo
409 437
 	global $config,$verbose;
410 438
 
411 439
 	// push local changes to Github incl. tag (tags of apps are already pushed by do_tag)
412
-	if ($verbose) echo "Pushing changes and tags\n";
440
+	if ($verbose)
441
+	{
442
+		echo "Pushing changes and tags\n";
443
+	}
413 444
 	chdir($config['checkoutdir']);
414 445
 	run_cmd($config['git'].' push');
415 446
 	$tag = config_translate('tag');
@@ -476,7 +507,10 @@  discard block
 block discarded – undo
476 507
 		{
477 508
 			continue;
478 509
 		}
479
-		if ($verbose) echo "Uploading $path as $content_type\n";
510
+		if ($verbose)
511
+		{
512
+			echo "Uploading $path as $content_type\n";
513
+		}
480 514
 		$name = basename($path);
481 515
 		github_api($config['upload_url'], array(
482 516
 			'name' => $name,
@@ -488,7 +522,10 @@  discard block
 block discarded – undo
488 522
 	{
489 523
 		$target = config_translate('release');	// allow to use config vars like $svnbranch in module
490 524
 		$cmd = $config['rsync'].' '.$archives.' '.$target;
491
-		if ($verbose) echo $cmd."\n";
525
+		if ($verbose)
526
+		{
527
+			echo $cmd."\n";
528
+		}
492 529
 		passthru($cmd);
493 530
 	}
494 531
 }
@@ -521,25 +558,40 @@  discard block
 block discarded – undo
521 558
 	{
522 559
 		case 'POST':
523 560
 			curl_setopt($c, CURLOPT_POST, true);
524
-			if (is_array($data)) $data = json_encode($data, JSON_FORCE_OBJECT);
561
+			if (is_array($data))
562
+			{
563
+				$data = json_encode($data, JSON_FORCE_OBJECT);
564
+			}
525 565
 			curl_setopt($c, CURLOPT_POSTFIELDS, $data);
526 566
 			break;
527 567
 		case 'GET':
528
-			if(count($data)) $url .= '?' . http_build_query($data);
568
+			if(count($data))
569
+			{
570
+				$url .= '?' . http_build_query($data);
571
+			}
529 572
 			break;
530 573
 		case 'FILE':
531 574
 			curl_setopt($c, CURLOPT_HTTPHEADER, array("Content-type: $content_type"));
532 575
 			curl_setopt($c, CURLOPT_POST, true);
533 576
 			curl_setopt($c, CURLOPT_POSTFIELDS, file_get_contents($upload));
534
-			if(count($data)) $url .= '?' . http_build_query($data);
577
+			if(count($data))
578
+			{
579
+				$url .= '?' . http_build_query($data);
580
+			}
535 581
 			break;
536 582
 		default:
537 583
 			throw new Exception(__FUNCTION__.": Unknown/unimplemented method=$method!");
538 584
 	}
539 585
 	curl_setopt($c, CURLOPT_URL, $url);
540 586
 
541
-	if (is_string($data)) $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data;
542
-	if ($verbose) echo "Sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n";
587
+	if (is_string($data))
588
+	{
589
+		$short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data;
590
+	}
591
+	if ($verbose)
592
+	{
593
+		echo "Sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n";
594
+	}
543 595
 
544 596
 	if (($response = curl_exec($c)) === false)
545 597
 	{
@@ -550,7 +602,10 @@  discard block
 block discarded – undo
550 602
 		throw new Exception("$method request to $url failed ".(isset($short_data)&&$method!='GET'?$short_data:''));
551 603
 	}
552 604
 
553
-	if ($verbose) echo (strlen($response) > 200 ? substr($response, 0, 200).' ...' : $response)."\n";
605
+	if ($verbose)
606
+	{
607
+		echo (strlen($response) > 200 ? substr($response, 0, 200).' ...' : $response)."\n";
608
+	}
554 609
 
555 610
 	curl_close($c);
556 611
 
@@ -567,13 +622,19 @@  discard block
 block discarded – undo
567 622
 {
568 623
 	global $config;
569 624
 
570
-	if (!isset($value)) $value = $config[$name];
625
+	if (!isset($value))
626
+	{
627
+		$value = $config[$name];
628
+	}
571 629
 	if (is_string($value) && strpos($value, '$') !== false)
572 630
 	{
573 631
 		$translate = array();
574 632
 		foreach($config as $n => $val)
575 633
 		{
576
-			if (is_string($val)) $translate['$'.$n] = $val;
634
+			if (is_string($val))
635
+			{
636
+				$translate['$'.$n] = $val;
637
+			}
577 638
 		}
578 639
 		$value = strtr($value, $translate);
579 640
 	}
@@ -682,7 +743,10 @@  discard block
 block discarded – undo
682 743
 	if (is_null($revision))
683 744
 	{
684 745
 		list($tags_url,$branch) = preg_split('#/(branches/|trunk)#',$branch_url);
685
-		if (empty($branch)) $branch = $config['version'];
746
+		if (empty($branch))
747
+		{
748
+			$branch = $config['version'];
749
+		}
686 750
 		$tags_url .= '/tags';
687 751
 		$pattern='|/tags/('.preg_quote($config['version'], '|').'\.[0-9.]+)|';
688 752
 		$matches = null;
@@ -708,11 +772,18 @@  discard block
 block discarded – undo
708 772
 	$message = '';
709 773
 	foreach($xml as $log)
710 774
 	{
711
-		if (!($msg = _match_log_pattern($log->msg, $log_pattern, $prefix))) continue;	// no match --> ignore
775
+		if (!($msg = _match_log_pattern($log->msg, $log_pattern, $prefix)))
776
+		{
777
+			continue;
778
+		}
779
+		// no match --> ignore
712 780
 
713 781
 		$message .= $msg."\n";
714 782
 	}
715
-	if ($verbose) echo $message;
783
+	if ($verbose)
784
+	{
785
+		echo $message;
786
+	}
716 787
 
717 788
 	return $message;
718 789
 }
@@ -743,7 +814,10 @@  discard block
 block discarded – undo
743 814
 	{
744 815
 		return null;
745 816
 	}
746
-	if ($prefix_len && substr($msg,0,$prefix_len) != $prefix) $msg = $prefix.$msg;
817
+	if ($prefix_len && substr($msg,0,$prefix_len) != $prefix)
818
+	{
819
+		$msg = $prefix.$msg;
820
+	}
747 821
 
748 822
 	return $msg;
749 823
 }
@@ -780,7 +854,10 @@  discard block
 block discarded – undo
780 854
 		if (!$is_regexp && strpos($log->paths->path, $pattern) !== false ||
781 855
 			$is_regexp && preg_match($pattern, $log->paths->path, $matches))
782 856
 		{
783
-			if ($verbose) echo "Revision {$log['revision']} matches".($matches?': '.$matches[1] : '')."\n";
857
+			if ($verbose)
858
+			{
859
+				echo "Revision {$log['revision']} matches".($matches?': '.$matches[1] : '')."\n";
860
+			}
784 861
 			return (int)$log['revision'];
785 862
 		}
786 863
 	}
@@ -800,7 +877,10 @@  discard block
 block discarded – undo
800 877
 	{
801 878
 		usage("Path '$config[obs]' not found!");
802 879
 	}
803
-	if ($verbose) echo $only_update_changelog ? "Updating OBS changelogs\n" : "Updating OBS checkout\n";
880
+	if ($verbose)
881
+	{
882
+		echo $only_update_changelog ? "Updating OBS changelogs\n" : "Updating OBS checkout\n";
883
+	}
804 884
 	run_cmd('osc up '.$config['obs']);
805 885
 
806 886
 	$n = 0;
@@ -820,10 +900,16 @@  discard block
 block discarded – undo
820 900
 			if (basename($path) != basename($new_name))
821 901
 			{
822 902
 				unlink($path);
823
-				if ($verbose) echo "rm $path\n";
903
+				if ($verbose)
904
+				{
905
+					echo "rm $path\n";
906
+				}
824 907
 			}
825 908
 			copy($new_name,dirname($path).'/'.basename($new_name));
826
-			if ($verbose) echo "cp $new_name ".dirname($path)."/\n";
909
+			if ($verbose)
910
+			{
911
+				echo "cp $new_name ".dirname($path)."/\n";
912
+			}
827 913
 			++$n;
828 914
 		}
829 915
 		// if we have no changelog (eg. because commands run separate), try parsing it from changelog file
@@ -861,7 +947,10 @@  discard block
 block discarded – undo
861 947
 			if ($content != $content_was)
862 948
 			{
863 949
 				file_put_contents($path,$content);
864
-				if ($verbose) echo "Updated $path\n";
950
+				if ($verbose)
951
+				{
952
+					echo "Updated $path\n";
953
+				}
865 954
 				++$n;
866 955
 			}
867 956
 		}
@@ -899,9 +988,12 @@  discard block
 block discarded – undo
899 988
 			}
900 989
 			$n += empty($lines[$n+1]) ? 2 : 1;	// overead empty line behind header
901 990
 			$logentry = '';
902
-			while($lines[$n])	// entry is terminated by empty line
991
+			while($lines[$n])
992
+			{
993
+				// entry is terminated by empty line
903 994
 			{
904 995
 				$logentry .= (substr($lines[$n], 0, 2) == '  ' ? substr($lines[$n], 2) : $lines[$n])."\n";
996
+			}
905 997
 				++$n;
906 998
 			}
907 999
 			return substr($logentry, 0, -1);	// remove training "\n"
@@ -922,7 +1014,10 @@  discard block
 block discarded – undo
922 1014
 
923 1015
 	list($header) = explode("\n", $content);
924 1016
 	$new_header = preg_replace('/\('.preg_quote($config['version']).'\.[0-9.]+[0-9](.*)\)/','('.$config['version'].'.'.$config['packaging'].'\\1)', $header);
925
-	if (substr($config['changelog'],0,2) != '  ') $config['changelog'] = '  '.implode("\n  ",explode("\n",$config['changelog']));
1017
+	if (substr($config['changelog'],0,2) != '  ')
1018
+	{
1019
+		$config['changelog'] = '  '.implode("\n  ",explode("\n",$config['changelog']));
1020
+	}
926 1021
 	$content = $new_header."\n\n".$config['changelog'].
927 1022
 		"\n\n -- ".$config['changelog_packager'].'  '.date('r')."\n\n".$content;
928 1023
 
@@ -960,10 +1055,13 @@  discard block
 block discarded – undo
960 1055
 {
961 1056
 	global $config;
962 1057
 
963
-	if (substr($config['sourcedir'],0,2) == '~/')	// sha1_file cant deal with '~/rpm'
1058
+	if (substr($config['sourcedir'],0,2) == '~/')
1059
+	{
1060
+		// sha1_file cant deal with '~/rpm'
964 1061
 	{
965 1062
 		$config['sourcedir'] = getenv('HOME').substr($config['sourcedir'],1);
966 1063
 	}
1064
+	}
967 1065
 	$sumsfile = $config['sourcedir'].'/sha1sum-'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.txt';
968 1066
 
969 1067
 	if (!file_exists($sumsfile))
@@ -974,11 +1072,17 @@  discard block
 block discarded – undo
974 1072
 	// signing it
975 1073
 	if (empty($config['gpg']) || !file_exists($config['gpg']))
976 1074
 	{
977
-		if (!empty($config['gpg'])) echo "{$config['gpg']} not found --> skipping signing sha1sum file!\n";
1075
+		if (!empty($config['gpg']))
1076
+		{
1077
+			echo "{$config['gpg']} not found --> skipping signing sha1sum file!\n";
1078
+		}
978 1079
 		return;
979 1080
 	}
980 1081
 	echo "Signing sha1sum file:\n";
981
-	if (file_exists($sumsfile.'.asc')) unlink($sumsfile.'.asc');
1082
+	if (file_exists($sumsfile.'.asc'))
1083
+	{
1084
+		unlink($sumsfile.'.asc');
1085
+	}
982 1086
 	$cmd = $config['gpg'].' --local-user '.$config['packager'].' --clearsign '.$sumsfile;
983 1087
 	run_cmd($cmd);
984 1088
 	unlink($sumsfile);	// delete the unsigned file
@@ -991,11 +1095,17 @@  discard block
 block discarded – undo
991 1095
 {
992 1096
 	global $config;
993 1097
 
994
-	if (!file_exists($config['sourcedir'])) mkdir($config['sourcedir'],0755,true);
995
-	if (substr($config['sourcedir'],0,2) == '~/')	// sha1_file cant deal with '~/rpm'
1098
+	if (!file_exists($config['sourcedir']))
1099
+	{
1100
+		mkdir($config['sourcedir'],0755,true);
1101
+	}
1102
+	if (substr($config['sourcedir'],0,2) == '~/')
1103
+	{
1104
+		// sha1_file cant deal with '~/rpm'
996 1105
 	{
997 1106
 		$config['sourcedir'] = getenv('HOME').substr($config['sourcedir'],1);
998 1107
 	}
1108
+	}
999 1109
 	$sumsfile = $config['sourcedir'].'/sha1sum-'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.txt';
1000 1110
 	$sums = '';
1001 1111
 
@@ -1033,12 +1143,22 @@  discard block
 block discarded – undo
1033 1143
 				{
1034 1144
 					foreach((array)$config['all-add'] as $add)
1035 1145
 					{
1036
-						if (substr($add, -4) != '.tar') continue;	// probably a module
1037
-						if (!($tar = realpath($add))) throw new Exception("File '$add' not found!");
1146
+						if (substr($add, -4) != '.tar')
1147
+						{
1148
+							continue;
1149
+						}
1150
+						// probably a module
1151
+						if (!($tar = realpath($add)))
1152
+						{
1153
+							throw new Exception("File '$add' not found!");
1154
+						}
1038 1155
 						$cmd .= '; '.$config['tar'].' --owner=root --group=root -Af '.$file.' '.$tar;
1039 1156
 					}
1040 1157
 				}
1041
-				if (file_exists($file.'.bz2')) $cmd .= '; rm -f '.$file.'.bz2';
1158
+				if (file_exists($file.'.bz2'))
1159
+				{
1160
+					$cmd .= '; rm -f '.$file.'.bz2';
1161
+				}
1042 1162
 				$cmd .= '; '.$config['bzip2'].' '.$file;
1043 1163
 				// run cmd now and continue without adding all tar-ball to sums, as we dont want to publish it
1044 1164
 				run_cmd($cmd);
@@ -1059,7 +1179,10 @@  discard block
 block discarded – undo
1059 1179
 
1060 1180
 		foreach($config['extra'] as $name => $modules)
1061 1181
 		{
1062
-			if (is_numeric($name)) $name = $modules;
1182
+			if (is_numeric($name))
1183
+			{
1184
+				$name = $modules;
1185
+			}
1063 1186
 			$dirs = ' egroupware/'.implode(' egroupware/', (array)$modules);
1064 1187
 			$file = $config['sourcedir'].'/'.$config['packagename'].'-'.$name.'-'.$config['version'].'.'.$config['packaging'].'.'.$type;
1065 1188
 			switch($type)
@@ -1100,7 +1223,10 @@  discard block
 block discarded – undo
1100 1223
 	{
1101 1224
 		echo "Updating virus signatures\n";
1102 1225
 		$cmd = '/usr/bin/sudo '.$config['freshclam'];
1103
-		if (!$verbose && function_exists('posix_getuid') && posix_getuid()) echo $cmd."\n";
1226
+		if (!$verbose && function_exists('posix_getuid') && posix_getuid())
1227
+		{
1228
+			echo $cmd."\n";
1229
+		}
1104 1230
 		$output = null;
1105 1231
 		run_cmd($cmd,$output,1);	// 1 = ignore already up to date database
1106 1232
 	}
@@ -1128,7 +1254,10 @@  discard block
 block discarded – undo
1128 1254
 	}
1129 1255
 
1130 1256
 	// we need to stash uncommited changes like .mrconfig, before copying
1131
-	if (file_exists($config['checkoutdir'].'/.git')) run_cmd("cd $config[checkoutdir]; git stash");
1257
+	if (file_exists($config['checkoutdir'].'/.git'))
1258
+	{
1259
+		run_cmd("cd $config[checkoutdir]; git stash");
1260
+	}
1132 1261
 
1133 1262
 	try {
1134 1263
 		$cmd = '/usr/bin/rsync -r --delete --delete-excluded --exclude .svn --exclude .git\* --exclude .mrconfig --exclude node_modules/ --exclude tests '.$config['checkoutdir'].'/ '.$config['egw_buildroot'].'/'.$config['aliasdir'].'/';
@@ -1137,8 +1266,14 @@  discard block
 block discarded – undo
1137 1266
 	catch (Exception $e) {
1138 1267
 		// catch failures to pop stash, before throwing exception
1139 1268
 	}
1140
-	if (file_exists($config['checkoutdir'].'/.git')) run_cmd("git stash pop");
1141
-	if (isset($e)) throw $e;
1269
+	if (file_exists($config['checkoutdir'].'/.git'))
1270
+	{
1271
+		run_cmd("git stash pop");
1272
+	}
1273
+	if (isset($e))
1274
+	{
1275
+		throw $e;
1276
+	}
1142 1277
 
1143 1278
 	if (($cmd = config_translate('patchCmd')) && $cmd[0] != '#')
1144 1279
 	{
@@ -1223,9 +1358,12 @@  discard block
 block discarded – undo
1223 1358
 				if ($ret || substr($line,0,5) == 'URL: ')
1224 1359
 				{
1225 1360
 					$url = substr($line,5);
1226
-					if ($ret || substr($url,0,strlen($svnbranch)) != $svnbranch)	// wrong branch (or no svn dir)
1361
+					if ($ret || substr($url,0,strlen($svnbranch)) != $svnbranch)
1362
+					{
1363
+						// wrong branch (or no svn dir)
1227 1364
 					{
1228 1365
 						echo "Checkout is of wrong branch --> deleting it\n";
1366
+					}
1229 1367
 						system('/bin/rm -rf .svn '.$config['aliasdir']);	// --> remove the whole checkout
1230 1368
 						clearstatcache();
1231 1369
 					}
@@ -1272,19 +1410,31 @@  discard block
 block discarded – undo
1272 1410
 	$svnbranch = $config['svnbase'].'/'.$config['svnbranch'];
1273 1411
 	$url = $svnbranch.'/'.$config['svnalias'];
1274 1412
 	$cmd = $svn.' propget svn:externals --strict '.$url;
1275
-	if ($verbose) echo $cmd."\n";
1413
+	if ($verbose)
1414
+	{
1415
+		echo $cmd."\n";
1416
+	}
1276 1417
 	$output = $ret = null;
1277 1418
 	exec($cmd,$output,$ret);
1278 1419
 	$config['modules'] = array();
1279 1420
 	foreach($output as $line)
1280 1421
 	{
1281 1422
 		$line = trim($line);
1282
-		if (empty($line) || $line[0] == '#') continue;
1423
+		if (empty($line) || $line[0] == '#')
1424
+		{
1425
+			continue;
1426
+		}
1283 1427
 		list($path,$url) = preg_split('/[ \t\r\n]+/',$line);
1284 1428
 		$matches = null;
1285
-		if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) die("Invalid SVN URL: $url\n");
1429
+		if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches))
1430
+		{
1431
+			die("Invalid SVN URL: $url\n");
1432
+		}
1286 1433
 		$repo = $matches[1];
1287
-		if ($repo == 'http://svn.egroupware.org/egroupware') $repo = 'svn+ssh://[email protected]/egroupware';
1434
+		if ($repo == 'http://svn.egroupware.org/egroupware')
1435
+		{
1436
+			$repo = 'svn+ssh://[email protected]/egroupware';
1437
+		}
1288 1438
 		$config['modules'][$repo][$path] = $url;
1289 1439
 	}
1290 1440
 	// process extra modules
@@ -1293,13 +1443,25 @@  discard block
 block discarded – undo
1293 1443
 		$module = config_translate(null, $module);	// allow to use config vars like $svnbranch in module
1294 1444
 		$url = strpos($module,'://') === false ? $svnbranch.'/' : '';
1295 1445
 		$url .= $module;
1296
-		if (strpos($module,'://') !== false) $module = basename($module);
1297
-		if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) die("Invalid SVN URL: $url\n");
1446
+		if (strpos($module,'://') !== false)
1447
+		{
1448
+			$module = basename($module);
1449
+		}
1450
+		if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches))
1451
+		{
1452
+			die("Invalid SVN URL: $url\n");
1453
+		}
1298 1454
 		$repo = $matches[1];
1299
-		if ($repo == 'http://svn.egroupware.org/egroupware') $repo = 'svn+ssh://[email protected]/egroupware';
1455
+		if ($repo == 'http://svn.egroupware.org/egroupware')
1456
+		{
1457
+			$repo = 'svn+ssh://[email protected]/egroupware';
1458
+		}
1300 1459
 		$config['modules'][$repo][$config['aliasdir'].'/'.$module] = $url;
1301 1460
 	}
1302
-	if ($verbose) print_r($config['modules']);
1461
+	if ($verbose)
1462
+	{
1463
+		print_r($config['modules']);
1464
+	}
1303 1465
 	return $config['modules'];
1304 1466
 }
1305 1467
 
@@ -1310,7 +1472,11 @@  discard block
 block discarded – undo
1310 1472
 {
1311 1473
 	global $config,$svn;
1312 1474
 
1313
-	if (empty($config['svntag'])) return;	// otherwise we copy everything in svn root!
1475
+	if (empty($config['svntag']))
1476
+	{
1477
+		return;
1478
+	}
1479
+	// otherwise we copy everything in svn root!
1314 1480
 
1315 1481
 	$config['svntag'] = config_translate('svntag');	// allow to use config vars like $version in tag
1316 1482
 
@@ -1355,11 +1521,17 @@  discard block
 block discarded – undo
1355 1521
 	{
1356 1522
 		$output[] = $cmd;
1357 1523
 		exec($cmd,$output,$ret);
1358
-		if ($verbose) echo implode("\n",$output)."\n";
1524
+		if ($verbose)
1525
+		{
1526
+			echo implode("\n",$output)."\n";
1527
+		}
1359 1528
 	}
1360 1529
 	if ($ret && !in_array($ret,(array)$no_bailout))
1361 1530
 	{
1362
-		if (!$verbose) echo implode("\n",$output)."\n";
1531
+		if (!$verbose)
1532
+		{
1533
+			echo implode("\n",$output)."\n";
1534
+		}
1363 1535
 		throw new Exception("Error during '$cmd' --> aborting",$ret);
1364 1536
 	}
1365 1537
 	return $ret;
@@ -1405,7 +1577,10 @@  discard block
 block discarded – undo
1405 1577
 	echo "options and their defaults:\n";
1406 1578
 	if ($verbose)
1407 1579
 	{
1408
-		if (!isset($config['modules'])) $config['modules'] = get_modules_per_repo();
1580
+		if (!isset($config['modules']))
1581
+		{
1582
+			$config['modules'] = get_modules_per_repo();
1583
+		}
1409 1584
 	}
1410 1585
 	else
1411 1586
 	{
@@ -1413,7 +1588,10 @@  discard block
 block discarded – undo
1413 1588
 	}
1414 1589
 	foreach($config as $name => $default)
1415 1590
 	{
1416
-		if (is_array($default)) $default = json_encode ($default, JSON_UNESCAPED_SLASHES);
1591
+		if (is_array($default))
1592
+		{
1593
+			$default = json_encode ($default, JSON_UNESCAPED_SLASHES);
1594
+		}
1417 1595
 		echo '--'.str_pad($name,20).$default."\n";
1418 1596
 	}
1419 1597
 	if ($error)
Please login to merge, or discard this patch.
api/src/CalDAV.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2033,7 +2033,7 @@
 block discarded – undo
2033 2033
 	 *
2034 2034
 	 * Reimplemented to add logging
2035 2035
 	 *
2036
-     * @param  $prefix =null prefix filesystem path with given path, eg. "/webdav" for owncloud 4.5 remote.php
2036
+	 * @param  $prefix =null prefix filesystem path with given path, eg. "/webdav" for owncloud 4.5 remote.php
2037 2037
 	 */
2038 2038
 	function ServeRequest($prefix=null)
2039 2039
 	{
Please login to merge, or discard this patch.
Doc Comments   +9 added lines, -7 removed lines patch added patch discarded remove patch
@@ -311,6 +311,8 @@  discard block
 block discarded – undo
311 311
 	 * @param string $path
312 312
 	 * @param array &$dav
313 313
 	 * @param array &$allow
314
+	 * @param integer[] $dav
315
+	 * @param boolean $allow
314 316
 	 */
315 317
 	function OPTIONS($path, &$dav, &$allow)
316 318
 	{
@@ -1380,7 +1382,7 @@  discard block
 block discarded – undo
1380 1382
 	 * @param int|string $id
1381 1383
 	 * @param array $attach array of array with values for keys 'name', 'params', 'value'
1382 1384
 	 * @param boolean $delete_via_put
1383
-	 * @return boolean false on error, eg. invalid managed id, for false an xml-error body has been send
1385
+	 * @return null|false false on error, eg. invalid managed id, for false an xml-error body has been send
1384 1386
 	 */
1385 1387
 	public static function handle_attach($app, $id, $attach, $delete_via_put=false)
1386 1388
 	{
@@ -1584,7 +1586,7 @@  discard block
 block discarded – undo
1584 1586
 	 * @param string $managed_id
1585 1587
 	 * @param string $app =null app-name to check against path
1586 1588
 	 * @param string|int $id =null id to check agains path
1587
-	 * @return string|boolean "/apps/$app/$id/something" or false if not found or not belonging to given $app/$id
1589
+	 * @return false|string "/apps/$app/$id/something" or false if not found or not belonging to given $app/$id
1588 1590
 	 */
1589 1591
 	static public function managed_id2path($managed_id, $app=null, $id=null)
1590 1592
 	{
@@ -1783,7 +1785,7 @@  discard block
 block discarded – undo
1783 1785
 	 * MKCOL method handler
1784 1786
 	 *
1785 1787
 	 * @param  array  general parameter passing array
1786
-	 * @return bool   true on success
1788
+	 * @return string   true on success
1787 1789
 	 */
1788 1790
 	function MKCOL($options)
1789 1791
 	{
@@ -1796,7 +1798,7 @@  discard block
 block discarded – undo
1796 1798
 	 * MOVE method handler
1797 1799
 	 *
1798 1800
 	 * @param  array  general parameter passing array
1799
-	 * @return bool   true on success
1801
+	 * @return string   true on success
1800 1802
 	 */
1801 1803
 	function MOVE($options)
1802 1804
 	{
@@ -1809,7 +1811,7 @@  discard block
 block discarded – undo
1809 1811
 	 * COPY method handler
1810 1812
 	 *
1811 1813
 	 * @param  array  general parameter passing array
1812
-	 * @return bool   true on success
1814
+	 * @return string   true on success
1813 1815
 	 */
1814 1816
 	function COPY($options, $del=false)
1815 1817
 	{
@@ -1822,7 +1824,7 @@  discard block
 block discarded – undo
1822 1824
 	 * LOCK method handler
1823 1825
 	 *
1824 1826
 	 * @param  array  general parameter passing array
1825
-	 * @return bool   true on success
1827
+	 * @return string|boolean   true on success
1826 1828
 	 */
1827 1829
 	function LOCK(&$options)
1828 1830
 	{
@@ -1856,7 +1858,7 @@  discard block
 block discarded – undo
1856 1858
 	 * UNLOCK method handler
1857 1859
 	 *
1858 1860
 	 * @param  array  general parameter passing array
1859
-	 * @return bool   true on success
1861
+	 * @return string   true on success
1860 1862
 	 */
1861 1863
 	function UNLOCK(&$options)
1862 1864
 	{
Please login to merge, or discard this patch.
Braces   +260 added lines, -64 removed lines patch added patch discarded remove patch
@@ -222,11 +222,20 @@  discard block
 block discarded – undo
222 222
 	function __construct()
223 223
 	{
224 224
 		// log which CalDAVTester test is currently running, set as User-Agent header
225
-		if (substr($_SERVER['HTTP_USER_AGENT'], 0, 14) == 'scripts/tests/') error_log('****** '.$_SERVER['HTTP_USER_AGENT']);
225
+		if (substr($_SERVER['HTTP_USER_AGENT'], 0, 14) == 'scripts/tests/')
226
+		{
227
+			error_log('****** '.$_SERVER['HTTP_USER_AGENT']);
228
+		}
226 229
 
227
-		if (!$this->debug) $this->debug = (int)$GLOBALS['egw_info']['user']['preferences']['groupdav']['debug_level'];
230
+		if (!$this->debug)
231
+		{
232
+			$this->debug = (int)$GLOBALS['egw_info']['user']['preferences']['groupdav']['debug_level'];
233
+		}
228 234
 
229
-		if ($this->debug > 2) error_log('groupdav: $_SERVER='.array2string($_SERVER));
235
+		if ($this->debug > 2)
236
+		{
237
+			error_log('groupdav: $_SERVER='.array2string($_SERVER));
238
+		}
230 239
 
231 240
 		// setting our own exception handler, to be able to still log the requests
232 241
 		set_exception_handler(array(__CLASS__,'exception_handler'));
@@ -254,7 +263,10 @@  discard block
 block discarded – undo
254 263
 				$this->crrnd = true; // Older Apple Addressbook.app does not cope with namespace redundancy
255 264
 				break;
256 265
 		}
257
-		if ($this->debug) error_log(__METHOD__."() HTTP_USER_AGENT='$_SERVER[HTTP_USER_AGENT]' --> '$agent' --> client_requires_href_as_url=$this->client_require_href_as_url, crrnd(client refuses redundand namespace declarations)=$this->crrnd");
266
+		if ($this->debug)
267
+		{
268
+			error_log(__METHOD__."() HTTP_USER_AGENT='$_SERVER[HTTP_USER_AGENT]' --> '$agent' --> client_requires_href_as_url=$this->client_require_href_as_url, crrnd(client refuses redundand namespace declarations)=$this->crrnd");
269
+		}
258 270
 
259 271
 		// adding EGroupware version to X-Dav-Powered-By header eg. "EGroupware 1.8.001 CalDAV/CardDAV/GroupDAV server"
260 272
 		$this->dav_powered_by = str_replace('EGroupware','EGroupware '.$GLOBALS['egw_info']['server']['versions']['phpgwapi'],
@@ -300,7 +312,10 @@  discard block
 block discarded – undo
300 312
 	 */
301 313
 	function app_handler($app)
302 314
 	{
303
-		if (isset($this->root[$app]['app'])) $app = $this->root[$app]['app'];
315
+		if (isset($this->root[$app]['app']))
316
+		{
317
+			$app = $this->root[$app]['app'];
318
+		}
304 319
 
305 320
 		return Handler::app_handler($app,$this);
306 321
 	}
@@ -317,22 +332,34 @@  discard block
 block discarded – undo
317 332
 		unset($allow);	// not used, but required by function signature
318 333
 
319 334
 		// locking support
320
-		if (!in_array('2', $dav)) $dav[] = '2';
335
+		if (!in_array('2', $dav))
336
+		{
337
+			$dav[] = '2';
338
+		}
321 339
 
322
-		if (preg_match('#/(calendar(-[^/]+)?|inbox|outbox)/#', $path))	// eg. /<username>/calendar-<otheruser>/
340
+		if (preg_match('#/(calendar(-[^/]+)?|inbox|outbox)/#', $path))
341
+		{
342
+			// eg. /<username>/calendar-<otheruser>/
323 343
 		{
324 344
 			$app = 'calendar';
325 345
 		}
326
-		elseif (preg_match('#/addressbook(-[^/]+)?/#', $path))	// eg. /<username>/addressbook-<otheruser>/
346
+		}
347
+		elseif (preg_match('#/addressbook(-[^/]+)?/#', $path))
348
+		{
349
+			// eg. /<username>/addressbook-<otheruser>/
327 350
 		{
328 351
 			$app = 'addressbook';
329 352
 		}
353
+		}
330 354
 		// CalDAV and CardDAV
331 355
 		$dav[] = 'access-control';
332 356
 
333
-		if ($app !== 'addressbook')	// CalDAV
357
+		if ($app !== 'addressbook')
358
+		{
359
+			// CalDAV
334 360
 		{
335 361
 			$dav[] = 'calendar-access';
362
+		}
336 363
 			$dav[] = 'calendar-auto-schedule';
337 364
 			$dav[] = 'calendar-proxy';
338 365
 			// required by iOS iCal to use principal-property-search to autocomplete participants (and locations)
@@ -349,9 +376,13 @@  discard block
 block discarded – undo
349 376
 			//$dav[] = 'calendarserver-sharing';
350 377
 			//$dav[] = 'calendarserver-sharing-no-scheduling';
351 378
 		}
352
-		if ($app !== 'calendar')	// CardDAV
379
+		if ($app !== 'calendar')
353 380
 		{
354
-			$dav[] = 'addressbook';	// CardDAV uses "addressbook" NOT "addressbook-access"
381
+			// CardDAV
382
+		{
383
+			$dav[] = 'addressbook';
384
+		}
385
+		// CardDAV uses "addressbook" NOT "addressbook-access"
355 386
 		}
356 387
 		//error_log(__METHOD__."('$path') --> app='$app' --> DAV: ".implode(', ', $dav));
357 388
 	}
@@ -365,7 +396,10 @@  discard block
 block discarded – undo
365 396
 	 */
366 397
 	function PROPFIND(&$options, &$files, $method='PROPFIND')
367 398
 	{
368
-		if ($this->debug) error_log(__CLASS__."::$method(".array2string($options).')');
399
+		if ($this->debug)
400
+		{
401
+			error_log(__CLASS__."::$method(".array2string($options).')');
402
+		}
369 403
 
370 404
 		// make options (readonly) available to all class methods, eg. prop_requested
371 405
 		$this->propfind_options = $options;
@@ -374,18 +408,27 @@  discard block
 block discarded – undo
374 408
 		$id = $app = $user = $user_prefix = null;
375 409
 		if (!self::_parse_path($options['path'],$id,$app,$user,$user_prefix) && $app && !$user && $user !== 0)
376 410
 		{
377
-			if ($this->debug > 1) error_log(__CLASS__."::$method: user='$user', app='$app', id='$id': 404 not found!");
411
+			if ($this->debug > 1)
412
+			{
413
+				error_log(__CLASS__."::$method: user='$user', app='$app', id='$id': 404 not found!");
414
+			}
378 415
 			return '404 Not Found';
379 416
 		}
380
-		if ($this->debug > 1) error_log(__CLASS__."::$method(path='$options[path]'): user='$user', user_prefix='$user_prefix', app='$app', id='$id'");
417
+		if ($this->debug > 1)
418
+		{
419
+			error_log(__CLASS__."::$method(path='$options[path]'): user='$user', user_prefix='$user_prefix', app='$app', id='$id'");
420
+		}
381 421
 
382 422
 		$files = array('files' => array());
383 423
 		$path = $user_prefix = $this->_slashify($user_prefix);
384 424
 
385
-		if (!$app)	// user root folder containing apps
425
+		if (!$app)
426
+		{
427
+			// user root folder containing apps
386 428
 		{
387 429
 			// add root with current users apps
388 430
 			$this->add_home($files, $path, $user, $options['depth']);
431
+		}
389 432
 
390 433
 			if ($path == '/')
391 434
 			{
@@ -417,16 +460,22 @@  discard block
 block discarded – undo
417 460
 		}
418 461
 		if ($app != 'principals' && !isset($GLOBALS['egw_info']['user']['apps'][$this->root[$app]['app'] ? $this->root[$app]['app'] : $app]))
419 462
 		{
420
-			if ($this->debug) error_log(__CLASS__."::$method(path=$options[path]) 403 Forbidden: no app rights for '$app'");
463
+			if ($this->debug)
464
+			{
465
+				error_log(__CLASS__."::$method(path=$options[path]) 403 Forbidden: no app rights for '$app'");
466
+			}
421 467
 			return "403 Forbidden: no app rights for '$app'";	// no rights for the given app
422 468
 		}
423 469
 		if (($handler = self::app_handler($app)))
424 470
 		{
425
-			if ($method != 'REPORT' && !$id)	// no self URL for REPORT requests (only PROPFIND) or propfinds on an id
471
+			if ($method != 'REPORT' && !$id)
472
+			{
473
+				// no self URL for REPORT requests (only PROPFIND) or propfinds on an id
426 474
 			{
427 475
 				// KAddressbook doubles the folder, if the self URL contains the GroupDAV/CalDAV resourcetypes
428 476
 				$files['files'][0] = $this->add_app($app,$app=='addressbook'&&$handler->get_agent()=='kde',$user,
429 477
 					$this->_slashify($options['path']));
478
+			}
430 479
 
431 480
 				// Hack for iOS 5.0.1 addressbook to stop asking directory gateway permissions with depth != 0
432 481
 				// values for depth are 0, 1, "infinit" or not set which has to be interpreted as "infinit"
@@ -436,7 +485,11 @@  discard block
 block discarded – undo
436 485
 					$this->log(__CLASS__."::$method(".array2string($options).') Enabling hack for iOS 5.0.1 addressbook: force Depth: 0 on PROPFIND for directory gateway!');
437 486
 					return true;
438 487
 				}
439
-				if (!$options['depth']) return true;	// depth 0 --> show only the self url
488
+				if (!$options['depth'])
489
+				{
490
+					return true;
491
+				}
492
+				// depth 0 --> show only the self url
440 493
 			}
441 494
 			return $handler->propfind($this->_slashify($options['path']),$options,$files,$user,$id);
442 495
 		}
@@ -457,7 +510,10 @@  discard block
 block discarded – undo
457 510
 		// resourcetype: collection
458 511
 		$props['resourcetype'][] = self::mkprop('collection','');
459 512
 
460
-		if (!isset($props['getcontenttype'])) $props['getcontenttype'] = 'httpd/unix-directory';
513
+		if (!isset($props['getcontenttype']))
514
+		{
515
+			$props['getcontenttype'] = 'httpd/unix-directory';
516
+		}
461 517
 
462 518
 		return $this->add_resource($path, $props, $privileges, $supported_privileges);
463 519
 	}
@@ -489,11 +545,17 @@  discard block
 block discarded – undo
489 545
 			'resourcetype'     => '',
490 546
 		) as $name => $default)
491 547
 		{
492
-			if (!isset($props[$name])) $props[$name] = $default;
548
+			if (!isset($props[$name]))
549
+			{
550
+				$props[$name] = $default;
551
+			}
493 552
 		}
494 553
 
495 554
 		// if requested add privileges
496
-		if (is_null($supported_privileges)) $supported_privileges = $this->supported_privileges;
555
+		if (is_null($supported_privileges))
556
+		{
557
+			$supported_privileges = $this->supported_privileges;
558
+		}
497 559
 		if ($this->prop_requested('current-user-privilege-set') === true)
498 560
 		{
499 561
 			foreach($privileges as $name)
@@ -514,7 +576,10 @@  discard block
 block discarded – undo
514 576
 			$props['owner'] = '';
515 577
 		}
516 578
 
517
-		if ($this->debug > 1) error_log(__METHOD__."(path='$path', props=".array2string($props).')');
579
+		if ($this->debug > 1)
580
+		{
581
+			error_log(__METHOD__."(path='$path', props=".array2string($props).')');
582
+		}
518 583
 
519 584
 		// convert simple associative properties to HTTP_WebDAV_Server ones
520 585
 		foreach($props as $name => &$prop)
@@ -554,7 +619,10 @@  discard block
 block discarded – undo
554 619
 		{
555 620
 			foreach($data as $name => $data)
556 621
 			{
557
-				if ($name[0] == '*') continue;
622
+				if ($name[0] == '*')
623
+				{
624
+					continue;
625
+				}
558 626
 				if (is_array($data) && $data['*only*'] && strpos($path, $data['*only*']) === false)
559 627
 				{
560 628
 					continue;	// wrong path
@@ -668,8 +736,15 @@  discard block
 block discarded – undo
668 736
 		{
669 737
 			foreach($this->root as $app => $data)
670 738
 			{
671
-				if (!$GLOBALS['egw_info']['user']['apps'][$data['app'] ? $data['app'] : $app]) continue;	// no rights for the given app
672
-				if (!empty($data['user-only']) && ($path == '/' || $user < 0)) continue;
739
+				if (!$GLOBALS['egw_info']['user']['apps'][$data['app'] ? $data['app'] : $app])
740
+				{
741
+					continue;
742
+				}
743
+				// no rights for the given app
744
+				if (!empty($data['user-only']) && ($path == '/' || $user < 0))
745
+				{
746
+					continue;
747
+				}
673 748
 
674 749
 				$files['files'][] = $this->add_app($app,false,$user,$path.$app.'/');
675 750
 
@@ -705,7 +780,10 @@  discard block
 block discarded – undo
705 780
 	{
706 781
 		if (!isset($GLOBALS['egw_info']['user']['apps']['resources']))
707 782
 		{
708
-			if ($this->debug) error_log(__METHOD__."(path=$path) 403 Forbidden: no app rights for 'resources'");
783
+			if ($this->debug)
784
+			{
785
+				error_log(__METHOD__."(path=$path) 403 Forbidden: no app rights for 'resources'");
786
+			}
709 787
 			return "403 Forbidden: no app rights for 'resources'";	// no rights for the given app
710 788
 		}
711 789
 		list(,$what) = explode('/', $path);
@@ -744,10 +822,13 @@  discard block
 block discarded – undo
744 822
 	{
745 823
 		// currently only show shared calendars/addressbooks for current user and not in the root
746 824
 		if ($path == '/' || $user != $GLOBALS['egw_info']['user']['account_id'] ||
747
-			!isset($GLOBALS['egw_info']['user']['apps'][$app]))	// also avoids principals, inbox and outbox
825
+			!isset($GLOBALS['egw_info']['user']['apps'][$app]))
826
+		{
827
+			// also avoids principals, inbox and outbox
748 828
 		{
749 829
 			return true;
750 830
 		}
831
+		}
751 832
 		$handler = $this->app_handler($app);
752 833
 		if (($shared = $handler->get_shared()))
753 834
 		{
@@ -755,7 +836,10 @@  discard block
 block discarded – undo
755 836
 			{
756 837
 				$file = $this->add_app($app,false,$id,$path.$owner.'/');
757 838
 				// mark other users calendar as shared (iOS 5.0.1 AB does NOT display AB marked as shared!)
758
-				if ($app == 'calendar') $file['props']['resourcetype']['val'][] = self::mkprop(self::CALENDARSERVER,'shared','');
839
+				if ($app == 'calendar')
840
+				{
841
+					$file['props']['resourcetype']['val'][] = self::mkprop(self::CALENDARSERVER,'shared','');
842
+				}
759 843
 				$files[] = $file;
760 844
 			}
761 845
 		}
@@ -791,7 +875,10 @@  discard block
 block discarded – undo
791 875
 			{
792 876
 				$name = $this->accounts->id2name($account,'account_fullname');
793 877
 			}
794
-			if (empty($name)) $name = '#'.$account;
878
+			if (empty($name))
879
+			{
880
+				$name = '#'.$account;
881
+			}
795 882
 		}
796 883
 		return $name;
797 884
 	}
@@ -807,7 +894,10 @@  discard block
 block discarded – undo
807 894
 	 */
808 895
 	protected function add_app($app,$no_extra_types=false,$user=null,$path='/')
809 896
 	{
810
-		if ($this->debug) error_log(__METHOD__."(app='$app', no_extra_types=$no_extra_types, user='$user', path='$path')");
897
+		if ($this->debug)
898
+		{
899
+			error_log(__METHOD__."(app='$app', no_extra_types=$no_extra_types, user='$user', path='$path')");
900
+		}
811 901
 		$user_preferences = $GLOBALS['egw_info']['user']['preferences'];
812 902
 		if (is_string($user) && $user[0] == 'r' && ($resource = Principals::read_resource(substr($user, 1))))
813 903
 		{
@@ -831,7 +921,10 @@  discard block
 block discarded – undo
831 921
 			$account_lid = $GLOBALS['egw_info']['user']['account_lid'];
832 922
 			$principalType = 'users';
833 923
 		}
834
-		if (!isset($displayname)) $displayname = $this->account_name($user);
924
+		if (!isset($displayname))
925
+		{
926
+			$displayname = $this->account_name($user);
927
+		}
835 928
 
836 929
 		$props = array(
837 930
 			'owner' => array(self::mkprop('href',$this->base_uri.'/principals/'.$principalType.'/'.$account_lid.'/')),
@@ -864,10 +957,13 @@  discard block
 block discarded – undo
864 957
 
865 958
 		// rfc 5995 (Use POST to add members to WebDAV collections): we use collection path with add-member query param
866 959
 		// leaving it switched off, until further testing, because OS X iCal seem to ignore it and OS X Addressbook uses POST to full URL without ?add-member
867
-		if ($app && !in_array($app,array('inbox','outbox','principals')))	// not on inbox, outbox or principals
960
+		if ($app && !in_array($app,array('inbox','outbox','principals')))
961
+		{
962
+			// not on inbox, outbox or principals
868 963
 		{
869 964
 			$props['add-member'][] = self::mkprop('href',$this->base_uri.$path.'?add-member');
870 965
 		}
966
+		}
871 967
 
872 968
 		// add props modifyable via proppatch from client, eg. calendar-color, see self::$proppatch_props
873 969
 		$ns = null;
@@ -961,7 +1057,10 @@  discard block
 block discarded – undo
961 1057
 	 */
962 1058
 	function REPORT(&$options, &$files)
963 1059
 	{
964
-		if ($this->debug > 1) error_log(__METHOD__.'('.array2string($options).')');
1060
+		if ($this->debug > 1)
1061
+		{
1062
+			error_log(__METHOD__.'('.array2string($options).')');
1063
+		}
965 1064
 
966 1065
 		return $this->PROPFIND($options,$files,'REPORT');
967 1066
 	}
@@ -984,7 +1083,10 @@  discard block
 block discarded – undo
984 1083
 	 */
985 1084
 	function GET(&$options)
986 1085
 	{
987
-		if ($this->debug) error_log(__METHOD__.'('.array2string($options).')');
1086
+		if ($this->debug)
1087
+		{
1088
+			error_log(__METHOD__.'('.array2string($options).')');
1089
+		}
988 1090
 
989 1091
 		$id = $app = $user = null;
990 1092
 		if (!$this->_parse_path($options['path'],$id,$app,$user) || $app == 'principals')
@@ -1222,7 +1324,10 @@  discard block
 block discarded – undo
1222 1324
 			$_GET['add-member'] = '';	// otherwise we give no Location header
1223 1325
 			return $this->PUT($options);
1224 1326
 		}
1225
-		if ($this->debug) error_log(__METHOD__.'('.array2string($options).')');
1327
+		if ($this->debug)
1328
+		{
1329
+			error_log(__METHOD__.'('.array2string($options).')');
1330
+		}
1226 1331
 
1227 1332
 		$id = $app = $user = null;
1228 1333
 		$this->_parse_path($options['path'],$id,$app,$user);
@@ -1393,7 +1498,11 @@  discard block
 block discarded – undo
1393 1498
 			error_log(__METHOD__."('$app', $id, ...) no rights to update attachments");
1394 1499
 			return;	// no rights --> nothing to do
1395 1500
 		}
1396
-		if (!is_array($attach)) $attach = array();	// could be PEAR_Error if not set
1501
+		if (!is_array($attach))
1502
+		{
1503
+			$attach = array();
1504
+		}
1505
+		// could be PEAR_Error if not set
1397 1506
 
1398 1507
 		if ($delete_via_put)
1399 1508
 		{
@@ -1438,7 +1547,11 @@  discard block
 block discarded – undo
1438 1547
 					// reuse valid managed-id --> symlink attachment
1439 1548
 					if (Vfs::file_exists($link))
1440 1549
 					{
1441
-						if (Vfs::readlink($link) === $path) continue;	// no need to recreate identical link
1550
+						if (Vfs::readlink($link) === $path)
1551
+						{
1552
+							continue;
1553
+						}
1554
+						// no need to recreate identical link
1442 1555
 						Vfs::unlink($link);		// symlink will fail, if $link exists
1443 1556
 					}
1444 1557
 					if (!Vfs::symlink($path, $link))
@@ -1478,7 +1591,11 @@  discard block
 block discarded – undo
1478 1591
 	{
1479 1592
 		$filename = empty($_filename) ? 'attachment' : Vfs::basename($_filename);
1480 1593
 
1481
-		if (strpos($mime, ';')) list($mime) = explode(';', $mime);	// in case it contains eg. charset info
1594
+		if (strpos($mime, ';'))
1595
+		{
1596
+			list($mime) = explode(';', $mime);
1597
+		}
1598
+		// in case it contains eg. charset info
1482 1599
 
1483 1600
 		$ext = !empty($mime) ? MimeMagic::mime2ext($mime) : '';
1484 1601
 
@@ -1497,9 +1614,15 @@  discard block
 block discarded – undo
1497 1614
 		for($i = 1; $i < 100; ++$i)
1498 1615
 		{
1499 1616
 			$path = Link::vfs_path($app, $id, $filename.($i > 1 ? '-'.$i : '').$ext, true);
1500
-			if (!Vfs::stat($path)) break;
1617
+			if (!Vfs::stat($path))
1618
+			{
1619
+				break;
1620
+			}
1621
+		}
1622
+		if ($i >= 100)
1623
+		{
1624
+			return null;
1501 1625
 		}
1502
-		if ($i >= 100) return null;
1503 1626
 
1504 1627
 		if (!($dir = Vfs::dirname($path)) || !Vfs::file_exists($dir) && !Vfs::mkdir($dir, 0777, STREAM_MKDIR_RECURSIVE))
1505 1628
 		{
@@ -1549,7 +1672,11 @@  discard block
 block discarded – undo
1549 1672
 			// handle symlinks --> return target size and mime-type
1550 1673
 			if (($target = Vfs::readlink($path)))
1551 1674
 			{
1552
-				if (!($stat = Vfs::stat($target))) continue;	// broken or inaccessible symlink
1675
+				if (!($stat = Vfs::stat($target)))
1676
+				{
1677
+					continue;
1678
+				}
1679
+				// broken or inaccessible symlink
1553 1680
 
1554 1681
 				// check if target is in /apps, probably reused MANAGED-ID --> return it
1555 1682
 				if (substr($target, 0, 6) == '/apps/')
@@ -1641,14 +1768,20 @@  discard block
 block discarded – undo
1641 1768
 	 */
1642 1769
 	function PROPPATCH(&$options)
1643 1770
 	{
1644
-		if ($this->debug) error_log(__METHOD__."(".array2string($options).')');
1771
+		if ($this->debug)
1772
+		{
1773
+			error_log(__METHOD__."(".array2string($options).')');
1774
+		}
1645 1775
 
1646 1776
 		// parse path in form [/account_lid]/app[/more]
1647 1777
 		$id = $app = $user = $user_prefix = null;
1648 1778
 		self::_parse_path($options['path'],$id,$app,$user,$user_prefix);	// allways returns false if eg. !$id
1649 1779
 		if ($app == 'principals' || $id || $options['path'] == '/')
1650 1780
 		{
1651
-			if ($this->debug > 1) error_log(__METHOD__.": user='$user', app='$app', id='$id': 404 not found!");
1781
+			if ($this->debug > 1)
1782
+			{
1783
+				error_log(__METHOD__.": user='$user', app='$app', id='$id': 404 not found!");
1784
+			}
1652 1785
 			foreach($options['props'] as &$prop)
1653 1786
 			{
1654 1787
 				$prop['status'] = '403 Forbidden';
@@ -1673,11 +1806,14 @@  discard block
 block discarded – undo
1673 1806
 						self::$proppatch_props[$prop['name']] == $prop['ns'] ? '' : ':'.$prop['ns']);
1674 1807
 				}
1675 1808
 				//error_log("preferences['user']['$app']['$name']=".array2string($GLOBALS['egw_info']['user']['preferences'][$app][$name]).($GLOBALS['egw_info']['user']['preferences'][$app][$name] !== $prop['val'] ? ' !== ':' === ')."prop['val']=".array2string($prop['val']));
1676
-				if ($GLOBALS['egw_info']['user']['preferences'][$app][$name] !== $prop['val'])	// nothing to change otherwise
1809
+				if ($GLOBALS['egw_info']['user']['preferences'][$app][$name] !== $prop['val'])
1810
+				{
1811
+					// nothing to change otherwise
1677 1812
 				{
1678 1813
 					if (isset($prop['val']))
1679 1814
 					{
1680 1815
 						$GLOBALS['egw']->preferences->add($app, $name, $prop['val']);
1816
+				}
1681 1817
 					}
1682 1818
 					else
1683 1819
 					{
@@ -1729,7 +1865,10 @@  discard block
 block discarded – undo
1729 1865
 			}
1730 1866
 		}
1731 1867
 
1732
-		if ($this->debug) error_log(__METHOD__.'('.array2string($options).')');
1868
+		if ($this->debug)
1869
+		{
1870
+			error_log(__METHOD__.'('.array2string($options).')');
1871
+		}
1733 1872
 
1734 1873
 		$id = $app = $user = $prefix = null;
1735 1874
 		if (!$this->_parse_path($options['path'],$id,$app,$user,$prefix))
@@ -1741,7 +1880,10 @@  discard block
 block discarded – undo
1741 1880
 			$status = $handler->put($options,$id,$user,$prefix);
1742 1881
 
1743 1882
 			// set default stati: true --> 204 No Content, false --> should be already handled
1744
-			if (is_bool($status)) $status = $status ? '204 No Content' : '400 Something went wrong';
1883
+			if (is_bool($status))
1884
+			{
1885
+				$status = $status ? '204 No Content' : '400 Something went wrong';
1886
+			}
1745 1887
 
1746 1888
 			// check/handle Prefer: return-representation
1747 1889
 			if ($status[0] === '2' || $status === true)
@@ -1765,7 +1907,10 @@  discard block
 block discarded – undo
1765 1907
 	 */
1766 1908
 	function DELETE($options)
1767 1909
 	{
1768
-		if ($this->debug) error_log(__METHOD__.'('.array2string($options).')');
1910
+		if ($this->debug)
1911
+		{
1912
+			error_log(__METHOD__.'('.array2string($options).')');
1913
+		}
1769 1914
 
1770 1915
 		$id = $app = $user = null;
1771 1916
 		if (!$this->_parse_path($options['path'],$id,$app,$user))
@@ -1776,7 +1921,10 @@  discard block
 block discarded – undo
1776 1921
 		{
1777 1922
 			$status = $handler->delete($options,$id,$user);
1778 1923
 			// set default stati: true --> 204 No Content, false --> should be already handled
1779
-			if (is_bool($status)) $status = $status ? '204 No Content' : '400 Something went wrong';
1924
+			if (is_bool($status))
1925
+			{
1926
+				$status = $status ? '204 No Content' : '400 Something went wrong';
1927
+			}
1780 1928
 			return $status;
1781 1929
 		}
1782 1930
 		return '501 Not Implemented';
@@ -1790,7 +1938,10 @@  discard block
 block discarded – undo
1790 1938
 	 */
1791 1939
 	function MKCOL($options)
1792 1940
 	{
1793
-		if ($this->debug) error_log(__METHOD__.'('.array2string($options).')');
1941
+		if ($this->debug)
1942
+		{
1943
+			error_log(__METHOD__.'('.array2string($options).')');
1944
+		}
1794 1945
 
1795 1946
 		return '501 Not Implemented';
1796 1947
 	}
@@ -1803,7 +1954,10 @@  discard block
 block discarded – undo
1803 1954
 	 */
1804 1955
 	function MOVE($options)
1805 1956
 	{
1806
-		if ($this->debug) error_log(__METHOD__.'('.array2string($options).')');
1957
+		if ($this->debug)
1958
+		{
1959
+			error_log(__METHOD__.'('.array2string($options).')');
1960
+		}
1807 1961
 
1808 1962
 		return '501 Not Implemented';
1809 1963
 	}
@@ -1816,7 +1970,10 @@  discard block
 block discarded – undo
1816 1970
 	 */
1817 1971
 	function COPY($options, $del=false)
1818 1972
 	{
1819
-		if ($this->debug) error_log('self::'.($del ? 'MOVE' : 'COPY').'('.array2string($options).')');
1973
+		if ($this->debug)
1974
+		{
1975
+			error_log('self::'.($del ? 'MOVE' : 'COPY').'('.array2string($options).')');
1976
+		}
1820 1977
 
1821 1978
 		return '501 Not Implemented';
1822 1979
 	}
@@ -1833,7 +1990,10 @@  discard block
 block discarded – undo
1833 1990
 		self::_parse_path($options['path'],$id,$app,$user);
1834 1991
 		$path = Vfs::app_entry_lock_path($app,$id);
1835 1992
 
1836
-		if ($this->debug) error_log(__METHOD__.'('.array2string($options).") path=$path");
1993
+		if ($this->debug)
1994
+		{
1995
+			error_log(__METHOD__.'('.array2string($options).") path=$path");
1996
+		}
1837 1997
 
1838 1998
 		// get the app handler, to check if the user has edit access to the entry (required to make locks)
1839 1999
 		$handler = self::app_handler($app);
@@ -1848,10 +2008,13 @@  discard block
 block discarded – undo
1848 2008
 		// dont know why, but HTTP_WebDAV_Server passes the owner in D:href tags, which get's passed unchanged to checkLock/PROPFIND
1849 2009
 		// that's wrong according to the standard and cadaver does not show it on discover --> strip_tags removes eventual tags
1850 2010
 		if (($ret = Vfs::lock($path,$options['locktoken'],$options['timeout'],strip_tags($options['owner']),
1851
-			$options['scope'],$options['type'],isset($options['update']),false)) && !isset($options['update']))		// false = no ACL check
2011
+			$options['scope'],$options['type'],isset($options['update']),false)) && !isset($options['update']))
2012
+		{
2013
+			// false = no ACL check
1852 2014
 		{
1853 2015
 			return $ret ? '200 OK' : '409 Conflict';
1854 2016
 		}
2017
+		}
1855 2018
 		return $ret;
1856 2019
 	}
1857 2020
 
@@ -1867,7 +2030,10 @@  discard block
 block discarded – undo
1867 2030
 		self::_parse_path($options['path'],$id,$app,$user);
1868 2031
 		$path = Vfs::app_entry_lock_path($app,$id);
1869 2032
 
1870
-		if ($this->debug) error_log(__METHOD__.'('.array2string($options).") path=$path");
2033
+		if ($this->debug)
2034
+		{
2035
+			error_log(__METHOD__.'('.array2string($options).") path=$path");
2036
+		}
1871 2037
 		return Vfs::unlock($path,$options['token']) ? '204 No Content' : '409 Conflict';
1872 2038
 	}
1873 2039
 
@@ -1896,7 +2062,10 @@  discard block
 block discarded – undo
1896 2062
 		$id = $app = $user = null;
1897 2063
 		self::_parse_path($options['path'],$id,$app,$user);
1898 2064
 
1899
-		if ($this->debug) error_log(__METHOD__.'('.array2string($options).") path=$options[path]");
2065
+		if ($this->debug)
2066
+		{
2067
+			error_log(__METHOD__.'('.array2string($options).") path=$options[path]");
2068
+		}
1900 2069
 
1901 2070
 		$options['errors'] = array();
1902 2071
 		switch ($app)
@@ -1959,7 +2128,10 @@  discard block
 block discarded – undo
1959 2128
 			$user = array_shift($parts);
1960 2129
 		}
1961 2130
 
1962
-		if (!isset($app)) $app = array_shift($parts);
2131
+		if (!isset($app))
2132
+		{
2133
+			$app = array_shift($parts);
2134
+		}
1963 2135
 
1964 2136
 		// /addressbook-accounts/
1965 2137
 		if (!$account_id && $app == 'addressbook-accounts')
@@ -2052,7 +2224,10 @@  discard block
 block discarded – undo
2052 2224
 		}
2053 2225
 		parent::ServeRequest($prefix);
2054 2226
 
2055
-		if (self::$request_starttime) self::log_request();
2227
+		if (self::$request_starttime)
2228
+		{
2229
+			self::log_request();
2230
+		}
2056 2231
 	}
2057 2232
 
2058 2233
 	/**
@@ -2119,11 +2294,23 @@  discard block
 block discarded – undo
2119 2294
 			{
2120 2295
 				$content .= $line."\n";
2121 2296
 			}
2122
-			if (($c = ob_get_flush())) $content .= "\n";
2123
-			if (self::$log_level !== 'f' && strlen($c) > 1536) $c = substr($c,0,1536)."\n*** LOG TRUNKATED\n";
2297
+			if (($c = ob_get_flush()))
2298
+			{
2299
+				$content .= "\n";
2300
+			}
2301
+			if (self::$log_level !== 'f' && strlen($c) > 1536)
2302
+			{
2303
+				$c = substr($c,0,1536)."\n*** LOG TRUNKATED\n";
2304
+			}
2124 2305
 			$content .= $c;
2125
-			if ($extra) $content .= $extra;
2126
-			if ($this->to_log) $content .= "\n### ".implode("\n### ", $this->to_log)."\n";
2306
+			if ($extra)
2307
+			{
2308
+				$content .= $extra;
2309
+			}
2310
+			if ($this->to_log)
2311
+			{
2312
+				$content .= "\n### ".implode("\n### ", $this->to_log)."\n";
2313
+			}
2127 2314
 			$content .= $this->_http_status[0] == '4' && substr($this->_http_status,0,3) != '412' ||
2128 2315
 				$this->_http_status[0] == '5' ? '###' : '***';	// mark failed requests with ###, instead of ***
2129 2316
 			$content .= sprintf(' %s --> "%s" took %5.3f s',$_SERVER['REQUEST_METHOD'].($_SERVER['REQUEST_METHOD']=='REPORT'?' '.$this->propfind_options['root']['name']:'').' '.$_SERVER['PATH_INFO'],$this->_http_status,microtime(true)-self::$request_starttime)."\n\n";
@@ -2181,8 +2368,14 @@  discard block
 block discarded – undo
2181 2368
 	 */
2182 2369
 	protected static function add_prop(\XMLWriter $xml, $props)
2183 2370
 	{
2184
-		if (is_string($props)) $props = self::mkprop($props, '');
2185
-		if (isset($props['name'])) $props = array($props);
2371
+		if (is_string($props))
2372
+		{
2373
+			$props = self::mkprop($props, '');
2374
+		}
2375
+		if (isset($props['name']))
2376
+		{
2377
+			$props = array($props);
2378
+		}
2186 2379
 
2187 2380
 		foreach($props as $prop)
2188 2381
 		{
@@ -2269,7 +2462,10 @@  discard block
 block discarded – undo
2269 2462
 	 */
2270 2463
 	static function generate_uid($_appName, $_eventID)
2271 2464
 	{
2272
-		if(empty($_appName) || empty($_eventID)) return false;
2465
+		if(empty($_appName) || empty($_eventID))
2466
+		{
2467
+			return false;
2468
+		}
2273 2469
 
2274 2470
 		return $_appName.'-'.$_eventID.'-'.$GLOBALS['egw_info']['server']['install_id'];
2275 2471
 	}
Please login to merge, or discard this patch.
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -117,12 +117,12 @@  discard block
 block discarded – undo
117 117
 		'inbox' => array(
118 118
 			'resourcetype' => array(self::CALDAV => 'schedule-inbox'),
119 119
 			'app' => 'calendar',
120
-			'user-only' => true,	// display just in user home
120
+			'user-only' => true, // display just in user home
121 121
 		),
122 122
 		'outbox' => array(
123 123
 			'resourcetype' => array(self::CALDAV => 'schedule-outbox'),
124 124
 			'app' => 'calendar',
125
-			'user-only' => true,	// display just in user home
125
+			'user-only' => true, // display just in user home
126 126
 		),
127 127
 		'infolog' => array(
128 128
 			'resourcetype' => array(self::GROUPDAV => 'vtodo-collection', self::CALDAV => 'calendar'),
@@ -229,14 +229,14 @@  discard block
 block discarded – undo
229 229
 		if ($this->debug > 2) error_log('groupdav: $_SERVER='.array2string($_SERVER));
230 230
 
231 231
 		// setting our own exception handler, to be able to still log the requests
232
-		set_exception_handler(array(__CLASS__,'exception_handler'));
232
+		set_exception_handler(array(__CLASS__, 'exception_handler'));
233 233
 
234 234
 		// crrnd: client refuses redundand namespace declarations
235 235
 		// setting redundand namespaces as the default for (Cal|Card|Group)DAV, as the majority of the clients either require or can live with it
236 236
 		$this->crrnd = false;
237 237
 
238 238
 		// identify clients, which do NOT support path AND full url in <D:href> of PROPFIND request
239
-		switch(($agent = Handler::get_agent()))
239
+		switch (($agent = Handler::get_agent()))
240 240
 		{
241 241
 			case 'kde':	// KAddressbook (at least in 3.5 can NOT subscribe / does NOT find addressbook)
242 242
 				$this->client_require_href_as_url = true;
@@ -257,12 +257,12 @@  discard block
 block discarded – undo
257 257
 		if ($this->debug) error_log(__METHOD__."() HTTP_USER_AGENT='$_SERVER[HTTP_USER_AGENT]' --> '$agent' --> client_requires_href_as_url=$this->client_require_href_as_url, crrnd(client refuses redundand namespace declarations)=$this->crrnd");
258 258
 
259 259
 		// adding EGroupware version to X-Dav-Powered-By header eg. "EGroupware 1.8.001 CalDAV/CardDAV/GroupDAV server"
260
-		$this->dav_powered_by = str_replace('EGroupware','EGroupware '.$GLOBALS['egw_info']['server']['versions']['phpgwapi'],
260
+		$this->dav_powered_by = str_replace('EGroupware', 'EGroupware '.$GLOBALS['egw_info']['server']['versions']['phpgwapi'],
261 261
 			$this->dav_powered_by);
262 262
 
263 263
 		parent::__construct();
264 264
 		// hack to allow to use query parameters in WebDAV, which HTTP_WebDAV_Server interprets as part of the path
265
-		list($this->_SERVER['REQUEST_URI']) = explode('?',$this->_SERVER['REQUEST_URI']);
265
+		list($this->_SERVER['REQUEST_URI']) = explode('?', $this->_SERVER['REQUEST_URI']);
266 266
 		/*if (substr($this->_SERVER['REQUEST_URI'],-13) == '/;add-member/')
267 267
 		{
268 268
 			$_GET['add-member'] = '';
@@ -277,15 +277,15 @@  discard block
 block discarded – undo
277 277
 		}
278 278
 		else
279 279
 		{
280
-			$this->current_user_principal = (@$_SERVER["HTTPS"] === "on" ? "https:" : "http:") .
281
-				'//' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . '/';
280
+			$this->current_user_principal = (@$_SERVER["HTTPS"] === "on" ? "https:" : "http:").
281
+				'//'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'].'/';
282 282
 		}
283 283
 		$this->current_user_principal .= 'principals/users/'.$GLOBALS['egw_info']['user']['account_lid'].'/';
284 284
 
285 285
 		// if client requires pathes instead of URLs
286 286
 		if (!$this->client_require_href_as_url)
287 287
 		{
288
-			$this->current_user_principal = parse_url($this->current_user_principal,PHP_URL_PATH);
288
+			$this->current_user_principal = parse_url($this->current_user_principal, PHP_URL_PATH);
289 289
 		}
290 290
 		$this->accounts = $GLOBALS['egw']->accounts;
291 291
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	{
303 303
 		if (isset($this->root[$app]['app'])) $app = $this->root[$app]['app'];
304 304
 
305
-		return Handler::app_handler($app,$this);
305
+		return Handler::app_handler($app, $this);
306 306
 	}
307 307
 
308 308
 	/**
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	 */
315 315
 	function OPTIONS($path, &$dav, &$allow)
316 316
 	{
317
-		unset($allow);	// not used, but required by function signature
317
+		unset($allow); // not used, but required by function signature
318 318
 
319 319
 		// locking support
320 320
 		if (!in_array('2', $dav)) $dav[] = '2';
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 		}
352 352
 		if ($app !== 'calendar')	// CardDAV
353 353
 		{
354
-			$dav[] = 'addressbook';	// CardDAV uses "addressbook" NOT "addressbook-access"
354
+			$dav[] = 'addressbook'; // CardDAV uses "addressbook" NOT "addressbook-access"
355 355
 		}
356 356
 		//error_log(__METHOD__."('$path') --> app='$app' --> DAV: ".implode(', ', $dav));
357 357
 	}
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 	 * @param  array  return array for file properties
364 364
 	 * @return bool   true on success
365 365
 	 */
366
-	function PROPFIND(&$options, &$files, $method='PROPFIND')
366
+	function PROPFIND(&$options, &$files, $method = 'PROPFIND')
367 367
 	{
368 368
 		if ($this->debug) error_log(__CLASS__."::$method(".array2string($options).')');
369 369
 
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 
373 373
 		// parse path in form [/account_lid]/app[/more]
374 374
 		$id = $app = $user = $user_prefix = null;
375
-		if (!self::_parse_path($options['path'],$id,$app,$user,$user_prefix) && $app && !$user && $user !== 0)
375
+		if (!self::_parse_path($options['path'], $id, $app, $user, $user_prefix) && $app && !$user && $user !== 0)
376 376
 		{
377 377
 			if ($this->debug > 1) error_log(__CLASS__."::$method: user='$user', app='$app', id='$id': 404 not found!");
378 378
 			return '404 Not Found';
@@ -404,9 +404,9 @@  discard block
 block discarded – undo
404 404
 				$files['files'][] = $this->add_collection('/principals/', array(
405 405
 					'displayname' => lang('Accounts'),
406 406
 				));
407
-				foreach($this->accounts->search(array('type' => 'both','order'=>'account_lid')) as $account)
407
+				foreach ($this->accounts->search(array('type' => 'both', 'order'=>'account_lid')) as $account)
408 408
 				{
409
-					$this->add_home($files, $path.$account['account_lid'].'/', $account['account_id'], $options['depth'] == 'infinity' ? 'infinity' : $options['depth']-1);
409
+					$this->add_home($files, $path.$account['account_lid'].'/', $account['account_id'], $options['depth'] == 'infinity' ? 'infinity' : $options['depth'] - 1);
410 410
 				}
411 411
 			}
412 412
 			return true;
@@ -418,14 +418,14 @@  discard block
 block discarded – undo
418 418
 		if ($app != 'principals' && !isset($GLOBALS['egw_info']['user']['apps'][$this->root[$app]['app'] ? $this->root[$app]['app'] : $app]))
419 419
 		{
420 420
 			if ($this->debug) error_log(__CLASS__."::$method(path=$options[path]) 403 Forbidden: no app rights for '$app'");
421
-			return "403 Forbidden: no app rights for '$app'";	// no rights for the given app
421
+			return "403 Forbidden: no app rights for '$app'"; // no rights for the given app
422 422
 		}
423 423
 		if (($handler = self::app_handler($app)))
424 424
 		{
425 425
 			if ($method != 'REPORT' && !$id)	// no self URL for REPORT requests (only PROPFIND) or propfinds on an id
426 426
 			{
427 427
 				// KAddressbook doubles the folder, if the self URL contains the GroupDAV/CalDAV resourcetypes
428
-				$files['files'][0] = $this->add_app($app,$app=='addressbook'&&$handler->get_agent()=='kde',$user,
428
+				$files['files'][0] = $this->add_app($app, $app == 'addressbook' && $handler->get_agent() == 'kde', $user,
429 429
 					$this->_slashify($options['path']));
430 430
 
431 431
 				// Hack for iOS 5.0.1 addressbook to stop asking directory gateway permissions with depth != 0
@@ -436,9 +436,9 @@  discard block
 block discarded – undo
436 436
 					$this->log(__CLASS__."::$method(".array2string($options).') Enabling hack for iOS 5.0.1 addressbook: force Depth: 0 on PROPFIND for directory gateway!');
437 437
 					return true;
438 438
 				}
439
-				if (!$options['depth']) return true;	// depth 0 --> show only the self url
439
+				if (!$options['depth']) return true; // depth 0 --> show only the self url
440 440
 			}
441
-			return $handler->propfind($this->_slashify($options['path']),$options,$files,$user,$id);
441
+			return $handler->propfind($this->_slashify($options['path']), $options, $files, $user, $id);
442 442
 		}
443 443
 		return '501 Not Implemented';
444 444
 	}
@@ -452,10 +452,10 @@  discard block
 block discarded – undo
452 452
 	 * @param array $supported_privileges =null default $this->supported_privileges
453 453
 	 * @return array with values for keys 'path' and 'props'
454 454
 	 */
455
-	public function add_collection($path, array $props = array(), array $privileges=array('read','read-acl','read-current-user-privilege-set'), array $supported_privileges=null)
455
+	public function add_collection($path, array $props = array(), array $privileges = array('read', 'read-acl', 'read-current-user-privilege-set'), array $supported_privileges = null)
456 456
 	{
457 457
 		// resourcetype: collection
458
-		$props['resourcetype'][] = self::mkprop('collection','');
458
+		$props['resourcetype'][] = self::mkprop('collection', '');
459 459
 
460 460
 		if (!isset($props['getcontenttype'])) $props['getcontenttype'] = 'httpd/unix-directory';
461 461
 
@@ -471,16 +471,16 @@  discard block
 block discarded – undo
471 471
 	 * @param array $supported_privileges =null default $this->supported_privileges
472 472
 	 * @return array with values for keys 'path' and 'props'
473 473
 	 */
474
-	public function add_resource($path, array $props = array(), array $privileges=array('read','read-current-user-privilege-set'), array $supported_privileges=null)
474
+	public function add_resource($path, array $props = array(), array $privileges = array('read', 'read-current-user-privilege-set'), array $supported_privileges = null)
475 475
 	{
476 476
 		// props for all collections: current-user-principal and principal-collection-set
477 477
 		$props['current-user-principal'] = array(
478
-			self::mkprop('href',$this->current_user_principal));
478
+			self::mkprop('href', $this->current_user_principal));
479 479
 		$props['principal-collection-set'] = array(
480
-			self::mkprop('href',$this->base_uri.'/principals/'));
480
+			self::mkprop('href', $this->base_uri.'/principals/'));
481 481
 
482 482
 		// required props per WebDAV standard
483
-		foreach(array(
483
+		foreach (array(
484 484
 			'displayname'      => basename($path),
485 485
 			'getetag'          => 'none',
486 486
 			'getcontentlength' => '',
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 		if (is_null($supported_privileges)) $supported_privileges = $this->supported_privileges;
497 497
 		if ($this->prop_requested('current-user-privilege-set') === true)
498 498
 		{
499
-			foreach($privileges as $name)
499
+			foreach ($privileges as $name)
500 500
 			{
501 501
 				$props['current-user-privilege-set'][] = self::mkprop('privilege', array(
502 502
 					is_array($name) ? self::mkprop($name['ns'], $name['name'], '') : self::mkprop($name, '')));
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 		}
505 505
 		if ($this->prop_requested('supported-privilege-set') === true)
506 506
 		{
507
-			foreach($supported_privileges as $name => $data)
507
+			foreach ($supported_privileges as $name => $data)
508 508
 			{
509 509
 				$props['supported-privilege-set'][] = $this->supported_privilege($name, $data, $path);
510 510
 			}
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 		if ($this->debug > 1) error_log(__METHOD__."(path='$path', props=".array2string($props).')');
518 518
 
519 519
 		// convert simple associative properties to HTTP_WebDAV_Server ones
520
-		foreach($props as $name => &$prop)
520
+		foreach ($props as $name => &$prop)
521 521
 		{
522 522
 			if (!is_array($prop) || !isset($prop['name']))
523 523
 			{
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 	 * @param string $path =null path to match with $data['*only*']
545 545
 	 * @return array of self::mkprop() arrays
546 546
 	 */
547
-	protected function supported_privilege($name, $data, $path=null)
547
+	protected function supported_privilege($name, $data, $path = null)
548 548
 	{
549 549
 		$props = array();
550 550
 		$props[] = self::mkprop('privilege', array(is_array($data) && $data['*ns*'] ?
@@ -552,12 +552,12 @@  discard block
 block discarded – undo
552 552
 		$props[] = self::mkprop('description', is_array($data) ? $data['*description*'] : $data);
553 553
 		if (is_array($data))
554 554
 		{
555
-			foreach($data as $name => $data)
555
+			foreach ($data as $name => $data)
556 556
 			{
557 557
 				if ($name[0] == '*') continue;
558 558
 				if (is_array($data) && $data['*only*'] && strpos($path, $data['*only*']) === false)
559 559
 				{
560
-					continue;	// wrong path
560
+					continue; // wrong path
561 561
 				}
562 562
 				$props[] = $this->supported_privilege($name, $data, $path);
563 563
 			}
@@ -573,20 +573,20 @@  discard block
 block discarded – undo
573 573
 	 * @param boolean $return_prop =false if true return the property array with values for 'name', 'xmlns', 'attrs', 'children'
574 574
 	 * @return boolean|string|array true: $name explicitly requested (or autoindex), "all": allprop or "names": propname requested, false: $name was not requested
575 575
 	 */
576
-	function prop_requested($name, $ns=null, $return_prop=false)
576
+	function prop_requested($name, $ns = null, $return_prop = false)
577 577
 	{
578 578
 		if (!is_array($this->propfind_options) || !isset($this->propfind_options['props']))
579 579
 		{
580
-			$ret = true;	// no props set, should happen only in autoindex, we return true to show all available props
580
+			$ret = true; // no props set, should happen only in autoindex, we return true to show all available props
581 581
 		}
582 582
 		elseif (!is_array($this->propfind_options['props']))
583 583
 		{
584
-			$ret = $this->propfind_options['props'];	// "all": allprop or "names": propname
584
+			$ret = $this->propfind_options['props']; // "all": allprop or "names": propname
585 585
 		}
586 586
 		else
587 587
 		{
588 588
 			$ret = false;
589
-			foreach($this->propfind_options['props'] as $prop)
589
+			foreach ($this->propfind_options['props'] as $prop)
590 590
 			{
591 591
 				if ($prop['name'] == $name && (is_null($ns) || $prop['xmlns'] == $ns))
592 592
 				{
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 		$account = $this->accounts->read($account_lid);
622 622
 
623 623
 		$calendar_user_address_set = array(
624
-			self::mkprop('href','urn:uuid:'.$account['account_lid']),
624
+			self::mkprop('href', 'urn:uuid:'.$account['account_lid']),
625 625
 		);
626 626
 		if ($user < 0)
627 627
 		{
@@ -632,29 +632,29 @@  discard block
 block discarded – undo
632 632
 		{
633 633
 			$principalType = 'users';
634 634
 			$displayname = $account['account_fullname'];
635
-			$calendar_user_address_set[] = self::mkprop('href','mailto:'.$account['account_email']);
635
+			$calendar_user_address_set[] = self::mkprop('href', 'mailto:'.$account['account_email']);
636 636
 		}
637
-		$calendar_user_address_set[] = self::mkprop('href',$this->base_uri.'/principals/'.$principalType.'/'.$account['account_lid'].'/');
637
+		$calendar_user_address_set[] = self::mkprop('href', $this->base_uri.'/principals/'.$principalType.'/'.$account['account_lid'].'/');
638 638
 
639 639
 		if ($depth && $path == '/')
640 640
 		{
641 641
 			$displayname = 'EGroupware (Cal|Card|Group)DAV server';
642 642
 		}
643 643
 
644
-		$displayname = Translation::convert($displayname, Translation::charset(),'utf-8');
644
+		$displayname = Translation::convert($displayname, Translation::charset(), 'utf-8');
645 645
 		// self url
646 646
 		$props = array(
647 647
 			'displayname' => $displayname,
648
-			'owner' => $path == '/' ? '' : array(self::mkprop('href',$this->base_uri.'/principals/'.$principalType.'/'.$account_lid.'/')),
648
+			'owner' => $path == '/' ? '' : array(self::mkprop('href', $this->base_uri.'/principals/'.$principalType.'/'.$account_lid.'/')),
649 649
 		);
650 650
 
651 651
 		if ($path != '/')
652 652
 		{
653 653
 			// add props modifyable via proppatch from client, eg. jqcalendar stores it's preferences there
654
-			foreach((array)$GLOBALS['egw_info']['user']['preferences']['groupdav'] as $name => $value)
654
+			foreach ((array)$GLOBALS['egw_info']['user']['preferences']['groupdav'] as $name => $value)
655 655
 			{
656
-				list($prop,$prop4path,$ns) = explode(':', $name, 3);
657
-				if ($prop4path == $path && (!in_array($ns,self::$ns_needs_explicit_named_props) ||
656
+				list($prop, $prop4path, $ns) = explode(':', $name, 3);
657
+				if ($prop4path == $path && (!in_array($ns, self::$ns_needs_explicit_named_props) ||
658 658
 					isset(self::$proppatch_props[$prop]) && self::$proppatch_props[$prop] === $ns))
659 659
 				{
660 660
 					$props[] = self::mkprop($ns, $prop, $value);
@@ -666,19 +666,19 @@  discard block
 block discarded – undo
666 666
 
667 667
 		if ($depth)
668 668
 		{
669
-			foreach($this->root as $app => $data)
669
+			foreach ($this->root as $app => $data)
670 670
 			{
671
-				if (!$GLOBALS['egw_info']['user']['apps'][$data['app'] ? $data['app'] : $app]) continue;	// no rights for the given app
671
+				if (!$GLOBALS['egw_info']['user']['apps'][$data['app'] ? $data['app'] : $app]) continue; // no rights for the given app
672 672
 				if (!empty($data['user-only']) && ($path == '/' || $user < 0)) continue;
673 673
 
674
-				$files['files'][] = $this->add_app($app,false,$user,$path.$app.'/');
674
+				$files['files'][] = $this->add_app($app, false, $user, $path.$app.'/');
675 675
 
676 676
 				// only add global /addressbook-accounts/ as the one in home-set is added (and controled) by add_shared
677 677
 				if ($path == '/' && $app == 'addressbook' &&
678 678
 					$GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts'] !== '1')
679 679
 				{
680
-					$file = $this->add_app($app,false,0,$path.$app.'-accounts/');
681
-					$file['props']['resourcetype']['val'][] = self::mkprop(self::CALENDARSERVER,'shared','');
680
+					$file = $this->add_app($app, false, 0, $path.$app.'-accounts/');
681
+					$file['props']['resourcetype']['val'][] = self::mkprop(self::CALENDARSERVER, 'shared', '');
682 682
 					$files['files'][] = $file;
683 683
 				}
684 684
 				// added shared calendars or addressbooks
@@ -701,12 +701,12 @@  discard block
 block discarded – undo
701 701
 	 * @param int $depth =0
702 702
 	 * @return string|boolean http status or true|false
703 703
 	 */
704
-	protected function add_resources_collection(array &$files, $path, $depth=0)
704
+	protected function add_resources_collection(array &$files, $path, $depth = 0)
705 705
 	{
706 706
 		if (!isset($GLOBALS['egw_info']['user']['apps']['resources']))
707 707
 		{
708 708
 			if ($this->debug) error_log(__METHOD__."(path=$path) 403 Forbidden: no app rights for 'resources'");
709
-			return "403 Forbidden: no app rights for 'resources'";	// no rights for the given app
709
+			return "403 Forbidden: no app rights for 'resources'"; // no rights for the given app
710 710
 		}
711 711
 		list(,$what) = explode('/', $path);
712 712
 		if (($is_location = ($what == 'locations')))
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 		}
720 720
 		if ($depth)
721 721
 		{
722
-			foreach(Principals::get_resources() as $resource)
722
+			foreach (Principals::get_resources() as $resource)
723 723
 			{
724 724
 				if ($is_location == Principals::resource_is_location($resource))
725 725
 				{
@@ -751,11 +751,11 @@  discard block
 block discarded – undo
751 751
 		$handler = $this->app_handler($app);
752 752
 		if (($shared = $handler->get_shared()))
753 753
 		{
754
-			foreach($shared as $id => $owner)
754
+			foreach ($shared as $id => $owner)
755 755
 			{
756
-				$file = $this->add_app($app,false,$id,$path.$owner.'/');
756
+				$file = $this->add_app($app, false, $id, $path.$owner.'/');
757 757
 				// mark other users calendar as shared (iOS 5.0.1 AB does NOT display AB marked as shared!)
758
-				if ($app == 'calendar') $file['props']['resourcetype']['val'][] = self::mkprop(self::CALENDARSERVER,'shared','');
758
+				if ($app == 'calendar') $file['props']['resourcetype']['val'][] = self::mkprop(self::CALENDARSERVER, 'shared', '');
759 759
 				$files[] = $file;
760 760
 			}
761 761
 		}
@@ -785,11 +785,11 @@  discard block
 block discarded – undo
785 785
 		{
786 786
 			if ($account < 0)
787 787
 			{
788
-				$name = lang('Group').' '.$this->accounts->id2name($account,'account_lid');
788
+				$name = lang('Group').' '.$this->accounts->id2name($account, 'account_lid');
789 789
 			}
790 790
 			else
791 791
 			{
792
-				$name = $this->accounts->id2name($account,'account_fullname');
792
+				$name = $this->accounts->id2name($account, 'account_fullname');
793 793
 			}
794 794
 			if (empty($name)) $name = '#'.$account;
795 795
 		}
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 	 * @param string $path ='/'
806 806
 	 * @return array with values for keys 'path' and 'props'
807 807
 	 */
808
-	protected function add_app($app,$no_extra_types=false,$user=null,$path='/')
808
+	protected function add_app($app, $no_extra_types = false, $user = null, $path = '/')
809 809
 	{
810 810
 		if ($this->debug) error_log(__METHOD__."(app='$app', no_extra_types=$no_extra_types, user='$user', path='$path')");
811 811
 		$user_preferences = $GLOBALS['egw_info']['user']['preferences'];
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 		if (!isset($displayname)) $displayname = $this->account_name($user);
835 835
 
836 836
 		$props = array(
837
-			'owner' => array(self::mkprop('href',$this->base_uri.'/principals/'.$principalType.'/'.$account_lid.'/')),
837
+			'owner' => array(self::mkprop('href', $this->base_uri.'/principals/'.$principalType.'/'.$account_lid.'/')),
838 838
 		);
839 839
 
840 840
 		switch ($app)
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
 					$props['displayname'] = lang('All addressbooks');
852 852
 					break;
853 853
 				}
854
-				elseif(!$user && $GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts'] !== '1')
854
+				elseif (!$user && $GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts'] !== '1')
855 855
 				{
856 856
 					unset($props['owner']);
857 857
 					$props['displayname'] = lang($app).' '.lang('Accounts');
@@ -864,40 +864,40 @@  discard block
 block discarded – undo
864 864
 
865 865
 		// rfc 5995 (Use POST to add members to WebDAV collections): we use collection path with add-member query param
866 866
 		// leaving it switched off, until further testing, because OS X iCal seem to ignore it and OS X Addressbook uses POST to full URL without ?add-member
867
-		if ($app && !in_array($app,array('inbox','outbox','principals')))	// not on inbox, outbox or principals
867
+		if ($app && !in_array($app, array('inbox', 'outbox', 'principals')))	// not on inbox, outbox or principals
868 868
 		{
869
-			$props['add-member'][] = self::mkprop('href',$this->base_uri.$path.'?add-member');
869
+			$props['add-member'][] = self::mkprop('href', $this->base_uri.$path.'?add-member');
870 870
 		}
871 871
 
872 872
 		// add props modifyable via proppatch from client, eg. calendar-color, see self::$proppatch_props
873 873
 		$ns = null;
874
-		foreach((array)$GLOBALS['egw_info']['user']['preferences'][$app] as $name => $value)
874
+		foreach ((array)$GLOBALS['egw_info']['user']['preferences'][$app] as $name => $value)
875 875
 		{
876 876
 			unset($ns);
877
-			list($prop,$prop4user,$ns) = explode(':', $name, 3);
877
+			list($prop, $prop4user, $ns) = explode(':', $name, 3);
878 878
 			if ($prop4user == (string)$user && isset(self::$proppatch_props[$prop]) && !isset($ns))
879 879
 			{
880 880
 				$props[$prop] = self::mkprop(self::$proppatch_props[$prop], $prop, $value);
881 881
 				//error_log(__METHOD__."() explicit ".self::$proppatch_props[$prop].":$prop=".array2string($value));
882 882
 			}
883 883
 			// props in arbitrary namespaces not mentioned in self::$ns_needs_explicit_named_props
884
-			elseif(isset($ns) && !in_array($ns,self::$ns_needs_explicit_named_props))
884
+			elseif (isset($ns) && !in_array($ns, self::$ns_needs_explicit_named_props))
885 885
 			{
886 886
 				$props[] = self::mkprop($ns, $prop, $value);
887 887
 				//error_log(__METHOD__."() arbitrary $ns:$prop=".array2string($value));
888 888
 			}
889 889
 		}
890 890
 
891
-		foreach((array)$this->root[$app] as $prop => $values)
891
+		foreach ((array)$this->root[$app] as $prop => $values)
892 892
 		{
893
-			switch($prop)
893
+			switch ($prop)
894 894
 			{
895 895
 				case 'resourcetype';
896 896
 					if (!$no_extra_types)
897 897
 					{
898
-						foreach($this->root[$app]['resourcetype'] as $ns => $type)
898
+						foreach ($this->root[$app]['resourcetype'] as $ns => $type)
899 899
 						{
900
-							$props['resourcetype'][] = self::mkprop($ns,$type,'');
900
+							$props['resourcetype'][] = self::mkprop($ns, $type, '');
901 901
 						}
902 902
 						// add /addressbook/ as directory gateway
903 903
 						if ($path == '/addressbook/')
@@ -908,13 +908,13 @@  discard block
 block discarded – undo
908 908
 					break;
909 909
 				case 'app':
910 910
 				case 'user-only':
911
-					break;	// no props, already handled
911
+					break; // no props, already handled
912 912
 				default:
913 913
 					if (is_array($values))
914 914
 					{
915
-						foreach($values as $ns => $value)
915
+						foreach ($values as $ns => $value)
916 916
 						{
917
-							$props[$prop] = self::mkprop($ns,$prop,$value);
917
+							$props[$prop] = self::mkprop($ns, $prop, $value);
918 918
 						}
919 919
 					}
920 920
 					else
@@ -927,20 +927,20 @@  discard block
 block discarded – undo
927 927
 		// add other handler specific properties
928 928
 		if (($handler = self::app_handler($app)))
929 929
 		{
930
-			if (method_exists($handler,'extra_properties'))
930
+			if (method_exists($handler, 'extra_properties'))
931 931
 			{
932 932
 				$props = $handler->extra_properties($props, $displayname, $this->base_uri, $user, $path);
933 933
 			}
934 934
 			// add ctag if handler implements it
935
-			if (method_exists($handler,'getctag') && $this->prop_requested('getctag') === true)
935
+			if (method_exists($handler, 'getctag') && $this->prop_requested('getctag') === true)
936 936
 			{
937 937
 				$props['getctag'] = self::mkprop(
938
-					self::CALENDARSERVER,'getctag',$handler->getctag($path,$user));
938
+					self::CALENDARSERVER, 'getctag', $handler->getctag($path, $user));
939 939
 			}
940 940
 			// add sync-token url if handler supports sync-collection report
941 941
 			if (isset($props['supported-report-set']['sync-collection']) && $this->prop_requested('sync-token') === true)
942 942
 			{
943
-				$props['sync-token'] = $handler->get_sync_token($path,$user);
943
+				$props['sync-token'] = $handler->get_sync_token($path, $user);
944 944
 			}
945 945
 		}
946 946
 		if ($handler && !is_null($user))
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
 	{
964 964
 		if ($this->debug > 1) error_log(__METHOD__.'('.array2string($options).')');
965 965
 
966
-		return $this->PROPFIND($options,$files,'REPORT');
966
+		return $this->PROPFIND($options, $files, 'REPORT');
967 967
 	}
968 968
 
969 969
 	/**
@@ -987,13 +987,13 @@  discard block
 block discarded – undo
987 987
 		if ($this->debug) error_log(__METHOD__.'('.array2string($options).')');
988 988
 
989 989
 		$id = $app = $user = null;
990
-		if (!$this->_parse_path($options['path'],$id,$app,$user) || $app == 'principals')
990
+		if (!$this->_parse_path($options['path'], $id, $app, $user) || $app == 'principals')
991 991
 		{
992 992
 			return $this->autoindex($options);
993 993
 		}
994 994
 		if (($handler = self::app_handler($app)))
995 995
 		{
996
-			return $handler->get($options,$id,$user);
996
+			return $handler->get($options, $id, $user);
997 997
 		}
998 998
 		error_log(__METHOD__."(".array2string($options).") 501 Not Implemented");
999 999
 		return '501 Not Implemented';
@@ -1011,9 +1011,9 @@  discard block
 block discarded – undo
1011 1011
 			'depth' => 1,
1012 1012
 		);
1013 1013
 		$files = array();
1014
-		if (($ret = $this->PROPFIND($propfind_options,$files)) !== true)
1014
+		if (($ret = $this->PROPFIND($propfind_options, $files)) !== true)
1015 1015
 		{
1016
-			return $ret;	// no collection
1016
+			return $ret; // no collection
1017 1017
 		}
1018 1018
 		header('Content-type: text/html; charset='.Translation::charset());
1019 1019
 		echo "<html>\n<head>\n\t<title>".'EGroupware (Cal|Card|Group)DAV server '.htmlspecialchars($options['path'])."</title>\n";
@@ -1024,10 +1024,10 @@  discard block
 block discarded – undo
1024 1024
 
1025 1025
 		echo '<h1>(Cal|Card|Group)DAV ';
1026 1026
 		$path = '/groupdav.php';
1027
-		foreach(explode('/',$this->_unslashify($options['path'])) as $n => $name)
1027
+		foreach (explode('/', $this->_unslashify($options['path'])) as $n => $name)
1028 1028
 		{
1029 1029
 			$path .= ($n != 1 ? '/' : '').$name;
1030
-			echo Html::a_href(htmlspecialchars($name.'/'),$path);
1030
+			echo Html::a_href(htmlspecialchars($name.'/'), $path);
1031 1031
 		}
1032 1032
 		echo "</h1>\n";
1033 1033
 
@@ -1047,18 +1047,18 @@  discard block
 block discarded – undo
1047 1047
 		);
1048 1048
 		$n = 0;
1049 1049
 		$collection_props = null;
1050
-		foreach($files['files'] as $file)
1050
+		foreach ($files['files'] as $file)
1051 1051
 		{
1052 1052
 			if (!isset($collection_props))
1053 1053
 			{
1054 1054
 				$collection_props = $this->props2array($file['props']);
1055 1055
 				echo '<h3>'.lang('Collection listing').': '.htmlspecialchars($collection_props['DAV:displayname'])."</h3>\n";
1056
-				continue;	// own entry --> displaying properies later
1056
+				continue; // own entry --> displaying properies later
1057 1057
 			}
1058
-			if(!$n++)
1058
+			if (!$n++)
1059 1059
 			{
1060 1060
 				echo "<table>\n\t<tr class='th'>\n\t\t<th>#</th>\n\t\t<th>".lang('Name')."</th>";
1061
-				foreach($props2show as $label)
1061
+				foreach ($props2show as $label)
1062 1062
 				{
1063 1063
 					echo "\t\t<th>".lang($label)."</th>\n";
1064 1064
 				}
@@ -1068,9 +1068,9 @@  discard block
 block discarded – undo
1068 1068
 			//echo $file['path']; _debug_array($props);
1069 1069
 			$class = $class == 'row_on' ? 'row_off' : 'row_on';
1070 1070
 
1071
-			if (substr($file['path'],-1) == '/')
1071
+			if (substr($file['path'], -1) == '/')
1072 1072
 			{
1073
-				$name = basename(substr($file['path'],0,-1)).'/';
1073
+				$name = basename(substr($file['path'], 0, -1)).'/';
1074 1074
 			}
1075 1075
 			else
1076 1076
 			{
@@ -1078,14 +1078,14 @@  discard block
 block discarded – undo
1078 1078
 			}
1079 1079
 
1080 1080
 			echo "\t<tr class='$class'>\n\t\t<td>$n</td>\n\t\t<td>".
1081
-				Html::a_href(htmlspecialchars($name),'/groupdav.php'.strtr($file['path'], array(
1081
+				Html::a_href(htmlspecialchars($name), '/groupdav.php'.strtr($file['path'], array(
1082 1082
 					'%' => '%25',
1083 1083
 					'#' => '%23',
1084 1084
 					'?' => '%3F',
1085 1085
 				)))."</td>\n";
1086
-			foreach($props2show as $prop => $label)
1086
+			foreach ($props2show as $prop => $label)
1087 1087
 			{
1088
-				echo "\t\t<td>".($prop=='DAV:getlastmodified'&&!empty($props[$prop])?date('Y-m-d H:i:s',$props[$prop]):$props[$prop])."</td>\n";
1088
+				echo "\t\t<td>".($prop == 'DAV:getlastmodified' && !empty($props[$prop]) ?date('Y-m-d H:i:s', $props[$prop]) : $props[$prop])."</td>\n";
1089 1089
 			}
1090 1090
 			echo "\t</tr>\n";
1091 1091
 		}
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 		}
1100 1100
 		echo '<h3>'.lang('Properties')."</h3>\n";
1101 1101
 		echo "<table>\n\t<tr class='th'><th>".lang('Namespace')."</th><th>".lang('Name')."</th><th>".lang('Value')."</th></tr>\n";
1102
-		foreach($collection_props as $name => $value)
1102
+		foreach ($collection_props as $name => $value)
1103 1103
 		{
1104 1104
 			$class = $class == 'row_on' ? 'row_off' : 'row_on';
1105 1105
 			$parts = explode(':', $name);
@@ -1149,11 +1149,11 @@  discard block
 block discarded – undo
1149 1149
 				'wrap'            => 0,
1150 1150
 			));
1151 1151
 		}
1152
-		if (($href=preg_match('/\<(D:)?href\>[^<]+\<\/(D:)?href\>/i',$value)))
1152
+		if (($href = preg_match('/\<(D:)?href\>[^<]+\<\/(D:)?href\>/i', $value)))
1153 1153
 		{
1154
-			$value = preg_replace('/\<(D:)?href\>('.preg_quote($this->base_uri.'/','/').')?([^<]+)\<\/(D:)?href\>/i','<\\1href><a href="\\2\\3">\\3</a></\\4href>',$value);
1154
+			$value = preg_replace('/\<(D:)?href\>('.preg_quote($this->base_uri.'/', '/').')?([^<]+)\<\/(D:)?href\>/i', '<\\1href><a href="\\2\\3">\\3</a></\\4href>', $value);
1155 1155
 		}
1156
-		$ret = $value[0] == '<'  || strpos($value, "\n") !== false ? '<pre>'.htmlspecialchars($value).'</pre>' : htmlspecialchars($value);
1156
+		$ret = $value[0] == '<' || strpos($value, "\n") !== false ? '<pre>'.htmlspecialchars($value).'</pre>' : htmlspecialchars($value);
1157 1157
 
1158 1158
 		if ($href)
1159 1159
 		{
@@ -1171,10 +1171,10 @@  discard block
 block discarded – undo
1171 1171
 	protected function props2array(array $props)
1172 1172
 	{
1173 1173
 		$arr = array();
1174
-		foreach($props as $prop)
1174
+		foreach ($props as $prop)
1175 1175
 		{
1176 1176
 			$ns_hash = array('DAV:' => 'D');
1177
-			switch($prop['ns'])
1177
+			switch ($prop['ns'])
1178 1178
 			{
1179 1179
 				case 'DAV:';
1180 1180
 					$ns = 'DAV';
@@ -1193,10 +1193,10 @@  discard block
 block discarded – undo
1193 1193
 			}
1194 1194
 			if (is_array($prop['val']))
1195 1195
 			{
1196
-				$prop['val'] = $this->_hierarchical_prop_encode($prop['val'], $prop['ns'], $ns_defs='', $ns_hash);
1196
+				$prop['val'] = $this->_hierarchical_prop_encode($prop['val'], $prop['ns'], $ns_defs = '', $ns_hash);
1197 1197
 				// hack to show real namespaces instead of not (visibly) defined shortcuts
1198 1198
 				unset($ns_hash['DAV:']);
1199
-				$value = strtr($v=$this->prop_value($prop['val']),array_flip($ns_hash));
1199
+				$value = strtr($v = $this->prop_value($prop['val']), array_flip($ns_hash));
1200 1200
 			}
1201 1201
 			else
1202 1202
 			{
@@ -1219,13 +1219,13 @@  discard block
 block discarded – undo
1219 1219
 		// POST to the collection URL plus a UID like name component (like for regular PUT) to create new entrys
1220 1220
 		if (isset($_GET['add-member']) || Handler::get_agent() == 'cfnetwork')
1221 1221
 		{
1222
-			$_GET['add-member'] = '';	// otherwise we give no Location header
1222
+			$_GET['add-member'] = ''; // otherwise we give no Location header
1223 1223
 			return $this->PUT($options);
1224 1224
 		}
1225 1225
 		if ($this->debug) error_log(__METHOD__.'('.array2string($options).')');
1226 1226
 
1227 1227
 		$id = $app = $user = null;
1228
-		$this->_parse_path($options['path'],$id,$app,$user);
1228
+		$this->_parse_path($options['path'], $id, $app, $user);
1229 1229
 
1230 1230
 		if (($handler = self::app_handler($app)))
1231 1231
 		{
@@ -1241,12 +1241,12 @@  discard block
 block discarded – undo
1241 1241
 				if (isset($options['stream']))
1242 1242
 				{
1243 1243
 					$options['content'] = '';
1244
-					while(!feof($options['stream']))
1244
+					while (!feof($options['stream']))
1245 1245
 					{
1246
-						$options['content'] .= fread($options['stream'],8192);
1246
+						$options['content'] .= fread($options['stream'], 8192);
1247 1247
 					}
1248 1248
 				}
1249
-				return $handler->post($options,$id,$user);
1249
+				return $handler->post($options, $id, $user);
1250 1250
 			}
1251 1251
 		}
1252 1252
 		return '501 Not Implemented';
@@ -1285,7 +1285,7 @@  discard block
 block discarded – undo
1285 1285
 			return '403 Forbidden';
1286 1286
 		}
1287 1287
 
1288
-		switch($action)
1288
+		switch ($action)
1289 1289
 		{
1290 1290
 			case 'attachment-add':
1291 1291
 				$matches = null;
@@ -1297,8 +1297,8 @@  discard block
 block discarded – undo
1297 1297
 				}
1298 1298
 				$path = null;
1299 1299
 				if (!($to = self::fopen_attachment($handler->app, $handler->get_id($entry), $filename, $this->_SERVER['CONTENT_TYPE'], $path)) ||
1300
-					isset($options['stream']) && ($copied=stream_copy_to_stream($options['stream'], $to)) === false ||
1301
-					isset($options['content']) && ($copied=fwrite($to, $options['content'])) === false)
1300
+					isset($options['stream']) && ($copied = stream_copy_to_stream($options['stream'], $to)) === false ||
1301
+					isset($options['content']) && ($copied = fwrite($to, $options['content'])) === false)
1302 1302
 				{
1303 1303
 					return '403 Forbidden';
1304 1304
 				}
@@ -1341,8 +1341,8 @@  discard block
 block discarded – undo
1341 1341
 						}
1342 1342
 					}
1343 1343
 					if (!($to = Vfs::fopen($path, 'w')) ||
1344
-						isset($options['stream']) && ($copied=stream_copy_to_stream($options['stream'], $to)) === false ||
1345
-						isset($options['content']) && ($copied=fwrite($to, $options['content'])) === false)
1344
+						isset($options['stream']) && ($copied = stream_copy_to_stream($options['stream'], $to)) === false ||
1345
+						isset($options['content']) && ($copied = fwrite($to, $options['content'])) === false)
1346 1346
 					{
1347 1347
 						self::xml_error(self::mkprop(self::CALDAV, 'valid-managed-id-parameter', ''));
1348 1348
 						return '403 Forbidden';
@@ -1384,23 +1384,23 @@  discard block
 block discarded – undo
1384 1384
 	 * @param boolean $delete_via_put
1385 1385
 	 * @return boolean false on error, eg. invalid managed id, for false an xml-error body has been send
1386 1386
 	 */
1387
-	public static function handle_attach($app, $id, $attach, $delete_via_put=false)
1387
+	public static function handle_attach($app, $id, $attach, $delete_via_put = false)
1388 1388
 	{
1389 1389
 		//error_log(__METHOD__."('$app', $id, attach=".array2string($attach).", delete_via_put=".array2string($delete_via_put).')');
1390 1390
 
1391 1391
 		if (!Link::file_access($app, $id, Acl::EDIT))
1392 1392
 		{
1393 1393
 			error_log(__METHOD__."('$app', $id, ...) no rights to update attachments");
1394
-			return;	// no rights --> nothing to do
1394
+			return; // no rights --> nothing to do
1395 1395
 		}
1396
-		if (!is_array($attach)) $attach = array();	// could be PEAR_Error if not set
1396
+		if (!is_array($attach)) $attach = array(); // could be PEAR_Error if not set
1397 1397
 
1398 1398
 		if ($delete_via_put)
1399 1399
 		{
1400
-			foreach(Vfs::find(Link::vfs_path($app, $id, '', true), array('type' => 'F')) as $path)
1400
+			foreach (Vfs::find(Link::vfs_path($app, $id, '', true), array('type' => 'F')) as $path)
1401 1401
 			{
1402 1402
 				$found = false;
1403
-				foreach($attach as $key => $attr)
1403
+				foreach ($attach as $key => $attr)
1404 1404
 				{
1405 1405
 					if ($attr['params']['MANAGED-ID'] === self::path2managed_id($path))
1406 1406
 					{
@@ -1417,7 +1417,7 @@  discard block
 block discarded – undo
1417 1417
 			}
1418 1418
 		}
1419 1419
 		// turn inline attachments into managed ones
1420
-		foreach($attach as $key => $attr)
1420
+		foreach ($attach as $key => $attr)
1421 1421
 		{
1422 1422
 			if (!empty($attr['params']['FMTTYPE']))
1423 1423
 			{
@@ -1430,7 +1430,7 @@  discard block
 block discarded – undo
1430 1430
 						self::xml_error(self::mkprop(self::CALDAV, 'valid-managed-id', ''));
1431 1431
 						return false;
1432 1432
 					}
1433
-					if($path == ($link = Link::vfs_path($app, $id, Vfs::basename($path))))
1433
+					if ($path == ($link = Link::vfs_path($app, $id, Vfs::basename($path))))
1434 1434
 					{
1435 1435
 						error_log(__METHOD__."('$app', $id, ...) trying to modify existing MANAGED-ID --> ignored! ".array2string($attr));
1436 1436
 						continue;
@@ -1438,8 +1438,8 @@  discard block
 block discarded – undo
1438 1438
 					// reuse valid managed-id --> symlink attachment
1439 1439
 					if (Vfs::file_exists($link))
1440 1440
 					{
1441
-						if (Vfs::readlink($link) === $path) continue;	// no need to recreate identical link
1442
-						Vfs::unlink($link);		// symlink will fail, if $link exists
1441
+						if (Vfs::readlink($link) === $path) continue; // no need to recreate identical link
1442
+						Vfs::unlink($link); // symlink will fail, if $link exists
1443 1443
 					}
1444 1444
 					if (!Vfs::symlink($path, $link))
1445 1445
 					{
@@ -1447,7 +1447,7 @@  discard block
 block discarded – undo
1447 1447
 					}
1448 1448
 					continue;
1449 1449
 				}
1450
-				if (!($to = self::fopen_attachment($app, $id, $filename=$attr['params']['FILENAME'], $attr['params']['FMTTYPE'], $path)) ||
1450
+				if (!($to = self::fopen_attachment($app, $id, $filename = $attr['params']['FILENAME'], $attr['params']['FMTTYPE'], $path)) ||
1451 1451
 					// Horde Icalendar does NOT decode automatic
1452 1452
 					(/*$copied=*/fwrite($to, $attr['params']['ENCODING'] == 'BASE64' ? base64_decode($attr['value']) : $attr['value'])) === false)
1453 1453
 				{
@@ -1474,16 +1474,16 @@  discard block
 block discarded – undo
1474 1474
 	 * @param string &$path =null on return path opened
1475 1475
 	 * @return resource
1476 1476
 	 */
1477
-	protected static function fopen_attachment($app, $id, $_filename, $mime=null, &$path=null)
1477
+	protected static function fopen_attachment($app, $id, $_filename, $mime = null, &$path = null)
1478 1478
 	{
1479 1479
 		$filename = empty($_filename) ? 'attachment' : Vfs::basename($_filename);
1480 1480
 
1481
-		if (strpos($mime, ';')) list($mime) = explode(';', $mime);	// in case it contains eg. charset info
1481
+		if (strpos($mime, ';')) list($mime) = explode(';', $mime); // in case it contains eg. charset info
1482 1482
 
1483 1483
 		$ext = !empty($mime) ? MimeMagic::mime2ext($mime) : '';
1484 1484
 
1485 1485
 		$matches = null;
1486
-		if (!$ext || substr($filename, -strlen($ext)-1) == '.'.$ext ||
1486
+		if (!$ext || substr($filename, -strlen($ext) - 1) == '.'.$ext ||
1487 1487
 			preg_match('/\.([^.]+)$/', $filename, $matches) && MimeMagic::ext2mime($matches[1]) == $mime)
1488 1488
 		{
1489 1489
 			$parts = explode('.', $filename);
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
 		{
1495 1495
 			$ext = '.'.$ext;
1496 1496
 		}
1497
-		for($i = 1; $i < 100; ++$i)
1497
+		for ($i = 1; $i < 100; ++$i)
1498 1498
 		{
1499 1499
 			$path = Link::vfs_path($app, $id, $filename.($i > 1 ? '-'.$i : '').$ext, true);
1500 1500
 			if (!Vfs::stat($path)) break;
@@ -1540,16 +1540,16 @@  discard block
 block discarded – undo
1540 1540
 	 */
1541 1541
 	public static function add_attach($app, $id, array &$attributes, array &$parameters)
1542 1542
 	{
1543
-		foreach(Vfs::find(Link::vfs_path($app, $id, '', true), array(
1543
+		foreach (Vfs::find(Link::vfs_path($app, $id, '', true), array(
1544 1544
 			'type' => 'F',
1545 1545
 			'need_mime' => true,
1546
-			'maxdepth' => 10,	// set a limit to not run into an infinit recursion
1546
+			'maxdepth' => 10, // set a limit to not run into an infinit recursion
1547 1547
 		), true) as $path => $stat)
1548 1548
 		{
1549 1549
 			// handle symlinks --> return target size and mime-type
1550 1550
 			if (($target = Vfs::readlink($path)))
1551 1551
 			{
1552
-				if (!($stat = Vfs::stat($target))) continue;	// broken or inaccessible symlink
1552
+				if (!($stat = Vfs::stat($target))) continue; // broken or inaccessible symlink
1553 1553
 
1554 1554
 				// check if target is in /apps, probably reused MANAGED-ID --> return it
1555 1555
 				if (substr($target, 0, 6) == '/apps/')
@@ -1561,7 +1561,7 @@  discard block
 block discarded – undo
1561 1561
 			$parameters['ATTACH'][] = array(
1562 1562
 				'MANAGED-ID' => self::path2managed_id($path),
1563 1563
 				'FMTTYPE'    => $stat['mime'],
1564
-				'SIZE'       => (string)$stat['size'],	// Horde_Icalendar renders int as empty string
1564
+				'SIZE'       => (string)$stat['size'], // Horde_Icalendar renders int as empty string
1565 1565
 				'FILENAME'   => Vfs::basename($path),
1566 1566
 			);
1567 1567
 			// if we have attachments, set X-attribute to enable deleting them by put
@@ -1589,7 +1589,7 @@  discard block
 block discarded – undo
1589 1589
 	 * @param string|int $id =null id to check agains path
1590 1590
 	 * @return string|boolean "/apps/$app/$id/something" or false if not found or not belonging to given $app/$id
1591 1591
 	 */
1592
-	static public function managed_id2path($managed_id, $app=null, $id=null)
1592
+	static public function managed_id2path($managed_id, $app = null, $id = null)
1593 1593
 	{
1594 1594
 		$path = base64_decode($managed_id);
1595 1595
 
@@ -1599,7 +1599,7 @@  discard block
 block discarded – undo
1599 1599
 		}
1600 1600
 		elseif (!empty($app) && !empty($id))
1601 1601
 		{
1602
-			list(,,$a,$i) = explode('/', $path);
1602
+			list(,, $a, $i) = explode('/', $path);
1603 1603
 			if ($a !== $app || $i !== (string)$id)
1604 1604
 			{
1605 1605
 				$path = false;
@@ -1627,7 +1627,7 @@  discard block
 block discarded – undo
1627 1627
 		'displayname' => self::DAV,
1628 1628
 		'calendar-description' => self::CALDAV,
1629 1629
 		'addressbook-description' => self::CARDDAV,
1630
-		'calendar-color' => self::ICAL,	// only mentioned that old prefs still work
1630
+		'calendar-color' => self::ICAL, // only mentioned that old prefs still work
1631 1631
 		'calendar-order' => self::ICAL,
1632 1632
 		'default-alarm-vevent-date' => self::CALDAV,
1633 1633
 		'default-alarm-vevent-datetime' => self::CALDAV,
@@ -1645,11 +1645,11 @@  discard block
 block discarded – undo
1645 1645
 
1646 1646
 		// parse path in form [/account_lid]/app[/more]
1647 1647
 		$id = $app = $user = $user_prefix = null;
1648
-		self::_parse_path($options['path'],$id,$app,$user,$user_prefix);	// allways returns false if eg. !$id
1648
+		self::_parse_path($options['path'], $id, $app, $user, $user_prefix); // allways returns false if eg. !$id
1649 1649
 		if ($app == 'principals' || $id || $options['path'] == '/')
1650 1650
 		{
1651 1651
 			if ($this->debug > 1) error_log(__METHOD__.": user='$user', app='$app', id='$id': 404 not found!");
1652
-			foreach($options['props'] as &$prop)
1652
+			foreach ($options['props'] as &$prop)
1653 1653
 			{
1654 1654
 				$prop['status'] = '403 Forbidden';
1655 1655
 			}
@@ -1657,10 +1657,10 @@  discard block
 block discarded – undo
1657 1657
 		}
1658 1658
 		// store selected props in preferences, eg. calendar-color, see self::$proppatch_props
1659 1659
 		$need_save = array();
1660
-		foreach($options['props'] as &$prop)
1660
+		foreach ($options['props'] as &$prop)
1661 1661
 		{
1662 1662
 			if ((isset(self::$proppatch_props[$prop['name']]) && self::$proppatch_props[$prop['name']] === $prop['xmlns'] ||
1663
-				!in_array($prop['xmlns'],self::$ns_needs_explicit_named_props)))
1663
+				!in_array($prop['xmlns'], self::$ns_needs_explicit_named_props)))
1664 1664
 			{
1665 1665
 				if (!$app)
1666 1666
 				{
@@ -1689,7 +1689,7 @@  discard block
 block discarded – undo
1689 1689
 			}
1690 1690
 			else
1691 1691
 			{
1692
-				$prop['status'] = '409 Conflict';	// could also be "403 Forbidden"
1692
+				$prop['status'] = '409 Conflict'; // could also be "403 Forbidden"
1693 1693
 			}
1694 1694
 		}
1695 1695
 		if ($need_save)
@@ -1698,7 +1698,7 @@  discard block
 block discarded – undo
1698 1698
 			// call calendar-hook, if default-alarms are changed, to sync them to calendar prefs
1699 1699
 			if (class_exists('calendar_hooks'))
1700 1700
 			{
1701
-				foreach($need_save as $name)
1701
+				foreach ($need_save as $name)
1702 1702
 				{
1703 1703
 					list($name) = explode(':', $name);
1704 1704
 					if (in_array($name, array('default-alarm-vevent-date', 'default-alarm-vevent-datetime')))
@@ -1723,22 +1723,22 @@  discard block
 block discarded – undo
1723 1723
 		if (isset($options['stream']))
1724 1724
 		{
1725 1725
 			$options['content'] = '';
1726
-			while(!feof($options['stream']))
1726
+			while (!feof($options['stream']))
1727 1727
 			{
1728
-				$options['content'] .= fread($options['stream'],8192);
1728
+				$options['content'] .= fread($options['stream'], 8192);
1729 1729
 			}
1730 1730
 		}
1731 1731
 
1732 1732
 		if ($this->debug) error_log(__METHOD__.'('.array2string($options).')');
1733 1733
 
1734 1734
 		$id = $app = $user = $prefix = null;
1735
-		if (!$this->_parse_path($options['path'],$id,$app,$user,$prefix))
1735
+		if (!$this->_parse_path($options['path'], $id, $app, $user, $prefix))
1736 1736
 		{
1737 1737
 			return '404 Not Found';
1738 1738
 		}
1739 1739
 		if (($handler = self::app_handler($app)))
1740 1740
 		{
1741
-			$status = $handler->put($options,$id,$user,$prefix);
1741
+			$status = $handler->put($options, $id, $user, $prefix);
1742 1742
 
1743 1743
 			// set default stati: true --> 204 No Content, false --> should be already handled
1744 1744
 			if (is_bool($status)) $status = $status ? '204 No Content' : '400 Something went wrong';
@@ -1768,13 +1768,13 @@  discard block
 block discarded – undo
1768 1768
 		if ($this->debug) error_log(__METHOD__.'('.array2string($options).')');
1769 1769
 
1770 1770
 		$id = $app = $user = null;
1771
-		if (!$this->_parse_path($options['path'],$id,$app,$user))
1771
+		if (!$this->_parse_path($options['path'], $id, $app, $user))
1772 1772
 		{
1773 1773
 			return '404 Not Found';
1774 1774
 		}
1775 1775
 		if (($handler = self::app_handler($app)))
1776 1776
 		{
1777
-			$status = $handler->delete($options,$id,$user);
1777
+			$status = $handler->delete($options, $id, $user);
1778 1778
 			// set default stati: true --> 204 No Content, false --> should be already handled
1779 1779
 			if (is_bool($status)) $status = $status ? '204 No Content' : '400 Something went wrong';
1780 1780
 			return $status;
@@ -1814,7 +1814,7 @@  discard block
 block discarded – undo
1814 1814
 	 * @param  array  general parameter passing array
1815 1815
 	 * @return bool   true on success
1816 1816
 	 */
1817
-	function COPY($options, $del=false)
1817
+	function COPY($options, $del = false)
1818 1818
 	{
1819 1819
 		if ($this->debug) error_log('self::'.($del ? 'MOVE' : 'COPY').'('.array2string($options).')');
1820 1820
 
@@ -1830,8 +1830,8 @@  discard block
 block discarded – undo
1830 1830
 	function LOCK(&$options)
1831 1831
 	{
1832 1832
 		$id = $app = $user = null;
1833
-		self::_parse_path($options['path'],$id,$app,$user);
1834
-		$path = Vfs::app_entry_lock_path($app,$id);
1833
+		self::_parse_path($options['path'], $id, $app, $user);
1834
+		$path = Vfs::app_entry_lock_path($app, $id);
1835 1835
 
1836 1836
 		if ($this->debug) error_log(__METHOD__.'('.array2string($options).") path=$path");
1837 1837
 
@@ -1839,16 +1839,16 @@  discard block
 block discarded – undo
1839 1839
 		$handler = self::app_handler($app);
1840 1840
 
1841 1841
 		// TODO recursive locks on directories not supported yet
1842
-		if (!$id || !empty($options['depth']) || !$handler->check_access(Acl::EDIT,$id))
1842
+		if (!$id || !empty($options['depth']) || !$handler->check_access(Acl::EDIT, $id))
1843 1843
 		{
1844 1844
 			return '409 Conflict';
1845 1845
 		}
1846
-		$options['timeout'] = time()+300; // 5min. hardcoded
1846
+		$options['timeout'] = time() + 300; // 5min. hardcoded
1847 1847
 
1848 1848
 		// dont know why, but HTTP_WebDAV_Server passes the owner in D:href tags, which get's passed unchanged to checkLock/PROPFIND
1849 1849
 		// that's wrong according to the standard and cadaver does not show it on discover --> strip_tags removes eventual tags
1850
-		if (($ret = Vfs::lock($path,$options['locktoken'],$options['timeout'],strip_tags($options['owner']),
1851
-			$options['scope'],$options['type'],isset($options['update']),false)) && !isset($options['update']))		// false = no ACL check
1850
+		if (($ret = Vfs::lock($path, $options['locktoken'], $options['timeout'], strip_tags($options['owner']),
1851
+			$options['scope'], $options['type'], isset($options['update']), false)) && !isset($options['update']))		// false = no ACL check
1852 1852
 		{
1853 1853
 			return $ret ? '200 OK' : '409 Conflict';
1854 1854
 		}
@@ -1864,11 +1864,11 @@  discard block
 block discarded – undo
1864 1864
 	function UNLOCK(&$options)
1865 1865
 	{
1866 1866
 		$id = $app = $user = null;
1867
-		self::_parse_path($options['path'],$id,$app,$user);
1868
-		$path = Vfs::app_entry_lock_path($app,$id);
1867
+		self::_parse_path($options['path'], $id, $app, $user);
1868
+		$path = Vfs::app_entry_lock_path($app, $id);
1869 1869
 
1870 1870
 		if ($this->debug) error_log(__METHOD__.'('.array2string($options).") path=$path");
1871
-		return Vfs::unlock($path,$options['token']) ? '204 No Content' : '409 Conflict';
1871
+		return Vfs::unlock($path, $options['token']) ? '204 No Content' : '409 Conflict';
1872 1872
 	}
1873 1873
 
1874 1874
 	/**
@@ -1880,7 +1880,7 @@  discard block
 block discarded – undo
1880 1880
 	function checkLock($path)
1881 1881
 	{
1882 1882
 		$id = $app = $user = null;
1883
-		self::_parse_path($path,$id,$app,$user);
1883
+		self::_parse_path($path, $id, $app, $user);
1884 1884
 
1885 1885
 		return Vfs::checkLock(Vfs::app_entry_lock_path($app, $id));
1886 1886
 	}
@@ -1894,7 +1894,7 @@  discard block
 block discarded – undo
1894 1894
 	function ACL(&$options)
1895 1895
 	{
1896 1896
 		$id = $app = $user = null;
1897
-		self::_parse_path($options['path'],$id,$app,$user);
1897
+		self::_parse_path($options['path'], $id, $app, $user);
1898 1898
 
1899 1899
 		if ($this->debug) error_log(__METHOD__.'('.array2string($options).") path=$options[path]");
1900 1900
 
@@ -1924,7 +1924,7 @@  discard block
 block discarded – undo
1924 1924
 	 * @param string &$user_prefix =null
1925 1925
 	 * @return boolean true on success, false on error
1926 1926
 	 */
1927
-	function _parse_path($path,&$id,&$app,&$user,&$user_prefix=null)
1927
+	function _parse_path($path, &$id, &$app, &$user, &$user_prefix = null)
1928 1928
 	{
1929 1929
 		if ($this->debug)
1930 1930
 		{
@@ -1953,7 +1953,7 @@  discard block
 block discarded – undo
1953 1953
 			}
1954 1954
 		}
1955 1955
 		elseif (($account_id = $this->accounts->name2id($parts[0], 'account_lid')) ||
1956
-			($account_id = $this->accounts->name2id($parts[0]=urldecode($parts[0]))))
1956
+			($account_id = $this->accounts->name2id($parts[0] = urldecode($parts[0]))))
1957 1957
 		{
1958 1958
 			// /$user/$app/...
1959 1959
 			$user = array_shift($parts);
@@ -1977,7 +1977,7 @@  discard block
 block discarded – undo
1977 1977
 			{
1978 1978
 				$account_id = 0;
1979 1979
 			}
1980
-			elseif($app == 'resource' || $app == 'location')
1980
+			elseif ($app == 'resource' || $app == 'location')
1981 1981
 			{
1982 1982
 				if (!Principals::read_resource($res_id = (int)$username))
1983 1983
 				{
@@ -1987,7 +1987,7 @@  discard block
 block discarded – undo
1987 1987
 				$app = 'calendar';
1988 1988
 			}
1989 1989
 			elseif (!($account_id = $this->accounts->name2id($username, 'account_lid')) &&
1990
-					!($account_id = $this->accounts->name2id($username=urldecode($username))))
1990
+					!($account_id = $this->accounts->name2id($username = urldecode($username))))
1991 1991
 			{
1992 1992
 				return false;
1993 1993
 			}
@@ -2017,11 +2017,11 @@  discard block
 block discarded – undo
2017 2017
 		));
2018 2018
 
2019 2019
 		$ok = ($id || isset($_GET['add-member']) && $_SERVER['REQUEST_METHOD'] == 'POST') &&
2020
-			($user || $user === 0) && in_array($app,array('addressbook','calendar','infolog','principals'));
2020
+			($user || $user === 0) && in_array($app, array('addressbook', 'calendar', 'infolog', 'principals'));
2021 2021
 
2022 2022
 		if ($this->debug)
2023 2023
 		{
2024
-			error_log(__METHOD__."('$path') returning " . ($ok ? 'true' : 'false') . ": id='$id', app='$app', user='$user', user_prefix='$user_prefix'");
2024
+			error_log(__METHOD__."('$path') returning ".($ok ? 'true' : 'false').": id='$id', app='$app', user='$user', user_prefix='$user_prefix'");
2025 2025
 		}
2026 2026
 		return $ok;
2027 2027
 	}
@@ -2043,9 +2043,9 @@  discard block
 block discarded – undo
2043 2043
 	 *
2044 2044
      * @param  $prefix =null prefix filesystem path with given path, eg. "/webdav" for owncloud 4.5 remote.php
2045 2045
 	 */
2046
-	function ServeRequest($prefix=null)
2046
+	function ServeRequest($prefix = null)
2047 2047
 	{
2048
-		if ((self::$log_level=$GLOBALS['egw_info']['user']['preferences']['groupdav']['debug_level']) === 'r' ||
2048
+		if ((self::$log_level = $GLOBALS['egw_info']['user']['preferences']['groupdav']['debug_level']) === 'r' ||
2049 2049
 			self::$log_level === 'f' || $this->debug)
2050 2050
 		{
2051 2051
 			self::$request_starttime = microtime(true);
@@ -2076,7 +2076,7 @@  discard block
 block discarded – undo
2076 2076
 	 *
2077 2077
 	 * @param string $extra ='' extra text to add below request-log, eg. exception thrown
2078 2078
 	 */
2079
-	protected function log_request($extra='')
2079
+	protected function log_request($extra = '')
2080 2080
 	{
2081 2081
 		if (self::$request_starttime)
2082 2082
 		{
@@ -2103,13 +2103,13 @@  discard block
 block discarded – undo
2103 2103
 			}
2104 2104
 			$content .= $_SERVER['REQUEST_METHOD'].' '.$_SERVER['REQUEST_URI'].' HTTP/1.1'."\n";
2105 2105
 			// reconstruct headers
2106
-			foreach($_SERVER as $name => $value)
2106
+			foreach ($_SERVER as $name => $value)
2107 2107
 			{
2108
-				list($type,$name) = explode('_',$name,2);
2108
+				list($type, $name) = explode('_', $name, 2);
2109 2109
 				if ($type == 'HTTP' || $type == 'CONTENT')
2110 2110
 				{
2111
-					$content .= str_replace(' ','-',ucwords(strtolower(($type=='HTTP'?'':$type.' ').str_replace('_',' ',$name)))).
2112
-						': '.($name=='AUTHORIZATION'?'Basic ***************':$value)."\n";
2111
+					$content .= str_replace(' ', '-', ucwords(strtolower(($type == 'HTTP' ? '' : $type.' ').str_replace('_', ' ', $name)))).
2112
+						': '.($name == 'AUTHORIZATION' ? 'Basic ***************' : $value)."\n";
2113 2113
 				}
2114 2114
 			}
2115 2115
 			$content .= "\n";
@@ -2120,29 +2120,29 @@  discard block
 block discarded – undo
2120 2120
 			$content .= 'HTTP/1.1 '.$this->_http_status."\n";
2121 2121
 			$content .= 'Date: '.str_replace('+0000', 'GMT', gmdate('r'))."\n";
2122 2122
 			$content .= 'Server: '.$_SERVER['SERVER_SOFTWARE']."\n";
2123
-			foreach(headers_list() as $line)
2123
+			foreach (headers_list() as $line)
2124 2124
 			{
2125 2125
 				$content .= $line."\n";
2126 2126
 			}
2127 2127
 			if (($c = ob_get_flush())) $content .= "\n";
2128
-			if (self::$log_level !== 'f' && strlen($c) > 1536) $c = substr($c,0,1536)."\n*** LOG TRUNKATED\n";
2128
+			if (self::$log_level !== 'f' && strlen($c) > 1536) $c = substr($c, 0, 1536)."\n*** LOG TRUNKATED\n";
2129 2129
 			$content .= $c;
2130 2130
 			if ($extra) $content .= $extra;
2131 2131
 			if ($this->to_log) $content .= "\n### ".implode("\n### ", $this->to_log)."\n";
2132
-			$content .= $this->_http_status[0] == '4' && substr($this->_http_status,0,3) != '412' ||
2133
-				$this->_http_status[0] == '5' ? '###' : '***';	// mark failed requests with ###, instead of ***
2134
-			$content .= sprintf(' %s --> "%s" took %5.3f s',$_SERVER['REQUEST_METHOD'].($_SERVER['REQUEST_METHOD']=='REPORT'?' '.$this->propfind_options['root']['name']:'').' '.$_SERVER['PATH_INFO'],$this->_http_status,microtime(true)-self::$request_starttime)."\n\n";
2132
+			$content .= $this->_http_status[0] == '4' && substr($this->_http_status, 0, 3) != '412' ||
2133
+				$this->_http_status[0] == '5' ? '###' : '***'; // mark failed requests with ###, instead of ***
2134
+			$content .= sprintf(' %s --> "%s" took %5.3f s', $_SERVER['REQUEST_METHOD'].($_SERVER['REQUEST_METHOD'] == 'REPORT' ? ' '.$this->propfind_options['root']['name'] : '').' '.$_SERVER['PATH_INFO'], $this->_http_status, microtime(true) - self::$request_starttime)."\n\n";
2135 2135
 
2136
-			if ($msg_file && ($f = fopen($msg_file,'a')))
2136
+			if ($msg_file && ($f = fopen($msg_file, 'a')))
2137 2137
 			{
2138
-				flock($f,LOCK_EX);
2139
-				fwrite($f,$content);
2140
-				flock($f,LOCK_UN);
2138
+				flock($f, LOCK_EX);
2139
+				fwrite($f, $content);
2140
+				flock($f, LOCK_UN);
2141 2141
 				fclose($f);
2142 2142
 			}
2143 2143
 			else
2144 2144
 			{
2145
-				foreach(explode("\n",$content) as $line)
2145
+				foreach (explode("\n", $content) as $line)
2146 2146
 				{
2147 2147
 					error_log($line);
2148 2148
 				}
@@ -2156,7 +2156,7 @@  discard block
 block discarded – undo
2156 2156
 	 * @param string|array $xml_error string with name for empty element in DAV NS or array with props
2157 2157
 	 * @param string $human_readable =null human readable error message
2158 2158
 	 */
2159
-	public static function xml_error($xml_error, $human_readable=null)
2159
+	public static function xml_error($xml_error, $human_readable = null)
2160 2160
 	{
2161 2161
 		header('Content-type: application/xml; charset=utf-8');
2162 2162
 
@@ -2173,7 +2173,7 @@  discard block
 block discarded – undo
2173 2173
 			$xml->writeElement('responsedescription', $human_readable);
2174 2174
 		}
2175 2175
 
2176
-		$xml->endElement();	// DAV:error
2176
+		$xml->endElement(); // DAV:error
2177 2177
 		$xml->endDocument();
2178 2178
 		echo $xml->outputMemory();
2179 2179
 	}
@@ -2189,7 +2189,7 @@  discard block
 block discarded – undo
2189 2189
 		if (is_string($props)) $props = self::mkprop($props, '');
2190 2190
 		if (isset($props['name'])) $props = array($props);
2191 2191
 
2192
-		foreach($props as $prop)
2192
+		foreach ($props as $prop)
2193 2193
 		{
2194 2194
 			if (isset($prop['ns']) && $prop['ns'] !== 'DAV:')
2195 2195
 			{
@@ -2241,7 +2241,7 @@  discard block
 block discarded – undo
2241 2241
 	{
2242 2242
 		// logging exception as regular egw_execption_hander does
2243 2243
 		$headline = null;
2244
-		_egw_log_exception($e,$headline);
2244
+		_egw_log_exception($e, $headline);
2245 2245
 
2246 2246
 		// exception handler sending message back to the client as basic auth message
2247 2247
 		$error = str_replace(array("\r", "\n"), array('', ' | '), $e->getMessage());
@@ -2252,7 +2252,7 @@  discard block
 block discarded – undo
2252 2252
 		// if our own logging is active, log the request plus a trace, if enabled in server-config
2253 2253
 		if (self::$request_starttime && isset(self::$instance))
2254 2254
 		{
2255
-			self::$instance->_http_status = '401 Unauthorized';	// to correctly log it
2255
+			self::$instance->_http_status = '401 Unauthorized'; // to correctly log it
2256 2256
 			if ($GLOBALS['egw_info']['server']['exception_show_trace'])
2257 2257
 			{
2258 2258
 				self::$instance->log_request("\n".$e->getTraceAsString()."\n");
@@ -2274,7 +2274,7 @@  discard block
 block discarded – undo
2274 2274
 	 */
2275 2275
 	static function generate_uid($_appName, $_eventID)
2276 2276
 	{
2277
-		if(empty($_appName) || empty($_eventID)) return false;
2277
+		if (empty($_appName) || empty($_eventID)) return false;
2278 2278
 
2279 2279
 		return $_appName.'-'.$_eventID.'-'.$GLOBALS['egw_info']['server']['install_id'];
2280 2280
 	}
Please login to merge, or discard this patch.
resources/inc/class.resources_acl_ui.inc.php 3 patches
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -51,30 +51,30 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function index($content = array())
53 53
 	{
54
-		if (!$GLOBALS['egw']->acl->check('run',1,'admin'))
54
+		if (!$GLOBALS['egw']->acl->check('run', 1, 'admin'))
55 55
 		{
56 56
 			$this->deny();
57 57
 		}
58 58
 
59 59
 		$content['nm'] = array(
60
-			'get_rows'      =>	'resources.resources_acl_ui.get_rows',	// I  method/callback to request the data for the rows eg. 'notes.bo.get_rows'
60
+			'get_rows'      =>	'resources.resources_acl_ui.get_rows', // I  method/callback to request the data for the rows eg. 'notes.bo.get_rows'
61 61
 			'no_search'      => True,
62
-			'no_filter'      => True,        // I  disable the 1. filter
63
-			'no_filter2'     => True,        // I  disable the 2. filter (params are the same as for filter)
64
-			'no_cat'         => True,        // I  disable the cat-selectbox
65
-			'row_id'         => 'id',    // I  key into row content to set it's value as row-id, eg. 'id'
66
-			'parent_id'      =>	'parent',// I  key into row content of children linking them to their parent, also used as col_filter to query children
67
-			'dataStorePrefix'=> 'categories',// Avoid conflict with user list when in admin
68
-			'actions'        => self::get_actions(),    // I  array with actions, see nextmatch_widget::egw_actions
62
+			'no_filter'      => True, // I  disable the 1. filter
63
+			'no_filter2'     => True, // I  disable the 2. filter (params are the same as for filter)
64
+			'no_cat'         => True, // I  disable the cat-selectbox
65
+			'row_id'         => 'id', // I  key into row content to set it's value as row-id, eg. 'id'
66
+			'parent_id'      =>	'parent', // I  key into row content of children linking them to their parent, also used as col_filter to query children
67
+			'dataStorePrefix'=> 'categories', // Avoid conflict with user list when in admin
68
+			'actions'        => self::get_actions(), // I  array with actions, see nextmatch_widget::egw_actions
69 69
 			'placeholder_actions' => array('add')    //  I Array Optional list of actions allowed on the placeholder.  If not provided, it's ["add"].
70 70
 		);
71 71
 		$template = new Etemplate('resources.acl');
72
-		$GLOBALS['egw_info']['flags']['app_header'] = $GLOBALS['egw_info']['apps']['resources']['title'] . ' - ' . lang('Configure Access Permissions');
72
+		$GLOBALS['egw_info']['flags']['app_header'] = $GLOBALS['egw_info']['apps']['resources']['title'].' - '.lang('Configure Access Permissions');
73 73
 
74 74
 		$template->exec(__METHOD__, $content, $sel_options, $readonlys);
75 75
 	}
76 76
 	
77
-	protected static function get_actions($appname='resources') {
77
+	protected static function get_actions($appname = 'resources') {
78 78
 
79 79
 		$actions = array(
80 80
 			'open' => array(        // does edit if allowed, otherwise view
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 				'allowOnMultiple' => false,
84 84
 				'url' => 'menuaction=resources.resources_acl_ui.edit&cat_id=$id',
85 85
 				'popup' => '600x420',
86
-				'group' => $group=1,
86
+				'group' => $group = 1,
87 87
 			),
88 88
 			'add' => array(
89 89
 				'caption' => 'Add',
@@ -106,42 +106,42 @@  discard block
 block discarded – undo
106 106
 	 * @param array &$readonlys eg. to disable buttons based on Acl, not use here, maybe in a derived class
107 107
 	 * @return int total number of rows
108 108
 	 */
109
-	public function get_rows(&$query,&$rows,&$readonlys)
109
+	public function get_rows(&$query, &$rows, &$readonlys)
110 110
 	{
111 111
 
112
-		Api\Cache::setSession('resources','acl-nm',$query);
112
+		Api\Cache::setSession('resources', 'acl-nm', $query);
113 113
 
114
-		if($query['filter'] > 0 || $query['col_filter']['owner'])
114
+		if ($query['filter'] > 0 || $query['col_filter']['owner'])
115 115
 		{
116 116
 			$owner = $query['col_filter']['owner'] ? $query['col_filter']['owner'] : $query['filter'];
117 117
 		}
118 118
 
119
-		$cats = new Api\Categories($owner,'resources');
119
+		$cats = new Api\Categories($owner, 'resources');
120 120
 		$parent = $query['search'] ? false : 0;
121
-		$rows = $cats->return_sorted_array($query['start'],false,$query['search'],$query['sort'],$query['order'],'all_no_acl',$parent,true,$filter);
121
+		$rows = $cats->return_sorted_array($query['start'], false, $query['search'], $query['sort'], $query['order'], 'all_no_acl', $parent, true, $filter);
122 122
 		$count = $cats->total_records;
123 123
 
124 124
 
125 125
 		$config = Api\Config::read('resources');
126 126
 		$location_cats = $config['location_cats'] ? explode(',', $config['location_cats']) : array();
127 127
 
128
-		foreach($rows as $key => &$row)
128
+		foreach ($rows as $key => &$row)
129 129
 		{
130
-			$row['owner'] = explode(',',$row['owner']);
130
+			$row['owner'] = explode(',', $row['owner']);
131 131
 
132
-			$row['level_spacer'] = str_repeat('&nbsp; &nbsp; ',$row['level']);
132
+			$row['level_spacer'] = str_repeat('&nbsp; &nbsp; ', $row['level']);
133 133
 			$row['location'] = (in_array($row['id'], $location_cats));
134 134
 
135 135
 			if ($row['data']['icon'])
136 136
 			{
137
-				$row['icon_url'] = $GLOBALS['egw_info']['server']['webserver_url'].  resources_bo::ICON_PATH.'/'.$row['data']['icon'];
137
+				$row['icon_url'] = $GLOBALS['egw_info']['server']['webserver_url'].resources_bo::ICON_PATH.'/'.$row['data']['icon'];
138 138
 			}
139 139
 			
140 140
 			$row['subs'] = count($row['children']);
141 141
 
142 142
 			$row['class'] = 'level'.$row['level'];
143 143
 
144
-			foreach(self::$acl_map  as $field => $acl)
144
+			foreach (self::$acl_map  as $field => $acl)
145 145
 			{
146 146
 				$row[$field] = $GLOBALS['egw']->acl->get_ids_for_location('L'.$row['id'], $acl, 'resources');
147 147
 			}
@@ -158,9 +158,9 @@  discard block
 block discarded – undo
158 158
 	 * @param array $content = null
159 159
 	 * @param string $msg = ''
160 160
 	 */
161
-	public function edit(array $content=null,$msg='')
161
+	public function edit(array $content = null, $msg = '')
162 162
 	{
163
-		if (!$GLOBALS['egw']->acl->check('run',1,'admin'))
163
+		if (!$GLOBALS['egw']->acl->check('run', 1, 'admin'))
164 164
 		{
165 165
 			$this->deny();
166 166
 		}
@@ -178,34 +178,34 @@  discard block
 block discarded – undo
178 178
 		}
179 179
 		elseif ($content['button'])
180 180
 		{
181
-			$cats = new Categories($content['owner'] ? $content['owner'] : Categories::GLOBAL_ACCOUNT,'resources');
181
+			$cats = new Categories($content['owner'] ? $content['owner'] : Categories::GLOBAL_ACCOUNT, 'resources');
182 182
 
183 183
 			list($button) = each($content['button']);
184 184
 			unset($content['button']);
185 185
 
186 186
 			$refresh_app = 'admin';
187 187
 
188
-			switch($button)
188
+			switch ($button)
189 189
 			{
190 190
 				case 'save':
191 191
 				case 'apply':
192
-					if(is_array($content['owner'])) $content['owner'] = implode(',',$content['owner']);
193
-					if($content['owner'] == '') $content['owner'] = 0;
192
+					if (is_array($content['owner'])) $content['owner'] = implode(',', $content['owner']);
193
+					if ($content['owner'] == '') $content['owner'] = 0;
194 194
 					if ($content['id'])
195 195
 					{
196 196
 
197
-						$data = $cats->id2name($content['id'],'data');
197
+						$data = $cats->id2name($content['id'], 'data');
198 198
 						try {
199 199
 							$cats->edit($content);
200 200
 							resources_acl_bo::set_rights(
201 201
 								$content['id'], $content['read'], $content['write'], $content['calread'], $content['calwrite'], Array($content['admin'])
202 202
 							);
203
-							if($content['location'])
203
+							if ($content['location'])
204 204
 							{
205 205
 								$location_cats[] = $content['id'];
206 206
 								$location_cats = array_unique($location_cats);
207 207
 							}
208
-							else if(($key = array_search($content['id'], $location_cats)) !== false)
208
+							else if (($key = array_search($content['id'], $location_cats)) !== false)
209 209
 							{
210 210
 								unset($location_cats[$key]);
211 211
 							}
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 						}
215 215
 						catch (Api\Exception\WrongUserinput $e)
216 216
 						{
217
-							$msg = lang('Unwilling to save category with current settings. Check for inconsistency:').$e->getMessage();	// display conflicts etc.
217
+							$msg = lang('Unwilling to save category with current settings. Check for inconsistency:').$e->getMessage(); // display conflicts etc.
218 218
 						}
219 219
 					}
220 220
 					else
@@ -234,32 +234,32 @@  discard block
 block discarded – undo
234 234
 		}
235 235
 
236 236
 		$content['appname'] = 'resources';
237
-		if($content['data']['icon'])
237
+		if ($content['data']['icon'])
238 238
 		{
239
-			$content['icon_url'] = $content['base_url'] . $content['data']['icon'];
239
+			$content['icon_url'] = $content['base_url'].$content['data']['icon'];
240 240
 		}
241 241
 
242 242
 
243
-		foreach(self::$acl_map as $field => $acl)
243
+		foreach (self::$acl_map as $field => $acl)
244 244
 		{
245 245
 			$content[$field] = $GLOBALS['egw']->acl->get_ids_for_location('L'.$content['id'], $acl, 'resources');
246 246
 		}
247 247
 
248 248
 		// Make sure $content['admin'] is an array otherwise it wont show up values in the multiselectbox
249
-		if($content['admin'] == 0)
249
+		if ($content['admin'] == 0)
250 250
 		{
251 251
 			unset($content['admin']);
252 252
 		}
253 253
 		else if (!is_array($content['admin']))
254 254
 		{
255
-			$content['admin'] = explode(',',$content['admin']);
255
+			$content['admin'] = explode(',', $content['admin']);
256 256
 		}
257 257
 
258 258
 		// Location
259
-		$content['location'] = in_array($content['id'],$location_cats);
259
+		$content['location'] = in_array($content['id'], $location_cats);
260 260
 
261 261
 		$tmpl = new Etemplate('resources.acl_edit');
262
-		$tmpl->exec('resources.resources_acl_ui.edit',$content,$sel_options,$readonlys,$content,2);
262
+		$tmpl->exec('resources.resources_acl_ui.edit', $content, $sel_options, $readonlys, $content, 2);
263 263
 	}
264 264
 
265 265
 	function deny()
Please login to merge, or discard this patch.
Braces   +10 added lines, -3 removed lines patch added patch discarded remove patch
@@ -74,7 +74,8 @@  discard block
 block discarded – undo
74 74
 		$template->exec(__METHOD__, $content, $sel_options, $readonlys);
75 75
 	}
76 76
 	
77
-	protected static function get_actions($appname='resources') {
77
+	protected static function get_actions($appname='resources')
78
+	{
78 79
 
79 80
 		$actions = array(
80 81
 			'open' => array(        // does edit if allowed, otherwise view
@@ -189,8 +190,14 @@  discard block
 block discarded – undo
189 190
 			{
190 191
 				case 'save':
191 192
 				case 'apply':
192
-					if(is_array($content['owner'])) $content['owner'] = implode(',',$content['owner']);
193
-					if($content['owner'] == '') $content['owner'] = 0;
193
+					if(is_array($content['owner']))
194
+					{
195
+						$content['owner'] = implode(',',$content['owner']);
196
+					}
197
+					if($content['owner'] == '')
198
+					{
199
+						$content['owner'] = 0;
200
+					}
194 201
 					if ($content['id'])
195 202
 					{
196 203
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -198,7 +198,7 @@
 block discarded – undo
198 198
 						try {
199 199
 							$cats->edit($content);
200 200
 							resources_acl_bo::set_rights(
201
-								$content['id'], $content['read'], $content['write'], $content['calread'], $content['calwrite'], Array($content['admin'])
201
+								$content['id'], $content['read'], $content['write'], $content['calread'], $content['calwrite'], array($content['admin'])
202 202
 							);
203 203
 							if($content['location'])
204 204
 							{
Please login to merge, or discard this patch.
api/src/Db/Pdo.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@
 block discarded – undo
130 130
 	/**
131 131
 	 * Just a little abstration 'til I know how to organise stuff like that with PDO
132 132
 	 *
133
-	 * @param mixed $time
133
+	 * @param integer $time
134 134
 	 * @return string Y-m-d H:i:s
135 135
 	 */
136 136
 	static public function _pdo_timestamp($time)
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	{
73 73
 		$egw_db = isset($GLOBALS['egw_setup']) ? $GLOBALS['egw_setup']->db : $GLOBALS['egw']->db;
74 74
 
75
-		switch($egw_db->Type)
75
+		switch ($egw_db->Type)
76 76
 		{
77 77
 			case 'mysqli':
78 78
 			case 'mysqlt':
@@ -90,17 +90,17 @@  discard block
 block discarded – undo
90 90
 
91 91
 		$dsn = self::$pdo_type.':dbname='.$egw_db->Database.($host ? ';host='.$host.($egw_db->Port ? ';port='.$egw_db->Port : '') : '');
92 92
 		// check once if pdo extension and DB specific driver is loaded or can be loaded
93
-		static $pdo_available=null;
93
+		static $pdo_available = null;
94 94
 		if (is_null($pdo_available))
95 95
 		{
96
-			foreach(array('pdo','pdo_'.self::$pdo_type) as $ext)
96
+			foreach (array('pdo', 'pdo_'.self::$pdo_type) as $ext)
97 97
 			{
98
-				check_load_extension($ext,true);	// true = throw Exception
98
+				check_load_extension($ext, true); // true = throw Exception
99 99
 			}
100 100
 			$pdo_available = true;
101 101
 		}
102 102
 		// set client charset of the connection
103
-		switch(self::$pdo_type)
103
+		switch (self::$pdo_type)
104 104
 		{
105 105
 			case 'mysql':
106 106
 				$dsn .= ';charset=utf8';
@@ -110,15 +110,15 @@  discard block
 block discarded – undo
110 110
 				break;
111 111
 		}
112 112
 		try {
113
-			self::$pdo = new \PDO($dsn,$egw_db->User,$egw_db->Password,array(
113
+			self::$pdo = new \PDO($dsn, $egw_db->User, $egw_db->Password, array(
114 114
 				\PDO::ATTR_ERRMODE=>\PDO::ERRMODE_EXCEPTION,
115 115
 			));
116 116
 		}
117
-		catch(\PDOException $e)
117
+		catch (\PDOException $e)
118 118
 		{
119 119
 			unset($e);
120 120
 			// Exception reveals password, so we ignore the exception and connect again without pw, to get the right exception without pw
121
-			self::$pdo = new \PDO($dsn,$egw_db->User,'$egw_db->Password');
121
+			self::$pdo = new \PDO($dsn, $egw_db->User, '$egw_db->Password');
122 122
 		}
123 123
 		if ($query)
124 124
 		{
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	{
138 138
 		if (is_numeric($time))
139 139
 		{
140
-			$time = date('Y-m-d H:i:s',$time);
140
+			$time = date('Y-m-d H:i:s', $time);
141 141
 		}
142 142
 		return $time;
143 143
 	}
Please login to merge, or discard this patch.
api/src/Mail/hash_pbkdf2.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,15 +13,18 @@
 block discarded – undo
13 13
 		// Number of blocks needed to create the derived key
14 14
 		$blocks = ceil($length / strlen(hash($algorithm, null, true)));
15 15
 		$digest = '';
16
-		for ($i = 1; $i <= $blocks; ++$i) {
16
+		for ($i = 1; $i <= $blocks; ++$i)
17
+		{
17 18
 			$ib = $block = hash_hmac($algorithm, $salt.pack('N', $i), $password, true);
18 19
 			// Iterations
19
-			for ($j = 1; $j < $iterations; ++$j) {
20
+			for ($j = 1; $j < $iterations; ++$j)
21
+			{
20 22
 				$ib ^= ($block = hash_hmac($algorithm, $block, $password, true));
21 23
 			}
22 24
 			$digest .= $ib;
23 25
 		}
24
-		if (!$rawOutput) {
26
+		if (!$rawOutput)
27
+		{
25 28
 			$digest = bin2hex($digest);
26 29
 		}
27 30
 		return substr($digest, 0, $length);
Please login to merge, or discard this patch.
api/src/Preferences.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -961,7 +961,7 @@
 block discarded – undo
961 961
 	 *
962 962
 	 * This method uses the language and nationalty set in the users common prefs.
963 963
 	 *
964
-	 * @param $category =LC_MESSAGES category to set, see setlocal function
964
+	 * @param integer $category =LC_MESSAGES category to set, see setlocal function
965 965
 	 * @param $charset =null default system charset
966 966
 	 * @return string the local (or best estimate) set
967 967
 	 */
Please login to merge, or discard this patch.
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	const TABLE = 'egw_preferences';
96 96
 	var $table = self::TABLE;
97 97
 
98
-	var $values,$vars;	// standard notify substitues, will be set by standard_substitues()
98
+	var $values, $vars; // standard notify substitues, will be set by standard_substitues()
99 99
 
100 100
 	/**
101 101
 	 * Contstructor
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 			case self::FORCED_ID:
164 164
 				return 'forced';
165 165
 		}
166
-		return $this->account_id < self::DEFAULT_ID ? $this->account_id-self::DEFAULT_ID : $this->account_id;
166
+		return $this->account_id < self::DEFAULT_ID ? $this->account_id - self::DEFAULT_ID : $this->account_id;
167 167
 	}
168 168
 
169 169
 	/**
@@ -193,21 +193,21 @@  discard block
 block discarded – undo
193 193
 	{
194 194
 		$prefs = Cache::getInstance(__CLASS__, $ids);
195 195
 		$db_read = array();
196
-		foreach((array)$ids as $id)
196
+		foreach ((array)$ids as $id)
197 197
 		{
198 198
 			// if prefs are not returned, null or not an array, read them from db
199 199
 			if (!isset($prefs[$id]) && !is_array($prefs[$id])) $db_read[] = $id;
200 200
 		}
201 201
 		if ($db_read)
202 202
 		{
203
-			foreach($this->db->select($this->table,'*',array('preference_owner' => $db_read),__LINE__,__FILE__) as $row)
203
+			foreach ($this->db->select($this->table, '*', array('preference_owner' => $db_read), __LINE__, __FILE__) as $row)
204 204
 			{
205 205
 				// The following replacement is required for PostgreSQL to work
206 206
 				$app = trim($row['preference_app']);
207 207
 
208 208
 				$prefs[$row['preference_owner']][$app] = self::unserialize($row['preference_value']);
209 209
 			}
210
-			foreach($db_read as $id)
210
+			foreach ($db_read as $id)
211 211
 			{
212 212
 				if (!isset($prefs[$id])) $prefs[$id] = array();
213 213
 				Cache::setInstance(__CLASS__, $id, $prefs[$id]);
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	 * @param boolean $use_standard_values =true should the standard values are used
227 227
 	 * @return string with parsed notify-msg
228 228
 	 */
229
-	function parse_notify($msg,$values=array(),$use_standard_values=True)
229
+	function parse_notify($msg, $values = array(), $use_standard_values = True)
230 230
 	{
231 231
 		$vals = $values ? $values : array();
232 232
 
@@ -235,13 +235,13 @@  discard block
 block discarded – undo
235 235
 			$vals += $this->values;
236 236
 		}
237 237
 		$replace = $with = array();
238
-		foreach($vals as $key => $val)
238
+		foreach ($vals as $key => $val)
239 239
 		{
240 240
 			if ($this->debug) error_log(__METHOD__." replacing \$\$$key\$\$ with $val  ");
241 241
 			$replace[] = '$$'.$key.'$$';
242 242
 			$with[]    = $val;
243 243
 		}
244
-		return str_replace($replace,$with,$msg);
244
+		return str_replace($replace, $with, $msg);
245 245
 	}
246 246
 
247 247
 	/**
@@ -253,9 +253,9 @@  discard block
 block discarded – undo
253 253
 	 * @param boolean $un_lang =false if true translate back
254 254
 	 * @return string
255 255
 	 */
256
-	function lang_notify($msg,$vals=array(),$un_lang=False)
256
+	function lang_notify($msg, $vals = array(), $un_lang = False)
257 257
 	{
258
-		foreach(array_keys($vals) as $key)
258
+		foreach (array_keys($vals) as $key)
259 259
 		{
260 260
 			$lname = ($lname = lang($key)) == $key.'*' ? $key : $lname;
261 261
 			if ($un_lang)
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 				$langs[$key] = '$$'.$lname.'$$';
268 268
 			}
269 269
 		}
270
-		return $this->parse_notify($msg,$langs,False);
270
+		return $this->parse_notify($msg, $langs, False);
271 271
 	}
272 272
 
273 273
 	/**
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 		if ($this->debug) error_log(__METHOD__." is called ");
279 279
 		if (!is_array(@$GLOBALS['egw_info']['user']['preferences']))
280 280
 		{
281
-			$GLOBALS['egw_info']['user']['preferences'] = $this->data;	// else no lang()
281
+			$GLOBALS['egw_info']['user']['preferences'] = $this->data; // else no lang()
282 282
 		}
283 283
 		// we cant use egw_info/user/fullname, as it's not set when we run
284 284
 		$this->values = array(	// standard notify replacements
@@ -287,37 +287,37 @@  discard block
 block discarded – undo
287 287
 			'lastname'  => Accounts::id2name($this->account_id, 'account_lastname'),
288 288
 			'domain'    => $GLOBALS['egw_info']['server']['mail_suffix'],
289 289
 			'email'     => $this->email_address($this->account_id),
290
-			'date'      => DateTime::to('now',$GLOBALS['egw_info']['user']['preferences']['common']['dateformat']),
290
+			'date'      => DateTime::to('now', $GLOBALS['egw_info']['user']['preferences']['common']['dateformat']),
291 291
 		);
292 292
 		// do this first, as it might be already contain some substitues
293 293
 		//
294 294
 		$this->values['email'] = $this->parse_notify($this->values['email']);
295 295
 
296 296
 		$this->vars = array(	// langs have to be in common !!!
297
-			'fullname'  => lang('name of the user, eg. "%1"',$this->values['fullname']),
298
-			'firstname' => lang('first name of the user, eg. "%1"',$this->values['firstname']),
299
-			'lastname'  => lang('last name of the user, eg. "%1"',$this->values['lastname']),
300
-			'domain'    => lang('domain name for mail-address, eg. "%1"',$this->values['domain']),
301
-			'email'     => lang('email-address of the user, eg. "%1"',$this->values['email']),
302
-			'date'      => lang('todays date, eg. "%1"',$this->values['date']),
297
+			'fullname'  => lang('name of the user, eg. "%1"', $this->values['fullname']),
298
+			'firstname' => lang('first name of the user, eg. "%1"', $this->values['firstname']),
299
+			'lastname'  => lang('last name of the user, eg. "%1"', $this->values['lastname']),
300
+			'domain'    => lang('domain name for mail-address, eg. "%1"', $this->values['domain']),
301
+			'email'     => lang('email-address of the user, eg. "%1"', $this->values['email']),
302
+			'date'      => lang('todays date, eg. "%1"', $this->values['date']),
303 303
 		);
304
-		if ($this->debug) error_log(__METHOD__.print_r($this->vars,true));
304
+		if ($this->debug) error_log(__METHOD__.print_r($this->vars, true));
305 305
 		// do the substituetion in the effective prefs (data)
306 306
 		//
307
-		foreach($this->data as $app => $data)
307
+		foreach ($this->data as $app => $data)
308 308
 		{
309
-			if(!is_array($data)) continue;
310
-			foreach($data as $key => $val)
309
+			if (!is_array($data)) continue;
310
+			foreach ($data as $key => $val)
311 311
 			{
312
-				if (!is_array($val) && strpos($val,'$$') !== False)
312
+				if (!is_array($val) && strpos($val, '$$') !== False)
313 313
 				{
314 314
 					$this->data[$app][$key] = $this->parse_notify($val);
315 315
 				}
316 316
 				elseif (is_array($val))
317 317
 				{
318
-					foreach($val as $k => $v)
318
+					foreach ($val as $k => $v)
319 319
 					{
320
-						if (!is_array($v) && strpos($v,'$$') !== False)
320
+						if (!is_array($v) && strpos($v, '$$') !== False)
321 321
 						{
322 322
 							$this->data[$app][$key][$k] = $this->parse_notify($v);
323 323
 						}
@@ -342,12 +342,12 @@  discard block
 block discarded – undo
342 342
 		}
343 343
 		// handling of old PHP serialized and addslashed prefs
344 344
 		$data = php_safe_unserialize($str);
345
-		if($data === false)
345
+		if ($data === false)
346 346
 		{
347 347
 			// manually retrieve the string lengths of the serialized array if unserialize failed
348 348
 			$data = php_safe_unserialize(preg_replace_callback('!s:(\d+):"(.*?)";!s', function($matches)
349 349
 			{
350
-				return 's:'.mb_strlen($matches[2],'8bit').':"'.$matches[2].'";';
350
+				return 's:'.mb_strlen($matches[2], '8bit').':"'.$matches[2].'";';
351 351
 			}, $str));
352 352
 		}
353 353
 		self::unquote($data);
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 			$arr = stripslashes($arr);
367 367
 			return;
368 368
 		}
369
-		foreach($arr as $key => $value)
369
+		foreach ($arr as $key => $value)
370 370
 		{
371 371
 			if (is_array($value))
372 372
 			{
@@ -387,27 +387,27 @@  discard block
 block discarded – undo
387 387
 	 * @param boolean $use_session =true should the session prefs get used (default true) or not (false)
388 388
 	 * @return array with effective prefs ($this->data)
389 389
 	 */
390
-	function read_repository($use_session=true)
390
+	function read_repository($use_session = true)
391 391
 	{
392
-		$this->session = $use_session ? Cache::getSession('preferences','preferences') : array();
392
+		$this->session = $use_session ? Cache::getSession('preferences', 'preferences') : array();
393 393
 		if (!is_array($this->session))
394 394
 		{
395 395
 			$this->session = array();
396 396
 		}
397 397
 		$this->forced = $this->default = $this->user = $this->group = array();
398
-		$to_read = array(self::DEFAULT_ID,self::FORCED_ID,$this->account_id);
398
+		$to_read = array(self::DEFAULT_ID, self::FORCED_ID, $this->account_id);
399 399
 		if ($this->account_id > 0)
400 400
 		{
401 401
 			$primary_group = Accounts::id2name($this->account_id, 'account_primary_group');
402
-			foreach((array)$GLOBALS['egw']->accounts->memberships($this->account_id, true) as $gid)
402
+			foreach ((array)$GLOBALS['egw']->accounts->memberships($this->account_id, true) as $gid)
403 403
 			{
404
-				if ($gid != $primary_group) $to_read[] = $gid + self::DEFAULT_ID;	// need to offset it with DEFAULT_ID = -2!
404
+				if ($gid != $primary_group) $to_read[] = $gid + self::DEFAULT_ID; // need to offset it with DEFAULT_ID = -2!
405 405
 			}
406 406
 			$to_read[] = $primary_group + self::DEFAULT_ID;
407 407
 		}
408
-		foreach($this->cache_read($to_read) as $id => $values)
408
+		foreach ($this->cache_read($to_read) as $id => $values)
409 409
 		{
410
-			switch($id)
410
+			switch ($id)
411 411
 			{
412 412
 				case self::FORCED_ID:
413 413
 					$this->forced = $values;
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 					$this->user = $values;
420 420
 					break;
421 421
 				default:
422
-					foreach($values as $app => $vals)
422
+					foreach ($values as $app => $vals)
423 423
 					{
424 424
 						$this->group[$app] = (array)$vals + (array)$this->group[$app];
425 425
 					}
@@ -430,9 +430,9 @@  discard block
 block discarded – undo
430 430
 
431 431
 		// let the (temp.) session prefs. override the user prefs.
432 432
 		//
433
-		foreach($this->session as $app => $values)
433
+		foreach ($this->session as $app => $values)
434 434
 		{
435
-			foreach($values as $var => $value)
435
+			foreach ($values as $var => $value)
436 436
 			{
437 437
 				$this->data[$app][$var] = $value;
438 438
 			}
@@ -440,9 +440,9 @@  discard block
 block discarded – undo
440 440
 
441 441
 		// now use (primary) group defaults if needed (user-value unset or empty)
442 442
 		//
443
-		foreach((array)$this->group as $app => $values)
443
+		foreach ((array)$this->group as $app => $values)
444 444
 		{
445
-			foreach((array)$values as $var => $value)
445
+			foreach ((array)$values as $var => $value)
446 446
 			{
447 447
 				if (!isset($this->data[$app][$var]) || $this->data[$app][$var] === '')
448 448
 				{
@@ -452,9 +452,9 @@  discard block
 block discarded – undo
452 452
 		}
453 453
 		// now use defaults if needed (user-value unset or empty)
454 454
 		//
455
-		foreach((array)$this->default as $app => $values)
455
+		foreach ((array)$this->default as $app => $values)
456 456
 		{
457
-			foreach((array)$values as $var => $value)
457
+			foreach ((array)$values as $var => $value)
458 458
 			{
459 459
 				if (!isset($this->data[$app][$var]) || $this->data[$app][$var] === '')
460 460
 				{
@@ -465,9 +465,9 @@  discard block
 block discarded – undo
465 465
 		}
466 466
 		// now set/force forced values
467 467
 		//
468
-		foreach((array)$this->forced as $app => $values)
468
+		foreach ((array)$this->forced as $app => $values)
469 469
 		{
470
-			foreach((array)$values as $var => $value)
470
+			foreach ((array)$values as $var => $value)
471 471
 			{
472 472
 				$this->data[$app][$var] = $value;
473 473
 			}
@@ -483,12 +483,12 @@  discard block
 block discarded – undo
483 483
 		{
484 484
 			reset($this->data);
485 485
 		}
486
-		if (isset($this->debug) && substr($GLOBALS['egw_info']['flags']['currentapp'],0,3) != 'log')
486
+		if (isset($this->debug) && substr($GLOBALS['egw_info']['flags']['currentapp'], 0, 3) != 'log')
487 487
 		{
488
-			echo 'user<pre>';     print_r($this->user); echo "</pre>\n";
489
-			echo 'forced<pre>';   print_r($this->forced); echo "</pre>\n";
490
-			echo 'default<pre>';  print_r($this->default); echo "</pre>\n";
491
-			echo 'group<pre>';    print_r($this->group); echo "</pre>\n";
488
+			echo 'user<pre>'; print_r($this->user); echo "</pre>\n";
489
+			echo 'forced<pre>'; print_r($this->forced); echo "</pre>\n";
490
+			echo 'default<pre>'; print_r($this->default); echo "</pre>\n";
491
+			echo 'group<pre>'; print_r($this->group); echo "</pre>\n";
492 492
 			echo 'effectiv<pre>'; print_r($this->data); echo "</pre>\n";
493 493
 		}
494 494
 		$this->check_set_tz_offset();
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 	 * @param string $name =null
504 504
 	 * @return mixed
505 505
 	 */
506
-	function default_prefs($app=null,$name=null)
506
+	function default_prefs($app = null, $name = null)
507 507
 	{
508 508
 		// Etemplate::complete_array_merge() is identical to PHP >= 5.3 array_replace_recursive()
509 509
 		$default = Etemplate::complete_array_merge($this->default, $this->forced);
@@ -521,13 +521,13 @@  discard block
 block discarded – undo
521 521
 	 */
522 522
 	function check_set_tz_offset()
523 523
 	{
524
-		$prefs =& $this->data['common'];
524
+		$prefs = & $this->data['common'];
525 525
 
526 526
 		if (!empty($prefs['tz']))
527 527
 		{
528
-			DateTime::setUserPrefs($prefs['tz'],$prefs['dateformat'],$prefs['timeformat']);
528
+			DateTime::setUserPrefs($prefs['tz'], $prefs['dateformat'], $prefs['timeformat']);
529 529
 			// set the old preference for compatibilty with old code
530
-			$prefs['tz_offset'] = DateTime::tz_offset_s()/3600;
530
+			$prefs['tz_offset'] = DateTime::tz_offset_s() / 3600;
531 531
 		}
532 532
 	}
533 533
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 		{
552 552
 			$this->read_repository();
553 553
 		}
554
-		reset ($this->data);
554
+		reset($this->data);
555 555
 		return $this->data;
556 556
 	}
557 557
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 	 * @param string $type ='user' of preference to set: forced, default, user
567 567
 	 * @return array with new effective prefs (even when forced or default prefs are set !)
568 568
 	 */
569
-	function add($app_name,$var,$value = '##undef##',$type='user')
569
+	function add($app_name, $var, $value = '##undef##', $type = 'user')
570 570
 	{
571 571
 		//echo "<p>add('$app_name','$var','$value')</p>\n";
572 572
 		if ($value === '##undef##')
@@ -580,10 +580,10 @@  discard block
 block discarded – undo
580 580
 				if (!isset($this->forced[$app_name][$var]) || $this->forced[$app_name][$var] === '')
581 581
 				{
582 582
 					$this->session[$app_name][$var] = $this->data[$app_name][$var] = $value;
583
-					Cache::setSession('preferences','preferences',$this->session);
584
-					if (method_exists($GLOBALS['egw'],'invalidate_session_cache'))	// egw object in setup is limited
583
+					Cache::setSession('preferences', 'preferences', $this->session);
584
+					if (method_exists($GLOBALS['egw'], 'invalidate_session_cache'))	// egw object in setup is limited
585 585
 					{
586
-						$GLOBALS['egw']->invalidate_session_cache();	// in case with cache the egw_info array in the session
586
+						$GLOBALS['egw']->invalidate_session_cache(); // in case with cache the egw_info array in the session
587 587
 					}
588 588
 				}
589 589
 				break;
@@ -624,13 +624,13 @@  discard block
 block discarded – undo
624 624
 	 * @param string $type ='user' of preference to set: forced, default, user
625 625
 	 * @return array with new effective prefs (even when forced or default prefs are deleted!)
626 626
 	 */
627
-	function delete($app_name, $var = False,$type = 'user')
627
+	function delete($app_name, $var = False, $type = 'user')
628 628
 	{
629 629
 		//echo "<p>delete('$app_name','$var','$type')</p>\n";
630 630
 		$set_via = array(
631
-			'forced'  => array('user','default'),
632
-			'default' => array('forced','user'),
633
-			'user'    => array('forced','group','default'),
631
+			'forced'  => array('user', 'default'),
632
+			'default' => array('forced', 'user'),
633
+			'user'    => array('forced', 'group', 'default'),
634 634
 			'group'   => array('forced'),
635 635
 		);
636 636
 		if (!isset($set_via[$type]))
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 			}
665 665
 			else
666 666
 			{
667
-				if($var && @isset($arr[$app_name][$var]) && $arr[$app_name][$var] !== '')
667
+				if ($var && @isset($arr[$app_name][$var]) && $arr[$app_name][$var] !== '')
668 668
 				{
669 669
 					$this->data[$app_name][$var] = $arr[$app_name][$var];
670 670
 					break;
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 			}
673 673
 			unset($arr);
674 674
 		}
675
-		reset ($this->data);
675
+		reset($this->data);
676 676
 		return $this->data;
677 677
 	}
678 678
 
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 	{
686 686
 		if ($accountid > 0)
687 687
 		{
688
-			$this->db->delete($this->table,array('preference_owner' => $accountid),__LINE__,__FILE__);
688
+			$this->db->delete($this->table, array('preference_owner' => $accountid), __LINE__, __FILE__);
689 689
 
690 690
 			Cache::unsetInstance(__CLASS__, $accountid);
691 691
 		}
@@ -700,9 +700,9 @@  discard block
 block discarded – undo
700 700
 	{
701 701
 		if ($accountid < 0)
702 702
 		{
703
-			$this->db->delete($this->table,array('preference_owner' => $accountid+self::DEFAULT_ID),__LINE__,__FILE__);
703
+			$this->db->delete($this->table, array('preference_owner' => $accountid + self::DEFAULT_ID), __LINE__, __FILE__);
704 704
 
705
-			Cache::unsetInstance(__CLASS__, $accountid+self::DEFAULT_ID);
705
+			Cache::unsetInstance(__CLASS__, $accountid + self::DEFAULT_ID);
706 706
 		}
707 707
 	}
708 708
 
@@ -715,14 +715,14 @@  discard block
 block discarded – undo
715 715
 	 * @param string $old_value if given, only change if that's current value
716 716
 	 * @param string $type if given limit to "user", "forced", "default", "group"
717 717
 	 */
718
-	public static function change_preference($app, $name, $value, $old_value=null, $type=null)
718
+	public static function change_preference($app, $name, $value, $old_value = null, $type = null)
719 719
 	{
720 720
 		$db = isset($GLOBALS['egw_setup']->db) ? $GLOBALS['egw_setup']->db : $GLOBALS['egw']->db;
721 721
 
722 722
 		$where = array();
723 723
 		if ($app) $where['preference_app'] = $app;
724 724
 
725
-		switch($type)
725
+		switch ($type)
726 726
 		{
727 727
 			case 'forced':
728 728
 				$where['preference_owner'] = self::FORCED_ID;
@@ -737,10 +737,10 @@  discard block
 block discarded – undo
737 737
 				$where[] = 'preference_owner < '.self::DEFAULT_ID;
738 738
 				break;
739 739
 		}
740
-		foreach($db->select(self::TABLE, '*', $where, __LINE__, __FILE__) as $row)
740
+		foreach ($db->select(self::TABLE, '*', $where, __LINE__, __FILE__) as $row)
741 741
 		{
742 742
 			$prefs = self::unserialize($row['preference_value']);
743
-			if (!is_array($prefs)) $prefs = array();	// would stall update otherwise
743
+			if (!is_array($prefs)) $prefs = array(); // would stall update otherwise
744 744
 
745 745
 			if ($name[0] == '/' && substr($name, -1) == '/')
746 746
 			{
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
 			}
756 756
 
757 757
 			$updated = false;
758
-			foreach($attrs as $attr)
758
+			foreach ($attrs as $attr)
759 759
 			{
760 760
 				if (isset($old_value) && $prefs[$attr] != $old_value) continue;
761 761
 
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
 
785 785
 				// update instance-wide cache
786 786
 				$cached = Cache::getInstance(__CLASS__, $row['preference_owner']);
787
-				if($cached && $cached[$row['preference_app']])
787
+				if ($cached && $cached[$row['preference_app']])
788 788
 				{
789 789
 					$cached[$row['preference_app']] = $prefs;
790 790
 					Cache::setInstance(__CLASS__, $row['preference_owner'], $cached);
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 	 * @param string $name Preference name
801 801
 	 * @param string $type ='user' of preference to set: forced, default, user
802 802
 	 */
803
-	public static function delete_preference($app, $name, $type='user')
803
+	public static function delete_preference($app, $name, $type = 'user')
804 804
 	{
805 805
 		self::change_preference($app, $name, null, null, $type);
806 806
 	}
@@ -812,12 +812,12 @@  discard block
 block discarded – undo
812 812
 	 * @param string $to_app
813 813
 	 * @param array $names =null array of names to copy or null for all
814 814
 	 */
815
-	public static function copy_preferences($from_app, $to_app, array $names=null)
815
+	public static function copy_preferences($from_app, $to_app, array $names = null)
816 816
 	{
817 817
 		//error_log(__METHOD__."('$from_app', '$to_app', ".array2string($names).')');
818 818
 		$db = isset($GLOBALS['egw_setup']->db) ? $GLOBALS['egw_setup']->db : $GLOBALS['egw']->db;
819 819
 
820
-		foreach($db->select(self::TABLE, '*', array('preference_app' => $from_app), __LINE__, __FILE__) as $row)
820
+		foreach ($db->select(self::TABLE, '*', array('preference_app' => $from_app), __LINE__, __FILE__) as $row)
821 821
 		{
822 822
 			$prefs = self::unserialize($row['preference_value']);
823 823
 
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
 			{
826 826
 				$prefs = array_intersect_key($prefs, array_flip($names));
827 827
 			}
828
-			if (!$prefs) continue;	// nothing to change, as nothing set
828
+			if (!$prefs) continue; // nothing to change, as nothing set
829 829
 
830 830
 			$row['preference_app'] = $to_app;
831 831
 			unset($row['preference_value']);
@@ -859,11 +859,11 @@  discard block
 block discarded – undo
859 859
 	 * @param boolean $invalid_cache =true should we invalidate the cache, default true (not used anymore)
860 860
 	 * @return array with new effective prefs (even when forced or default prefs are deleted!)
861 861
 	 */
862
-	function save_repository($update_session_info = False,$type='user',$invalid_cache=true)
862
+	function save_repository($update_session_info = False, $type = 'user', $invalid_cache = true)
863 863
 	{
864
-		unset($update_session_info, $invalid_cache);	// no longer used
864
+		unset($update_session_info, $invalid_cache); // no longer used
865 865
 
866
-		switch($type)
866
+		switch ($type)
867 867
 		{
868 868
 			case 'forced':
869 869
 				$account_id = self::FORCED_ID;
@@ -878,17 +878,17 @@  discard block
 block discarded – undo
878 878
 
879 879
 			default:
880 880
 				$account_id = (int)$this->account_id;
881
-				$prefs = &$this->user;	// we use the user-array as data contains default values too
881
+				$prefs = &$this->user; // we use the user-array as data contains default values too
882 882
 				break;
883 883
 		}
884 884
 		//echo "<p>preferences::save_repository(,$type): account_id=$account_id, prefs="; print_r($prefs); echo "</p>\n";
885 885
 
886
-		if (isset($GLOBALS['egw_setup']) || !$GLOBALS['egw']->acl->check('session_only_preferences',1,'preferences') &&
886
+		if (isset($GLOBALS['egw_setup']) || !$GLOBALS['egw']->acl->check('session_only_preferences', 1, 'preferences') &&
887 887
 			(!($old_prefs = $this->cache_read($account_id)) || $old_prefs != $prefs))
888 888
 		{
889 889
 			//error_log(__METHOD__."(type=$type) saved, because old_prefs[$account_id] != prefs=".array2string($prefs));
890 890
 			$changed = 0;
891
-			foreach($prefs as $app => $value)
891
+			foreach ($prefs as $app => $value)
892 892
 			{
893 893
 				// check if app preferences have changed, if not no need to save them
894 894
 				if ($old_prefs && $old_prefs[$app] == $value) continue;
@@ -905,12 +905,12 @@  discard block
 block discarded – undo
905 905
 				}
906 906
 				else
907 907
 				{
908
-					$this->db->insert($this->table,array(
908
+					$this->db->insert($this->table, array(
909 909
 						'preference_value' => json_encode($value),
910
-					),array(
910
+					), array(
911 911
 						'preference_owner' => $account_id,
912 912
 						'preference_app'   => $app,
913
-					),__LINE__,__FILE__);
913
+					), __LINE__, __FILE__);
914 914
 				}
915 915
 			}
916 916
 			if ($changed)
@@ -937,21 +937,21 @@  discard block
 block discarded – undo
937 937
 	 * @param int $account_id as determined in and/or passed to "create_email_preferences"
938 938
 	 * @return string with email-address
939 939
 	 */
940
-	function email_address($account_id='')
940
+	function email_address($account_id = '')
941 941
 	{
942 942
 		if (isset($this->data['email']['address']))
943 943
 		{
944 944
 			return $this->data['email']['address'];
945 945
 		}
946 946
 		// if email-address is set in the account, return it
947
-		if (($email = Accounts::id2name($account_id,'account_email')))
947
+		if (($email = Accounts::id2name($account_id, 'account_email')))
948 948
 		{
949 949
 			return $email;
950 950
 		}
951 951
 		$prefs_email_address = Accounts::id2name($account_id);
952
-		if ($prefs_email_address && strpos($prefs_email_address,'@') === False)
952
+		if ($prefs_email_address && strpos($prefs_email_address, '@') === False)
953 953
 		{
954
-			$prefs_email_address .= '@' . $GLOBALS['egw_info']['server']['mail_suffix'];
954
+			$prefs_email_address .= '@'.$GLOBALS['egw_info']['server']['mail_suffix'];
955 955
 		}
956 956
 		return $prefs_email_address;
957 957
 	}
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
 	 * @param $charset =null default system charset
966 966
 	 * @return string the local (or best estimate) set
967 967
 	 */
968
-	static function setlocale($category=LC_MESSAGES,$charset=null)
968
+	static function setlocale($category = LC_MESSAGES, $charset = null)
969 969
 	{
970 970
 		$lang = $GLOBALS['egw_info']['user']['preferences']['common']['lang'];
971 971
 		$country = $GLOBALS['egw_info']['user']['preferences']['common']['country'];
@@ -976,12 +976,12 @@  discard block
 block discarded – undo
976 976
 		}
977 977
 		else
978 978
 		{
979
-			list($lang,$lang2) = explode('-',$lang);
979
+			list($lang, $lang2) = explode('-', $lang);
980 980
 			$country_from_lang = strtoupper($lang2);
981 981
 		}
982 982
 		if (is_null($charset)) $charset = Translation::charset();
983 983
 
984
-		foreach(array(
984
+		foreach (array(
985 985
 			$lang.'_'.$country,
986 986
 			$lang.'_'.$country_from_lang,
987 987
 			$lang.'_'.$country.'.utf8',
@@ -991,15 +991,15 @@  discard block
 block discarded – undo
991 991
 			'C',
992 992
 		) as $local)
993 993
 		{
994
-			if (($ret = setlocale($category,$local.'.'.$charset)) ||
995
-				($ret = setlocale($category,$local.'@'.$charset)) ||
996
-				($ret = setlocale($category,$local)))
994
+			if (($ret = setlocale($category, $local.'.'.$charset)) ||
995
+				($ret = setlocale($category, $local.'@'.$charset)) ||
996
+				($ret = setlocale($category, $local)))
997 997
 			{
998 998
 				//error_log(__METHOD__."($category,$charset) lang=$lang, country=$country, country_from_lang=$country_from_lang: returning '$ret'");
999 999
 				return $ret;
1000 1000
 			}
1001 1001
 		}
1002 1002
 		error_log(__METHOD__."($category,$charset) lang=$lang, country=$country, country_from_lang=$country_from_lang: Could not set local!");
1003
-		return false;	// should not happen, as the 'C' local should at least be available everywhere
1003
+		return false; // should not happen, as the 'C' local should at least be available everywhere
1004 1004
 	}
1005 1005
 }
Please login to merge, or discard this patch.
Braces   +81 added lines, -20 removed lines patch added patch discarded remove patch
@@ -196,7 +196,10 @@  discard block
 block discarded – undo
196 196
 		foreach((array)$ids as $id)
197 197
 		{
198 198
 			// if prefs are not returned, null or not an array, read them from db
199
-			if (!isset($prefs[$id]) && !is_array($prefs[$id])) $db_read[] = $id;
199
+			if (!isset($prefs[$id]) && !is_array($prefs[$id]))
200
+			{
201
+				$db_read[] = $id;
202
+			}
200 203
 		}
201 204
 		if ($db_read)
202 205
 		{
@@ -209,7 +212,10 @@  discard block
 block discarded – undo
209 212
 			}
210 213
 			foreach($db_read as $id)
211 214
 			{
212
-				if (!isset($prefs[$id])) $prefs[$id] = array();
215
+				if (!isset($prefs[$id]))
216
+				{
217
+					$prefs[$id] = array();
218
+				}
213 219
 				Cache::setInstance(__CLASS__, $id, $prefs[$id]);
214 220
 			}
215 221
 		}
@@ -237,7 +243,10 @@  discard block
 block discarded – undo
237 243
 		$replace = $with = array();
238 244
 		foreach($vals as $key => $val)
239 245
 		{
240
-			if ($this->debug) error_log(__METHOD__." replacing \$\$$key\$\$ with $val  ");
246
+			if ($this->debug)
247
+			{
248
+				error_log(__METHOD__." replacing \$\$$key\$\$ with $val  ");
249
+			}
241 250
 			$replace[] = '$$'.$key.'$$';
242 251
 			$with[]    = $val;
243 252
 		}
@@ -275,7 +284,10 @@  discard block
 block discarded – undo
275 284
 	 */
276 285
 	function standard_substitutes()
277 286
 	{
278
-		if ($this->debug) error_log(__METHOD__." is called ");
287
+		if ($this->debug)
288
+		{
289
+			error_log(__METHOD__." is called ");
290
+		}
279 291
 		if (!is_array(@$GLOBALS['egw_info']['user']['preferences']))
280 292
 		{
281 293
 			$GLOBALS['egw_info']['user']['preferences'] = $this->data;	// else no lang()
@@ -301,12 +313,18 @@  discard block
 block discarded – undo
301 313
 			'email'     => lang('email-address of the user, eg. "%1"',$this->values['email']),
302 314
 			'date'      => lang('todays date, eg. "%1"',$this->values['date']),
303 315
 		);
304
-		if ($this->debug) error_log(__METHOD__.print_r($this->vars,true));
316
+		if ($this->debug)
317
+		{
318
+			error_log(__METHOD__.print_r($this->vars,true));
319
+		}
305 320
 		// do the substituetion in the effective prefs (data)
306 321
 		//
307 322
 		foreach($this->data as $app => $data)
308 323
 		{
309
-			if(!is_array($data)) continue;
324
+			if(!is_array($data))
325
+			{
326
+				continue;
327
+			}
310 328
 			foreach($data as $key => $val)
311 329
 			{
312 330
 				if (!is_array($val) && strpos($val,'$$') !== False)
@@ -401,7 +419,11 @@  discard block
 block discarded – undo
401 419
 			$primary_group = Accounts::id2name($this->account_id, 'account_primary_group');
402 420
 			foreach((array)$GLOBALS['egw']->accounts->memberships($this->account_id, true) as $gid)
403 421
 			{
404
-				if ($gid != $primary_group) $to_read[] = $gid + self::DEFAULT_ID;	// need to offset it with DEFAULT_ID = -2!
422
+				if ($gid != $primary_group)
423
+				{
424
+					$to_read[] = $gid + self::DEFAULT_ID;
425
+				}
426
+				// need to offset it with DEFAULT_ID = -2!
405 427
 			}
406 428
 			$to_read[] = $primary_group + self::DEFAULT_ID;
407 429
 		}
@@ -508,9 +530,15 @@  discard block
 block discarded – undo
508 530
 		// Etemplate::complete_array_merge() is identical to PHP >= 5.3 array_replace_recursive()
509 531
 		$default = Etemplate::complete_array_merge($this->default, $this->forced);
510 532
 
511
-		if ($app) $default = $default[$app];
533
+		if ($app)
534
+		{
535
+			$default = $default[$app];
536
+		}
512 537
 
513
-		if ($name && is_array($default)) $default = $default[$name];
538
+		if ($name && is_array($default))
539
+		{
540
+			$default = $default[$name];
541
+		}
514 542
 
515 543
 		return $default;
516 544
 	}
@@ -581,9 +609,13 @@  discard block
 block discarded – undo
581 609
 				{
582 610
 					$this->session[$app_name][$var] = $this->data[$app_name][$var] = $value;
583 611
 					Cache::setSession('preferences','preferences',$this->session);
584
-					if (method_exists($GLOBALS['egw'],'invalidate_session_cache'))	// egw object in setup is limited
612
+					if (method_exists($GLOBALS['egw'],'invalidate_session_cache'))
613
+					{
614
+						// egw object in setup is limited
585 615
 					{
586
-						$GLOBALS['egw']->invalidate_session_cache();	// in case with cache the egw_info array in the session
616
+						$GLOBALS['egw']->invalidate_session_cache();
617
+					}
618
+					// in case with cache the egw_info array in the session
587 619
 					}
588 620
 				}
589 621
 				break;
@@ -639,9 +671,12 @@  discard block
 block discarded – undo
639 671
 		}
640 672
 		$pref = &$this->$type;
641 673
 
642
-		if (($all = empty($var))) // to check if $var is regarded as empty (false, 0, '', null, array() should do the trick
674
+		if (($all = empty($var)))
675
+		{
676
+			// to check if $var is regarded as empty (false, 0, '', null, array() should do the trick
643 677
 		{
644 678
 			unset($pref[$app_name]);
679
+		}
645 680
 			unset($this->data[$app_name]);
646 681
 		}
647 682
 		else
@@ -720,7 +755,10 @@  discard block
 block discarded – undo
720 755
 		$db = isset($GLOBALS['egw_setup']->db) ? $GLOBALS['egw_setup']->db : $GLOBALS['egw']->db;
721 756
 
722 757
 		$where = array();
723
-		if ($app) $where['preference_app'] = $app;
758
+		if ($app)
759
+		{
760
+			$where['preference_app'] = $app;
761
+		}
724 762
 
725 763
 		switch($type)
726 764
 		{
@@ -740,7 +778,11 @@  discard block
 block discarded – undo
740 778
 		foreach($db->select(self::TABLE, '*', $where, __LINE__, __FILE__) as $row)
741 779
 		{
742 780
 			$prefs = self::unserialize($row['preference_value']);
743
-			if (!is_array($prefs)) $prefs = array();	// would stall update otherwise
781
+			if (!is_array($prefs))
782
+			{
783
+				$prefs = array();
784
+			}
785
+			// would stall update otherwise
744 786
 
745 787
 			if ($name[0] == '/' && substr($name, -1) == '/')
746 788
 			{
@@ -757,10 +799,16 @@  discard block
 block discarded – undo
757 799
 			$updated = false;
758 800
 			foreach($attrs as $attr)
759 801
 			{
760
-				if (isset($old_value) && $prefs[$attr] != $old_value) continue;
802
+				if (isset($old_value) && $prefs[$attr] != $old_value)
803
+				{
804
+					continue;
805
+				}
761 806
 
762 807
 				$val = is_callable($value) ? call_user_func($value, $attr, $prefs[$attr], $row['preference_owner'], $prefs) : $value;
763
-				if ($val === $prefs[$attr]) continue;
808
+				if ($val === $prefs[$attr])
809
+				{
810
+					continue;
811
+				}
764 812
 
765 813
 				$updated = true;
766 814
 				if ((string)$val !== '')
@@ -825,7 +873,11 @@  discard block
 block discarded – undo
825 873
 			{
826 874
 				$prefs = array_intersect_key($prefs, array_flip($names));
827 875
 			}
828
-			if (!$prefs) continue;	// nothing to change, as nothing set
876
+			if (!$prefs)
877
+			{
878
+				continue;
879
+			}
880
+			// nothing to change, as nothing set
829 881
 
830 882
 			$row['preference_app'] = $to_app;
831 883
 			unset($row['preference_value']);
@@ -891,9 +943,15 @@  discard block
 block discarded – undo
891 943
 			foreach($prefs as $app => $value)
892 944
 			{
893 945
 				// check if app preferences have changed, if not no need to save them
894
-				if ($old_prefs && $old_prefs[$app] == $value) continue;
946
+				if ($old_prefs && $old_prefs[$app] == $value)
947
+				{
948
+					continue;
949
+				}
895 950
 
896
-				if (!$changed++) $this->db->transaction_begin();
951
+				if (!$changed++)
952
+				{
953
+					$this->db->transaction_begin();
954
+				}
897 955
 
898 956
 				if (!is_array($value) || !$value)
899 957
 				{
@@ -979,7 +1037,10 @@  discard block
 block discarded – undo
979 1037
 			list($lang,$lang2) = explode('-',$lang);
980 1038
 			$country_from_lang = strtoupper($lang2);
981 1039
 		}
982
-		if (is_null($charset)) $charset = Translation::charset();
1040
+		if (is_null($charset))
1041
+		{
1042
+			$charset = Translation::charset();
1043
+		}
983 1044
 
984 1045
 		foreach(array(
985 1046
 			$lang.'_'.$country,
Please login to merge, or discard this patch.
infolog/inc/class.infolog_datasource.inc.php 3 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@
 block discarded – undo
102 102
 	 *	and the amount to offset them from the original while copying
103 103
 	 * @return array/boolean array(info_id,link_id) on success, false otherwise
104 104
 	 */
105
-	function copy($element,$target,$extra=null,$date_offsets = Array())
105
+	function copy($element,$target,$extra=null,$date_offsets = array())
106 106
 	{
107 107
 		unset($extra);	// not used, but required by function signature
108 108
 
Please login to merge, or discard this patch.
Braces   +16 added lines, -4 removed lines patch added patch discarded remove patch
@@ -65,7 +65,10 @@  discard block
 block discarded – undo
65 65
 		{
66 66
 			$data =& $this->infolog_bo->read((int) $data_id);
67 67
 
68
-			if (!is_array($data)) return false;
68
+			if (!is_array($data))
69
+			{
70
+				return false;
71
+			}
69 72
 		}
70 73
 		else
71 74
 		{
@@ -111,7 +114,10 @@  discard block
 block discarded – undo
111 114
 
112 115
 		$info =& $this->infolog_bo->read((int) $element['pe_app_id']);
113 116
 
114
-		if (!is_array($info)) return false;
117
+		if (!is_array($info))
118
+		{
119
+			return false;
120
+		}
115 121
 
116 122
 		$info_contact = $info['info_contact'];
117 123
 		$info_from = $info['info_from'];
@@ -175,17 +181,23 @@  discard block
 block discarded – undo
175 181
 		}
176 182
 
177 183
 		$info['pm_id'] = $target;
178
-		if(!($info['info_id'] = $this->infolog_bo->write($info))) return false;
184
+		if(!($info['info_id'] = $this->infolog_bo->write($info)))
185
+		{
186
+			return false;
187
+		}
179 188
 		$this->infolog_bo->link_id2from($info);
180 189
 
181 190
 		// creating again all links, beside the one to the source-project
182 191
 		foreach(Link::get_links('infolog',$element['pe_app_id']) as $link)
183 192
 		{
184 193
 			if ($link['app'] == 'projectmanager' && $link['id'] == $element['pm_id'] ||		// ignoring the source project
185
-				$link['app'] == Link::VFS_APPNAME)					// ignoring files attachments for now
194
+				$link['app'] == Link::VFS_APPNAME)
195
+			{
196
+				// ignoring files attachments for now
186 197
 			{
187 198
 				continue;
188 199
 			}
200
+			}
189 201
 			Link::link('infolog',$info['info_id'],$link['app'],$link['id'],$link['remark']);
190 202
 		}
191 203
 		$this->infolog_bo->write($info);
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		{
51 51
 			$GLOBALS['infolog_bo'] = new infolog_bo();
52 52
 		}
53
-		$this->infolog_bo =& $GLOBALS['infolog_bo'];
53
+		$this->infolog_bo = & $GLOBALS['infolog_bo'];
54 54
 	}
55 55
 
56 56
 	/**
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 	{
64 64
 		if (!is_array($data_id))
65 65
 		{
66
-			$data =& $this->infolog_bo->read((int) $data_id);
66
+			$data = & $this->infolog_bo->read((int)$data_id);
67 67
 
68 68
 			if (!is_array($data)) return false;
69 69
 		}
70 70
 		else
71 71
 		{
72
-			$data =& $data_id;
72
+			$data = & $data_id;
73 73
 		}
74 74
 
75 75
 		return array(
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 	 *	and the amount to offset them from the original while copying
104 104
 	 * @return array/boolean array(info_id,link_id) on success, false otherwise
105 105
 	 */
106
-	function copy($element,$target,$extra=null,$date_offsets = Array())
106
+	function copy($element, $target, $extra = null, $date_offsets = Array())
107 107
 	{
108
-		unset($extra);	// not used, but required by function signature
108
+		unset($extra); // not used, but required by function signature
109 109
 
110
-		$info =& $this->infolog_bo->read((int) $element['pe_app_id']);
110
+		$info = & $this->infolog_bo->read((int)$element['pe_app_id']);
111 111
 
112 112
 		if (!is_array($info)) return false;
113 113
 
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
 		// unsetting info_link_id and evtl. info_from
118 118
 		if ($info['info_link_id'])
119 119
 		{
120
-			$this->infolog_bo->link_id2from($info);		// unsets info_from and sets info_link_target
120
+			$this->infolog_bo->link_id2from($info); // unsets info_from and sets info_link_target
121 121
 			unset($info['info_link_id']);
122 122
 			unset($info['info_contact']);
123 123
 		}
124 124
 
125 125
 		// we need to unset a few fields to get a new entry
126
-		foreach(array('info_id','info_owner','info_modified','info_modifierer') as $key)
126
+		foreach (array('info_id', 'info_owner', 'info_modified', 'info_modifierer') as $key)
127 127
 		{
128 128
 			unset($info[$key]);
129 129
 		}
@@ -137,12 +137,12 @@  discard block
 block discarded – undo
137 137
 		);
138 138
 
139 139
 		$startdate_original = $info['info_startdate'];
140
-		foreach($map as $offset_field => $info_field)
140
+		foreach ($map as $offset_field => $info_field)
141 141
 		{
142
-			if($date_offsets[$offset_field] && $info[$info_field])
142
+			if ($date_offsets[$offset_field] && $info[$info_field])
143 143
 			{
144 144
 				// Don't move startdate twice, but prefer later value
145
-				if($startdate_original && $info_field == 'info_startdate')
145
+				if ($startdate_original && $info_field == 'info_startdate')
146 146
 				{
147 147
 					$info[$info_field] = $startdate_original;
148 148
 				}
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
 			}
153 153
 		}
154 154
 		// Sanity check - not due or ended before it starts
155
-		if($info['info_startdate'] && $info['info_enddate'] && $info['info_startdate'] > $info['info_enddate'])
155
+		if ($info['info_startdate'] && $info['info_enddate'] && $info['info_startdate'] > $info['info_enddate'])
156 156
 		{
157 157
 			unset($info['info_enddate']);
158 158
 		}
159
-		if($info['info_startdate'] && $info['info_datecompleted'] && $info['info_startdate'] > $info['info_datecompleted'])
159
+		if ($info['info_startdate'] && $info['info_datecompleted'] && $info['info_startdate'] > $info['info_datecompleted'])
160 160
 		{
161 161
 			unset($info['info_datecompleted']);
162 162
 		}
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 		// If info_from missing or matches project title, update it
165 165
 		if (!$info['info_from'] || $info['info_from'] == Link::title('projectmanager', $info['pm_id']))
166 166
 		{
167
-			$info['info_from'] = Link::title('projectmanager',$target);
167
+			$info['info_from'] = Link::title('projectmanager', $target);
168 168
 			unset($info['info_custom_from']);
169 169
 		}
170 170
 		if ($info['info_status'] == 'template')
@@ -173,29 +173,29 @@  discard block
 block discarded – undo
173 173
 		}
174 174
 
175 175
 		$info['pm_id'] = $target;
176
-		if(!($info['info_id'] = $this->infolog_bo->write($info))) return false;
176
+		if (!($info['info_id'] = $this->infolog_bo->write($info))) return false;
177 177
 		$this->infolog_bo->link_id2from($info);
178 178
 
179 179
 		// creating again all links, beside the one to the source-project
180
-		foreach(Link::get_links('infolog',$element['pe_app_id']) as $link)
180
+		foreach (Link::get_links('infolog', $element['pe_app_id']) as $link)
181 181
 		{
182
-			if ($link['app'] == 'projectmanager' && $link['id'] == $element['pm_id'] ||		// ignoring the source project
182
+			if ($link['app'] == 'projectmanager' && $link['id'] == $element['pm_id'] || // ignoring the source project
183 183
 				$link['app'] == Link::VFS_APPNAME)					// ignoring files attachments for now
184 184
 			{
185 185
 				continue;
186 186
 			}
187
-			Link::link('infolog',$info['info_id'],$link['app'],$link['id'],$link['remark']);
187
+			Link::link('infolog', $info['info_id'], $link['app'], $link['id'], $link['remark']);
188 188
 		}
189 189
 		$this->infolog_bo->write($info);
190
-		$ret = array($info['info_id'],$info['info_link_id']);
190
+		$ret = array($info['info_id'], $info['info_link_id']);
191 191
 
192 192
 		// if we have a parent set, return our callback to modify the parent id,
193 193
 		// or we have a contact or custom info_from and need to re-set it after
194 194
 		// all entries are copied
195 195
 		if ($info['info_id_parent'] || $info_contact)
196 196
 		{
197
-			$ret[] = array($this,'copy_callback');	// callback
198
-			$ret[] = array($info['info_id'],$info['info_id_parent'], $info_contact, $info_from);	// $param
197
+			$ret[] = array($this, 'copy_callback'); // callback
198
+			$ret[] = array($info['info_id'], $info['info_id_parent'], $info_contact, $info_from); // $param
199 199
 		}
200 200
 		return $ret;
201 201
 	}
@@ -212,21 +212,21 @@  discard block
 block discarded – undo
212 212
 	public function copy_callback(array $param, array $apps_copied)
213 213
 	{
214 214
 		//error_log(__METHOD__."(".array2string($param).', '.array2string($apps_copied).')');
215
-		list($info_id,$parent_id, $contact, $from) = $param;
215
+		list($info_id, $parent_id, $contact, $from) = $param;
216 216
 		if ($parent_id && isset($apps_copied['infolog'][$parent_id]) && ($info = $this->infolog_bo->read($info_id)))
217 217
 		{
218 218
 			$info['info_id_parent'] = $apps_copied['infolog'][$parent_id];
219
-			$this->infolog_bo->write($info,false,true,true,true);	// no default and no notification
219
+			$this->infolog_bo->write($info, false, true, true, true); // no default and no notification
220 220
 		}
221
-		if($contact && $contact['app'] != 'projectmanager' && ($info = $this->infolog_bo->read($info_id)))
221
+		if ($contact && $contact['app'] != 'projectmanager' && ($info = $this->infolog_bo->read($info_id)))
222 222
 		{
223 223
 			$info['info_contact'] = $contact;
224
-			$this->infolog_bo->write($info,false,true,true,true);	// no default and no notification
224
+			$this->infolog_bo->write($info, false, true, true, true); // no default and no notification
225 225
 		}
226
-		if($from && ($info = $this->infolog_bo->read($info_id)))
226
+		if ($from && ($info = $this->infolog_bo->read($info_id)))
227 227
 		{
228 228
 			$info['info_from'] = $from;
229
-			$this->infolog_bo->write($info,false,true,true,true);	// no default and no notification
229
+			$this->infolog_bo->write($info, false, true, true, true); // no default and no notification
230 230
 		}
231 231
 	}
232 232
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 			$GLOBALS['infolog_bo'] = new infolog_bo();
245 245
 		}
246 246
 		// dont delete infolog, which are linked to other elements, but their project
247
-		if (count(Link::get_links('infolog',$id)) > 1)
247
+		if (count(Link::get_links('infolog', $id)) > 1)
248 248
 		{
249 249
 			return false;
250 250
 		}
@@ -258,19 +258,19 @@  discard block
 block discarded – undo
258 258
 	 * @param string $status
259 259
 	 * @return boolean true if status changed, false otherwise
260 260
 	 */
261
-	function change_status($id,$status)
261
+	function change_status($id, $status)
262 262
 	{
263 263
 		//error_log("datasource_infolog::change_status($id,$status)");
264 264
 		if (($info = $this->infolog_bo->read($id)) && (
265
-				$this->infolog_bo->check_access($info,Acl::EDIT) ||
265
+				$this->infolog_bo->check_access($info, Acl::EDIT) ||
266 266
 				$info['info_status'] == 'deleted' && $this->infolog_bo->check_access($info, infolog_bo::ACL_UNDELETE)
267 267
 		))
268 268
 		{
269
-			if ($status == 'active' && in_array($info['info_status'],array('template','nonactive','archive','deleted')))
269
+			if ($status == 'active' && in_array($info['info_status'], array('template', 'nonactive', 'archive', 'deleted')))
270 270
 			{
271 271
 				$status = $this->infolog_bo->activate($info);
272 272
 			}
273
-			if($info['info_status'] != $status && isset($this->infolog_bo->status[$info['info_type']][$status]))
273
+			if ($info['info_status'] != $status && isset($this->infolog_bo->status[$info['info_type']][$status]))
274 274
 			{
275 275
 				//error_log("datasource_infolog::change_status($id,$status) setting status from ".$info['info_status']);
276 276
 				$info['info_status'] = $status;
Please login to merge, or discard this patch.