Completed
Push — 16.1 ( 7ccc73...046888 )
by Nathan
64:46 queued 51:15
created
api/js/etemplate/test/test.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,18 +16,18 @@
 block discarded – undo
16 16
 
17 17
 use EGroupware\Api;
18 18
 
19
-Api\Framework::includeJS('.','etemplate2','etemplate');
20
-Api\Framework::includeJS('jquery','jquery.tools.min','phpgwapi'); // Not needed once JS require works for files like this
21
-Api\Framework::includeJS('jquery','jquery.html5_upload','phpgwapi'); // Not needed once JS require works for files like this
19
+Api\Framework::includeJS('.', 'etemplate2', 'etemplate');
20
+Api\Framework::includeJS('jquery', 'jquery.tools.min', 'phpgwapi'); // Not needed once JS require works for files like this
21
+Api\Framework::includeJS('jquery', 'jquery.html5_upload', 'phpgwapi'); // Not needed once JS require works for files like this
22 22
 Api\Framework::includeCSS('/api/js/etemplate/test/test.css');
23 23
 
24 24
 /*
25 25
 * Test using any actual template
26 26
 */
27 27
 	$template = 'etemplate.et2_test_file_upload';
28
-	if($template) {
28
+	if ($template) {
29 29
 		$etemplate = new Api\Etemplate('etemplate.et2_test_file_upload');
30
-		$etemplate->exec('',array());
30
+		$etemplate->exec('', array());
31 31
 		return;
32 32
 	}
33 33
 	echo $GLOBALS['egw']->framework->header();
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,8 @@
 block discarded – undo
25 25
 * Test using any actual template
26 26
 */
27 27
 	$template = 'etemplate.et2_test_file_upload';
28
-	if($template) {
28
+	if($template)
29
+	{
29 30
 		$etemplate = new Api\Etemplate('etemplate.et2_test_file_upload');
30 31
 		$etemplate->exec('',array());
31 32
 		return;
Please login to merge, or discard this patch.
api/categories.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
 $appname = $_GET['app'] && $GLOBALS['egw_info']['apps'][$_GET['app']] ? $_GET['app'] : Api\Categories::GLOBAL_APPNAME;
31 31
 
32 32
 $cats = new Api\Categories('', $appname);
33
-$categories = $cats->return_array('all',0, false, '', 'ASC','',$appname==Api\Categories::GLOBAL_APPNAME);
33
+$categories = $cats->return_array('all', 0, false, '', 'ASC', '', $appname == Api\Categories::GLOBAL_APPNAME);
34 34
 
35 35
 $content = "/* Category CSS for $appname */\n\n";
36 36
 
37
-foreach($categories as $cat)
37
+foreach ($categories as $cat)
38 38
 {
39 39
 	if (!isset($cat['data'])) continue;
40 40
 	if (!empty($cat['data']['color']))
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	}
46 46
 	if (!empty($cat['data']['icon']))
47 47
 	{
48
-		$content .= ".cat_{$cat['id']} .cat_icon { background-image: url('". admin_categories::icon_url($cat['data']['icon']) ."');} /*{$cat['name']}*/\n";
48
+		$content .= ".cat_{$cat['id']} .cat_icon { background-image: url('".admin_categories::icon_url($cat['data']['icon'])."');} /*{$cat['name']}*/\n";
49 49
 	}
50 50
 }
51 51
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 $etag = '"'.md5($content).'"';
54 54
 
55 55
 // headers to allow caching, egw_framework specifies etag on url to force reload, even with Expires header
56
-Api\Session::cache_control(86400);	// cache for 1 day
56
+Api\Session::cache_control(86400); // cache for 1 day
57 57
 Header('Content-Type: text/css; charset=utf-8');
58 58
 Header('ETag: '.$etag);
59 59
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 }
66 66
 
67 67
 // we run our own gzip compression, to set a correct Content-Length of the encoded content
68
-if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode'))
68
+if (in_array('gzip', explode(',', $_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode'))
69 69
 {
70 70
 	$content = gzencode($content);
71 71
 	header('Content-Encoding: gzip');
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,10 @@
 block discarded – undo
36 36
 
37 37
 foreach($categories as $cat)
38 38
 {
39
-	if (!isset($cat['data'])) continue;
39
+	if (!isset($cat['data']))
40
+	{
41
+		continue;
42
+	}
40 43
 	if (!empty($cat['data']['color']))
41 44
 	{
42 45
 		// Use slightly more specific selector that just class, to allow defaults
Please login to merge, or discard this patch.
api/lang.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	'flags' => array(
25 25
 		'currentapp' => 'api',
26 26
 		'noheader' => true,
27
-		'load_translations' => false,	// do not automatically load translations
27
+		'load_translations' => false, // do not automatically load translations
28 28
 		'nocachecontrol' => true,
29 29
 	)
30 30
 );
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
 }
40 40
 
41 41
 // use an etag with app, lang and a hash over the creation-times of all lang-files
42
-$etag = '"'.$_GET['app'].'-'.$_GET['lang'].'-'.  Api\Translation::etag($_GET['app'], $_GET['lang']).'"';
42
+$etag = '"'.$_GET['app'].'-'.$_GET['lang'].'-'.Api\Translation::etag($_GET['app'], $_GET['lang']).'"';
43 43
 
44 44
 // headers to allow caching, we specify etag on url to force reload, even with Expires header
45
-Api\Session::cache_control(864000);	// cache for 10 days
45
+Api\Session::cache_control(864000); // cache for 10 days
46 46
 Header('Content-Type: text/javascript; charset=utf-8');
47 47
 Header('ETag: '.$etag);
48 48
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 $content = 'egw.set_lang_arr("'.$_GET['app'].'", '.str_replace('\\\\n', '\\n', json_encode(Api\Translation::$lang_arr)).', egw && egw.window !== window);';
65 65
 
66 66
 // we run our own gzip compression, to set a correct Content-Length of the encoded content
67
-if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode'))
67
+if (in_array('gzip', explode(',', $_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode'))
68 68
 {
69 69
 	$content = gzencode($content);
70 70
 	header('Content-Encoding: gzip');
Please login to merge, or discard this patch.
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,14 @@
 block discarded – undo
14 14
 use EGroupware\Api;
15 15
 
16 16
 // just to be sure, noone tries something nasty ...
17
-if (!preg_match('/^[a-z0-9_]+$/i', $_GET['app'])) die('No valid application-name given!');
18
-if (!preg_match('/^[a-z]{2}(-[a-z]{2})?$/i', $_GET['lang'])) die('No valid lang-name given!');
17
+if (!preg_match('/^[a-z0-9_]+$/i', $_GET['app']))
18
+{
19
+	die('No valid application-name given!');
20
+}
21
+if (!preg_match('/^[a-z]{2}(-[a-z]{2})?$/i', $_GET['lang']))
22
+{
23
+	die('No valid lang-name given!');
24
+}
19 25
 
20 26
 // switch evtl. set output-compression off, as we cant calculate a Content-Length header with transparent compression
21 27
 ini_set('zlib.output_compression', 0);
Please login to merge, or discard this patch.
api/user.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 $etag = '"'.md5($preferences.$ab_preferences.$user).'"';
34 34
 
35 35
 // headers to allow caching, egw_framework specifies etag on url to force reload, even with Expires header
36
-Api\Session::cache_control(86400);	// cache for 1 day
36
+Api\Session::cache_control(86400); // cache for 1 day
37 37
 Header('Content-Type: text/javascript; charset=utf-8');
38 38
 Header('ETag: '.$etag);
39 39
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 $content .= 'egw.set_user('.$user.", egw && egw.window !== window);\n";
50 50
 
51 51
 // we run our own gzip compression, to set a correct Content-Length of the encoded content
52
-if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode'))
52
+if (in_array('gzip', explode(',', $_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode'))
53 53
 {
54 54
 	$content = gzencode($content);
55 55
 	header('Content-Encoding: gzip');
Please login to merge, or discard this patch.
setup/schematoy.php 1 patch
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	include('./inc/functions.inc.php');
24 24
 
25 25
 	// Check header and authentication
26
-	if(!$GLOBALS['egw_setup']->auth('Config'))
26
+	if (!$GLOBALS['egw_setup']->auth('Config'))
27 27
 	{
28 28
 		Header('Location: index.php');
29 29
 		exit;
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	// Does not return unless user is authorized
32 32
 
33 33
 	$tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup');
34
-	$GLOBALS['setup_tpl'] = CreateObject('phpgwapi.Template',$tpl_root);
34
+	$GLOBALS['setup_tpl'] = CreateObject('phpgwapi.Template', $tpl_root);
35 35
 	$GLOBALS['setup_tpl']->set_file(array(
36 36
 		'T_head' => 'head.tpl',
37 37
 		'T_footer' => 'footer.tpl',
@@ -41,48 +41,48 @@  discard block
 block discarded – undo
41 41
 		'T_setup_main' => 'schema.tpl'
42 42
 	));
43 43
 
44
-	$GLOBALS['setup_tpl']->set_block('T_login_stage_header','B_multi_domain','V_multi_domain');
45
-	$GLOBALS['setup_tpl']->set_block('T_login_stage_header','B_single_domain','V_single_domain');
46
-	$GLOBALS['setup_tpl']->set_block('T_setup_main','header','header');
47
-	$GLOBALS['setup_tpl']->set_block('T_setup_main','app_header','app_header');
48
-	$GLOBALS['setup_tpl']->set_block('T_setup_main','apps','apps');
49
-	$GLOBALS['setup_tpl']->set_block('T_setup_main','detail','detail');
50
-	$GLOBALS['setup_tpl']->set_block('T_setup_main','table','table');
51
-	$GLOBALS['setup_tpl']->set_block('T_setup_main','hook','hook');
52
-	$GLOBALS['setup_tpl']->set_block('T_setup_main','dep','dep');
53
-	$GLOBALS['setup_tpl']->set_block('T_setup_main','app_footer','app_footer');
54
-	$GLOBALS['setup_tpl']->set_block('T_setup_main','submit','submit');
55
-	$GLOBALS['setup_tpl']->set_block('T_setup_main','footer','footer');
56
-
57
-	$bgcolor = array('DDDDDD','EEEEEE');
58
-
59
-	function parsedep($depends,$main=True)
44
+	$GLOBALS['setup_tpl']->set_block('T_login_stage_header', 'B_multi_domain', 'V_multi_domain');
45
+	$GLOBALS['setup_tpl']->set_block('T_login_stage_header', 'B_single_domain', 'V_single_domain');
46
+	$GLOBALS['setup_tpl']->set_block('T_setup_main', 'header', 'header');
47
+	$GLOBALS['setup_tpl']->set_block('T_setup_main', 'app_header', 'app_header');
48
+	$GLOBALS['setup_tpl']->set_block('T_setup_main', 'apps', 'apps');
49
+	$GLOBALS['setup_tpl']->set_block('T_setup_main', 'detail', 'detail');
50
+	$GLOBALS['setup_tpl']->set_block('T_setup_main', 'table', 'table');
51
+	$GLOBALS['setup_tpl']->set_block('T_setup_main', 'hook', 'hook');
52
+	$GLOBALS['setup_tpl']->set_block('T_setup_main', 'dep', 'dep');
53
+	$GLOBALS['setup_tpl']->set_block('T_setup_main', 'app_footer', 'app_footer');
54
+	$GLOBALS['setup_tpl']->set_block('T_setup_main', 'submit', 'submit');
55
+	$GLOBALS['setup_tpl']->set_block('T_setup_main', 'footer', 'footer');
56
+
57
+	$bgcolor = array('DDDDDD', 'EEEEEE');
58
+
59
+	function parsedep($depends, $main = True)
60 60
 	{
61 61
 		$depstring = '(';
62
-		foreach($depends as $a => $b)
62
+		foreach ($depends as $a => $b)
63 63
 		{
64
-			foreach($b as $c => $d)
64
+			foreach ($b as $c => $d)
65 65
 			{
66
-				if(is_array($d))
66
+				if (is_array($d))
67 67
 				{
68
-					$depstring .= $c . ': ' .implode(',',$d) . '; ';
68
+					$depstring .= $c.': '.implode(',', $d).'; ';
69 69
 					$depver[] = $d;
70 70
 				}
71 71
 				else
72 72
 				{
73
-					$depstring .= $c . ': ' . $d . '; ';
73
+					$depstring .= $c.': '.$d.'; ';
74 74
 					$depapp[] = $d;
75 75
 				}
76 76
 			}
77 77
 		}
78 78
 		$depstring .= ')';
79
-		if($main)
79
+		if ($main)
80 80
 		{
81 81
 			return $depstring;
82 82
 		}
83 83
 		else
84 84
 		{
85
-			return array($depapp,$depver);
85
+			return array($depapp, $depver);
86 86
 		}
87 87
 	}
88 88
 
@@ -99,178 +99,178 @@  discard block
 block discarded – undo
99 99
 	//var_dump($GLOBALS['setup_info']);exit;
100 100
 	@ksort($GLOBALS['setup_info']);
101 101
 
102
-	if($_POST['cancel'])
102
+	if ($_POST['cancel'])
103 103
 	{
104 104
 		Header('Location: index.php');
105 105
 		exit;
106 106
 	}
107 107
 
108
-	$GLOBALS['egw_setup']->html->show_header(lang("Developers' Table Schema Toy"),False,'config',$GLOBALS['egw_setup']->ConfigDomain);
108
+	$GLOBALS['egw_setup']->html->show_header(lang("Developers' Table Schema Toy"), False, 'config', $GLOBALS['egw_setup']->ConfigDomain);
109 109
 
110
-	if($_POST['submit'])
110
+	if ($_POST['submit'])
111 111
 	{
112
-		$GLOBALS['setup_tpl']->set_var('description',lang('App process') . ':');
113
-		$GLOBALS['setup_tpl']->pparse('out','header');
112
+		$GLOBALS['setup_tpl']->set_var('description', lang('App process').':');
113
+		$GLOBALS['setup_tpl']->pparse('out', 'header');
114 114
 
115 115
 		$appname = $_POST['appname'];
116 116
 		$install = $_POST['install'];
117 117
 		$version = $_POST['version'];
118 118
 
119
-		foreach($install as $appname => $key)
119
+		foreach ($install as $appname => $key)
120 120
 		{
121 121
 			$terror = array();
122 122
 			$terror[$appname]['name'] = $appname;
123 123
 			$terror[$appname]['version'] = $version[$appname];
124 124
 			$terror[$appname]['status'] = 'U';
125 125
 
126
-			$appdir  = EGW_SERVER_ROOT . '/' . $appname . '/setup/';
126
+			$appdir = EGW_SERVER_ROOT.'/'.$appname.'/setup/';
127 127
 
128 128
 			// Drop newest tables
129 129
 			$terror[$appname]['tables'] = $GLOBALS['setup_info'][$appname]['tables'];
130
-			$GLOBALS['egw_setup']->process->droptables($terror,$GLOBALS['DEBUG']);
130
+			$GLOBALS['egw_setup']->process->droptables($terror, $GLOBALS['DEBUG']);
131 131
 			$terror[$appname]['tables'] = array();
132 132
 
133 133
 			// Reset tables field to baseline table names
134
-			if(file_exists($appdir.'tables_baseline.inc.php'))
134
+			if (file_exists($appdir.'tables_baseline.inc.php'))
135 135
 			{
136 136
 				include($appdir.'tables_baseline.inc.php');
137
-				foreach($phpgw_baseline as $table => $null)
137
+				foreach ($phpgw_baseline as $table => $null)
138 138
 				{
139 139
 					$terror[$appname]['tables'][] = $table;
140
-					echo '<br />Adding app table: ' . $table;
140
+					echo '<br />Adding app table: '.$table;
141 141
 				}
142 142
 			}
143 143
 
144
-			if($version[$appname])
144
+			if ($version[$appname])
145 145
 			{
146
-				echo '<br />Processing ' . $terror[$appname]['name'] . ' to ' . $version[$appname];
146
+				echo '<br />Processing '.$terror[$appname]['name'].' to '.$version[$appname];
147 147
 
148
-				$terror = $GLOBALS['egw_setup']->process->droptables($terror,$GLOBALS['DEBUG']);
148
+				$terror = $GLOBALS['egw_setup']->process->droptables($terror, $GLOBALS['DEBUG']);
149 149
 				$GLOBALS['egw_setup']->deregister_app($terror[$appname]['name']);
150 150
 
151
-				$terror = $GLOBALS['egw_setup']->process->baseline($terror,$GLOBALS['DEBUG']);
152
-				$terror = $GLOBALS['egw_setup']->process->test_data($terror,$GLOBALS['DEBUG']);
151
+				$terror = $GLOBALS['egw_setup']->process->baseline($terror, $GLOBALS['DEBUG']);
152
+				$terror = $GLOBALS['egw_setup']->process->test_data($terror, $GLOBALS['DEBUG']);
153 153
 
154
-				$terror = $GLOBALS['egw_setup']->process->upgrade($terror,$GLOBALS['DEBUG']);
154
+				$terror = $GLOBALS['egw_setup']->process->upgrade($terror, $GLOBALS['DEBUG']);
155 155
 				$terror[$appname]['version'] = $version[$appname];
156 156
 			}
157 157
 			else
158 158
 			{
159
-				echo '<br />Baseline-only completed for ' . $terror[$appname]['name'];
159
+				echo '<br />Baseline-only completed for '.$terror[$appname]['name'];
160 160
 			}
161
-			echo '<br />' . $GLOBALS['setup_info'][$appname]['title'] . ' '
162
-				. lang('tables installed, unless there are errors printed above') . '.';
161
+			echo '<br />'.$GLOBALS['setup_info'][$appname]['title'].' '
162
+				. lang('tables installed, unless there are errors printed above').'.';
163 163
 
164 164
 			$GLOBALS['setup_info'][$appname]['version'] = $terror[$appname]['version'];
165 165
 			$GLOBALS['egw_setup']->register_app($appname);
166
-			echo '<br />' . $terror[$appname]['title'] . ' ' . lang('registered') . '.';
166
+			echo '<br />'.$terror[$appname]['title'].' '.lang('registered').'.';
167 167
 		}
168 168
 
169
-		echo '<br /><a href="schematoy.php">' . lang('Go back') . '</a>';
170
-		$GLOBALS['setup_tpl']->pparse('out','footer');
169
+		echo '<br /><a href="schematoy.php">'.lang('Go back').'</a>';
170
+		$GLOBALS['setup_tpl']->pparse('out', 'footer');
171 171
 		exit;
172 172
 	}
173 173
 	$detail = $_REQUEST['detail'];
174
-	if($detail)
174
+	if ($detail)
175 175
 	{
176 176
 		@ksort($GLOBALS['setup_info'][$detail]);
177 177
 		@reset($GLOBALS['setup_info'][$detail]);
178
-		$GLOBALS['setup_tpl']->set_var('description',lang('App details') . ':');
179
-		$GLOBALS['setup_tpl']->pparse('out','header');
178
+		$GLOBALS['setup_tpl']->set_var('description', lang('App details').':');
179
+		$GLOBALS['setup_tpl']->pparse('out', 'header');
180 180
 
181
-		foreach($GLOBALS['setup_info'][$detail] as $key => $val)
181
+		foreach ($GLOBALS['setup_info'][$detail] as $key => $val)
182 182
 		{
183 183
 			$i = $i ? 0 : 1;
184 184
 
185 185
 			//if(!$val) { $val = 'none'; }
186 186
 
187
-			if($key == 'tables')
187
+			if ($key == 'tables')
188 188
 			{
189
-				if(is_array($val))
189
+				if (is_array($val))
190 190
 				{
191
-					$key = '<a href="sqltoarray.php?appname=' . $detail . '&submit=True">' . $key . '</a>' . "\n";
192
-					$val = implode(',',$val);
191
+					$key = '<a href="sqltoarray.php?appname='.$detail.'&submit=True">'.$key.'</a>'."\n";
192
+					$val = implode(',', $val);
193 193
 				}
194 194
 			}
195
-			if($key == 'hooks')
195
+			if ($key == 'hooks')
196 196
 			{
197
-				$val = implode(',',$val);
197
+				$val = implode(',', $val);
198 198
 			}
199
-			if($key == 'depends')
199
+			if ($key == 'depends')
200 200
 			{
201 201
 				$val = parsedep($val);
202 202
 			}
203
-			if(is_array($val))
203
+			if (is_array($val))
204 204
 			{
205
-				$val = implode(',',$val);
205
+				$val = implode(',', $val);
206 206
 			}
207 207
 
208
-			$GLOBALS['setup_tpl']->set_var('bg_color',$bgcolor[$i]);
209
-			$GLOBALS['setup_tpl']->set_var('name',$key);
210
-			$GLOBALS['setup_tpl']->set_var('details',$val);
211
-			$GLOBALS['setup_tpl']->pparse('out','detail');
208
+			$GLOBALS['setup_tpl']->set_var('bg_color', $bgcolor[$i]);
209
+			$GLOBALS['setup_tpl']->set_var('name', $key);
210
+			$GLOBALS['setup_tpl']->set_var('details', $val);
211
+			$GLOBALS['setup_tpl']->pparse('out', 'detail');
212 212
 		}
213 213
 
214
-		echo '<br /><a href="schematoy.php">' . lang('Go back') . '</a>';
215
-		$GLOBALS['setup_tpl']->pparse('out','footer');
214
+		echo '<br /><a href="schematoy.php">'.lang('Go back').'</a>';
215
+		$GLOBALS['setup_tpl']->pparse('out', 'footer');
216 216
 		exit;
217 217
 	}
218 218
 	else
219 219
 	{
220
-		$GLOBALS['setup_tpl']->set_var('description',lang("Select an app, enter a target version, then submit to process to that version.<br />If you do not enter a version, only the baseline tables will be installed for the app.<br /><blink>THIS WILL DROP ALL OF THE APPS' TABLES FIRST!</blink>"));
221
-		$GLOBALS['setup_tpl']->pparse('out','header');
222
-
223
-		$GLOBALS['setup_tpl']->set_var('appdata',lang('Application Data'));
224
-		$GLOBALS['setup_tpl']->set_var('actions',lang('Actions'));
225
-		$GLOBALS['setup_tpl']->set_var('action_url','schematoy.php');
226
-		$GLOBALS['setup_tpl']->set_var('app_info',lang('Application Name and Status'));
227
-		$GLOBALS['setup_tpl']->set_var('app_title',lang('Application Title'));
228
-		$GLOBALS['setup_tpl']->set_var('app_version',lang('Target Version'));
229
-		$GLOBALS['setup_tpl']->set_var('app_install',lang('Process'));
230
-		$GLOBALS['setup_tpl']->pparse('out','app_header');
231
-
232
-		foreach($GLOBALS['setup_info'] as $key => $value)
220
+		$GLOBALS['setup_tpl']->set_var('description', lang("Select an app, enter a target version, then submit to process to that version.<br />If you do not enter a version, only the baseline tables will be installed for the app.<br /><blink>THIS WILL DROP ALL OF THE APPS' TABLES FIRST!</blink>"));
221
+		$GLOBALS['setup_tpl']->pparse('out', 'header');
222
+
223
+		$GLOBALS['setup_tpl']->set_var('appdata', lang('Application Data'));
224
+		$GLOBALS['setup_tpl']->set_var('actions', lang('Actions'));
225
+		$GLOBALS['setup_tpl']->set_var('action_url', 'schematoy.php');
226
+		$GLOBALS['setup_tpl']->set_var('app_info', lang('Application Name and Status'));
227
+		$GLOBALS['setup_tpl']->set_var('app_title', lang('Application Title'));
228
+		$GLOBALS['setup_tpl']->set_var('app_version', lang('Target Version'));
229
+		$GLOBALS['setup_tpl']->set_var('app_install', lang('Process'));
230
+		$GLOBALS['setup_tpl']->pparse('out', 'app_header');
231
+
232
+		foreach ($GLOBALS['setup_info'] as $key => $value)
233 233
 		{
234 234
 			unset($test);
235
-			if(file_exists(EGW_SERVER_ROOT . '/' . $value['name'] . '/setup/tables_update.inc.php'))
235
+			if (file_exists(EGW_SERVER_ROOT.'/'.$value['name'].'/setup/tables_update.inc.php'))
236 236
 			{
237
-				include(EGW_SERVER_ROOT . '/' . $value['name'] . '/setup/tables_update.inc.php');
237
+				include(EGW_SERVER_ROOT.'/'.$value['name'].'/setup/tables_update.inc.php');
238 238
 
239
-				if(is_array($test))
239
+				if (is_array($test))
240 240
 				{
241 241
 					reset($test);
242 242
 				}
243 243
 
244 244
 				$s = '<option value="">&nbsp;</option>';
245
-				while(is_array($test) && list(,$versionnumber) = each($test))
245
+				while (is_array($test) && list(,$versionnumber) = each($test))
246 246
 				{
247
-					$s .= '<option value="' . $versionnumber . '">' . $versionnumber . '</option>';
247
+					$s .= '<option value="'.$versionnumber.'">'.$versionnumber.'</option>';
248 248
 				}
249
-				$GLOBALS['setup_tpl']->set_var('select_version',$s);
249
+				$GLOBALS['setup_tpl']->set_var('select_version', $s);
250 250
 
251
-				if($value['name'])
251
+				if ($value['name'])
252 252
 				{
253 253
 					$i = $i ? 0 : 1;
254
-					$GLOBALS['setup_tpl']->set_var('apptitle',$value['title']);
255
-					$GLOBALS['setup_tpl']->set_var('currentver',$value['currentver']);
256
-					$GLOBALS['setup_tpl']->set_var('bg_color',$bgcolor[$i]);
254
+					$GLOBALS['setup_tpl']->set_var('apptitle', $value['title']);
255
+					$GLOBALS['setup_tpl']->set_var('currentver', $value['currentver']);
256
+					$GLOBALS['setup_tpl']->set_var('bg_color', $bgcolor[$i]);
257 257
 
258
-					$GLOBALS['setup_tpl']->set_var('instimg','completed.png');
259
-					$GLOBALS['setup_tpl']->set_var('instalt',lang('Completed'));
260
-					$GLOBALS['setup_tpl']->set_var('install','<input type="checkbox" name="install[' . $value['name'] . ']" />');
261
-					$status = lang('OK') . ' - ' . $value['status'];
258
+					$GLOBALS['setup_tpl']->set_var('instimg', 'completed.png');
259
+					$GLOBALS['setup_tpl']->set_var('instalt', lang('Completed'));
260
+					$GLOBALS['setup_tpl']->set_var('install', '<input type="checkbox" name="install['.$value['name'].']" />');
261
+					$status = lang('OK').' - '.$value['status'];
262 262
 
263
-					$GLOBALS['setup_tpl']->set_var('appinfo',$value['name'] . '-' . $status);
264
-					$GLOBALS['setup_tpl']->set_var('appname',$value['name']);
263
+					$GLOBALS['setup_tpl']->set_var('appinfo', $value['name'].'-'.$status);
264
+					$GLOBALS['setup_tpl']->set_var('appname', $value['name']);
265 265
 
266
-					$GLOBALS['setup_tpl']->pparse('out','apps',True);
266
+					$GLOBALS['setup_tpl']->pparse('out', 'apps', True);
267 267
 				}
268 268
 			}
269 269
 		}
270 270
 	}
271
-	$GLOBALS['setup_tpl']->set_var('submit',lang('Save'));
272
-	$GLOBALS['setup_tpl']->set_var('cancel',lang('Cancel'));
273
-	$GLOBALS['setup_tpl']->pparse('out','app_footer');
274
-	$GLOBALS['setup_tpl']->pparse('out','footer');
271
+	$GLOBALS['setup_tpl']->set_var('submit', lang('Save'));
272
+	$GLOBALS['setup_tpl']->set_var('cancel', lang('Cancel'));
273
+	$GLOBALS['setup_tpl']->pparse('out', 'app_footer');
274
+	$GLOBALS['setup_tpl']->pparse('out', 'footer');
275 275
 	$GLOBALS['egw_setup']->html->show_footer();
276 276
 ?>
Please login to merge, or discard this patch.
setup/fix_mysql_charset.php 2 patches
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 // if we are NOT called as part of an update script, behave like a regular setup script
13 13
 if (!isset($GLOBALS['egw_setup']) || !is_object($GLOBALS['egw_setup']))
14 14
 {
15
-	$diagnostics = 1;	// can be set to 0=non, 1=some (default for now), 2=all
15
+	$diagnostics = 1; // can be set to 0=non, 1=some (default for now), 2=all
16 16
 
17 17
 	include('./inc/functions.inc.php');
18 18
 	// Authorize the user to use setup app and load the database
@@ -25,50 +25,50 @@  discard block
 block discarded – undo
25 25
 	$GLOBALS['egw_setup']->loaddb();
26 26
 
27 27
 	$tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup');
28
-	$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
28
+	$setup_tpl = CreateObject('phpgwapi.Template', $tpl_root);
29 29
 	$setup_tpl->set_file(array(
30 30
 		'T_head' => 'head.tpl',
31 31
 		'T_footer' => 'footer.tpl',
32 32
 	));
33
-	$GLOBALS['egw_setup']->html->show_header('',False,'config',$GLOBALS['egw_setup']->ConfigDomain . '(' . $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'] . ')');
33
+	$GLOBALS['egw_setup']->html->show_header('', False, 'config', $GLOBALS['egw_setup']->ConfigDomain.'('.$GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'].')');
34 34
 	echo '<h3>'.'Fix mysql DB to match the eGroupWare system_charset'."</h3>\n";
35 35
 	$running_standalone = true;
36 36
 }
37
-$db =& $GLOBALS['egw_setup']->db;
38
-$charset2mysql =& $GLOBALS['egw_setup']->db->Link_ID->charset2mysql;
37
+$db = & $GLOBALS['egw_setup']->db;
38
+$charset2mysql = & $GLOBALS['egw_setup']->db->Link_ID->charset2mysql;
39 39
 $mysql2charset = array_flip($charset2mysql);
40 40
 
41 41
 $ServerInfo = $db->Link_ID->ServerInfo();
42
-$db_version = (float) $ServerInfo['version'];
42
+$db_version = (float)$ServerInfo['version'];
43 43
 
44 44
 if ($running_standalone || $_REQUEST['debug']) echo "<p>DB-Type='<b>{$GLOBALS['egw_setup']->db->Type}</b>', DB-Version=<b>$db_version</b> ($ServerInfo[description]), eGroupWare system_charset='<b>{$GLOBALS['egw_setup']->system_charset}</b>', DB-connection charset was '<b>{$GLOBALS['egw_setup']->db_charset_was}</b>'</p>\n";
45 45
 
46 46
 $mysql_system_charset = isset($charset2mysql[$GLOBALS['egw_setup']->system_charset]) ?
47 47
 	$charset2mysql[$GLOBALS['egw_setup']->system_charset] : $GLOBALS['egw_setup']->system_charset;
48 48
 
49
-if (substr($db->Type,0,5) == 'mysql' && $db_version >= 4.1 && $GLOBALS['egw_setup']->system_charset && $GLOBALS['egw_setup']->db_charset_was &&
49
+if (substr($db->Type, 0, 5) == 'mysql' && $db_version >= 4.1 && $GLOBALS['egw_setup']->system_charset && $GLOBALS['egw_setup']->db_charset_was &&
50 50
 	$GLOBALS['egw_setup']->system_charset != $GLOBALS['egw_setup']->db_charset_was)
51 51
 {
52 52
 	$tables_modified = 'no';
53 53
 
54 54
 	$tables = array();
55
-	$db->query("SHOW TABLE STATUS",__LINE__,__FILE__);
55
+	$db->query("SHOW TABLE STATUS", __LINE__, __FILE__);
56 56
 	while (($row = $db->row(true)))
57 57
 	{
58 58
 		$tables[$row['Name']] = $row['Collation'];
59 59
 	}
60
-	foreach($tables as $table => $collation)
60
+	foreach ($tables as $table => $collation)
61 61
 	{
62 62
 		$columns = array();
63
-		$db->query("SHOW FULL FIELDS FROM `$table`",__LINE__,__FILE__);
64
-		while(($row = $db->row(true)))
63
+		$db->query("SHOW FULL FIELDS FROM `$table`", __LINE__, __FILE__);
64
+		while (($row = $db->row(true)))
65 65
 		{
66 66
 			$columns[] = $row;
67 67
 		}
68 68
 		//echo $table; _debug_array($columns);
69 69
 		$fulltext = $fulltext_back = array();
70
-		$db->query("SHOW KEYS FROM `$table`",__LINE__,__FILE__);
71
-		while(($row = $db->row(true)))
70
+		$db->query("SHOW KEYS FROM `$table`", __LINE__, __FILE__);
71
+		while (($row = $db->row(true)))
72 72
 		{
73 73
 			if ($row['Index_type'] == 'FULLTEXT')
74 74
 			{
@@ -77,12 +77,12 @@  discard block
 block discarded – undo
77 77
 		}
78 78
 
79 79
 		$alter_table = $alter_table_back = array();
80
-		foreach($columns as $column)
80
+		foreach ($columns as $column)
81 81
 		{
82
-			if ($column['Collation'] && preg_match('/^(char|varchar|.*text)\(?([0-9]*)\)?$/i',$column['Type'],$matches))
82
+			if ($column['Collation'] && preg_match('/^(char|varchar|.*text)\(?([0-9]*)\)?$/i', $column['Type'], $matches))
83 83
 			{
84
-				list(,$type,$size) = $matches;
85
-				list($charset) = explode('_',$column['Collation']);
84
+				list(,$type, $size) = $matches;
85
+				list($charset) = explode('_', $column['Collation']);
86 86
 
87 87
 				if (isset($mysql2charset[$charset])) $charset = $mysql2charset[$charset];
88 88
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 					}
98 98
 					else
99 99
 					{
100
-						$bintype = str_replace('text','blob',$type);
100
+						$bintype = str_replace('text', 'blob', $type);
101 101
 					}
102 102
 					//echo "<p>$table.$col $type CHARACTER SET $charset $default $null</p>\n";
103 103
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 					{
109 109
 						$idx_name = $fulltext[$col];
110 110
 						$idx_cols = array();
111
-						foreach($fulltext as $c => $i)
111
+						foreach ($fulltext as $c => $i)
112 112
 						{
113 113
 							if ($i == $idx_name)
114 114
 							{
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 				}
125 125
 			}
126 126
 		}
127
-		list($charset) = explode('_',$collation);
127
+		list($charset) = explode('_', $collation);
128 128
 		if (isset($mysql2charset[$charset])) $charset = $mysql2charset[$charset];
129 129
 		if ($charset != $GLOBALS['egw_setup']->system_charset)
130 130
 		{
@@ -132,26 +132,26 @@  discard block
 block discarded – undo
132 132
 		}
133 133
 		if (count($alter_table))
134 134
 		{
135
-			$alter_table = "ALTER TABLE $table\n".implode(",\n",$alter_table);
135
+			$alter_table = "ALTER TABLE $table\n".implode(",\n", $alter_table);
136 136
 
137 137
 			if ($running_standalone || $_REQUEST['debug']) echo '<p>'.nl2br($alter_table)."</p>\n";
138
-			if (!$db->query($alter_table,__LINE__,__FILE__))
138
+			if (!$db->query($alter_table, __LINE__, __FILE__))
139 139
 			{
140 140
 				echo "<p>SQL Error: ".nl2br($alter_table)."</p>\n";
141 141
 				echo "<b>{$db->Type} Error</b>: {$db->Errno} ({$db->Error})</p>\n";
142 142
 				echo "<p>continuing ...</p>\n";
143 143
 				continue;
144 144
 			}
145
-			foreach($fulltext_back as $idx_name => $idx_cols)
145
+			foreach ($fulltext_back as $idx_name => $idx_cols)
146 146
 			{
147
-				$alter_table_back[] = " ADD FULLTEXT `$idx_name` (`".implode('`,`',$idx_cols)."`)";
147
+				$alter_table_back[] = " ADD FULLTEXT `$idx_name` (`".implode('`,`', $idx_cols)."`)";
148 148
 			}
149 149
 			if (count($alter_table_back))
150 150
 			{
151
-				$alter_table_back = "ALTER TABLE $table\n".implode(",\n",$alter_table_back);
151
+				$alter_table_back = "ALTER TABLE $table\n".implode(",\n", $alter_table_back);
152 152
 
153 153
 				if ($running_standalone || $_REQUEST['debug']) echo '<p>'.nl2br($alter_table_back)."</p>\n";
154
-				if (!$db->query($alter_table_back,__LINE__,__FILE__))
154
+				if (!$db->query($alter_table_back, __LINE__, __FILE__))
155 155
 				{
156 156
 					echo "<p><b>SQL Error</b>: ".nl2br($alter_table_back)."</p>\n";
157 157
 					echo "<b>{$db->Type} Error</b>: {$db->Errno} ({$db->Error})</p>\n";
@@ -163,13 +163,13 @@  discard block
 block discarded – undo
163 163
 		}
164 164
 	}
165 165
 	// change the default charset of the DB
166
-	$db->query("SHOW CREATE DATABASE `$db->Database`",__LINE__,__FILE__);
166
+	$db->query("SHOW CREATE DATABASE `$db->Database`", __LINE__, __FILE__);
167 167
 	$create_db = $db->next_record() ? $db->f(1) : '';
168
-	if (preg_match('/CHARACTER SET ([a-z1-9_-]+) /i',$create_db,$matches) && $matches[1] != $mysql_system_charset)
168
+	if (preg_match('/CHARACTER SET ([a-z1-9_-]+) /i', $create_db, $matches) && $matches[1] != $mysql_system_charset)
169 169
 	{
170 170
 		$alter_db = "ALTER DATABASE `$db->Database` DEFAULT CHARACTER SET $mysql_system_charset";
171 171
 		if ($running_standalone || $_REQUEST['debug']) echo '<p>'.$alter_db."</p>\n";
172
-		$db->query($alter_db,__LINE__,__FILE__);
172
+		$db->query($alter_db, __LINE__, __FILE__);
173 173
 	}
174 174
 }
175 175
 if ($running_standalone || $_REQUEST['debug'])
Please login to merge, or discard this patch.
Braces   +33 added lines, -9 removed lines patch added patch discarded remove patch
@@ -41,7 +41,10 @@  discard block
 block discarded – undo
41 41
 $ServerInfo = $db->Link_ID->ServerInfo();
42 42
 $db_version = (float) $ServerInfo['version'];
43 43
 
44
-if ($running_standalone || $_REQUEST['debug']) echo "<p>DB-Type='<b>{$GLOBALS['egw_setup']->db->Type}</b>', DB-Version=<b>$db_version</b> ($ServerInfo[description]), eGroupWare system_charset='<b>{$GLOBALS['egw_setup']->system_charset}</b>', DB-connection charset was '<b>{$GLOBALS['egw_setup']->db_charset_was}</b>'</p>\n";
44
+if ($running_standalone || $_REQUEST['debug'])
45
+{
46
+	echo "<p>DB-Type='<b>{$GLOBALS['egw_setup']->db->Type}</b>', DB-Version=<b>$db_version</b> ($ServerInfo[description]), eGroupWare system_charset='<b>{$GLOBALS['egw_setup']->system_charset}</b>', DB-connection charset was '<b>{$GLOBALS['egw_setup']->db_charset_was}</b>'</p>\n";
47
+}
45 48
 
46 49
 $mysql_system_charset = isset($charset2mysql[$GLOBALS['egw_setup']->system_charset]) ?
47 50
 	$charset2mysql[$GLOBALS['egw_setup']->system_charset] : $GLOBALS['egw_setup']->system_charset;
@@ -84,15 +87,21 @@  discard block
 block discarded – undo
84 87
 				list(,$type,$size) = $matches;
85 88
 				list($charset) = explode('_',$column['Collation']);
86 89
 
87
-				if (isset($mysql2charset[$charset])) $charset = $mysql2charset[$charset];
90
+				if (isset($mysql2charset[$charset]))
91
+				{
92
+					$charset = $mysql2charset[$charset];
93
+				}
88 94
 
89 95
 				if ($charset != $GLOBALS['egw_setup']->system_charset)
90 96
 				{
91 97
 					$col = $column['Field'];
92 98
 
93
-					if ($type == 'varchar' || $type == 'char')	// old schema_proc (pre 1.0.1) used also char
99
+					if ($type == 'varchar' || $type == 'char')
100
+					{
101
+						// old schema_proc (pre 1.0.1) used also char
94 102
 					{
95 103
 						$type = 'varchar('.$size.')';
104
+					}
96 105
 						$bintype = 'varbinary('.$size.')';
97 106
 					}
98 107
 					else
@@ -125,7 +134,10 @@  discard block
 block discarded – undo
125 134
 			}
126 135
 		}
127 136
 		list($charset) = explode('_',$collation);
128
-		if (isset($mysql2charset[$charset])) $charset = $mysql2charset[$charset];
137
+		if (isset($mysql2charset[$charset]))
138
+		{
139
+			$charset = $mysql2charset[$charset];
140
+		}
129 141
 		if ($charset != $GLOBALS['egw_setup']->system_charset)
130 142
 		{
131 143
 			$alter_table[] = " DEFAULT CHARACTER SET $mysql_system_charset";
@@ -134,7 +146,10 @@  discard block
 block discarded – undo
134 146
 		{
135 147
 			$alter_table = "ALTER TABLE $table\n".implode(",\n",$alter_table);
136 148
 
137
-			if ($running_standalone || $_REQUEST['debug']) echo '<p>'.nl2br($alter_table)."</p>\n";
149
+			if ($running_standalone || $_REQUEST['debug'])
150
+			{
151
+				echo '<p>'.nl2br($alter_table)."</p>\n";
152
+			}
138 153
 			if (!$db->query($alter_table,__LINE__,__FILE__))
139 154
 			{
140 155
 				echo "<p>SQL Error: ".nl2br($alter_table)."</p>\n";
@@ -150,7 +165,10 @@  discard block
 block discarded – undo
150 165
 			{
151 166
 				$alter_table_back = "ALTER TABLE $table\n".implode(",\n",$alter_table_back);
152 167
 
153
-				if ($running_standalone || $_REQUEST['debug']) echo '<p>'.nl2br($alter_table_back)."</p>\n";
168
+				if ($running_standalone || $_REQUEST['debug'])
169
+				{
170
+					echo '<p>'.nl2br($alter_table_back)."</p>\n";
171
+				}
154 172
 				if (!$db->query($alter_table_back,__LINE__,__FILE__))
155 173
 				{
156 174
 					echo "<p><b>SQL Error</b>: ".nl2br($alter_table_back)."</p>\n";
@@ -168,7 +186,10 @@  discard block
 block discarded – undo
168 186
 	if (preg_match('/CHARACTER SET ([a-z1-9_-]+) /i',$create_db,$matches) && $matches[1] != $mysql_system_charset)
169 187
 	{
170 188
 		$alter_db = "ALTER DATABASE `$db->Database` DEFAULT CHARACTER SET $mysql_system_charset";
171
-		if ($running_standalone || $_REQUEST['debug']) echo '<p>'.$alter_db."</p>\n";
189
+		if ($running_standalone || $_REQUEST['debug'])
190
+		{
191
+			echo '<p>'.$alter_db."</p>\n";
192
+		}
172 193
 		$db->query($alter_db,__LINE__,__FILE__);
173 194
 	}
174 195
 }
@@ -176,5 +197,8 @@  discard block
 block discarded – undo
176 197
 {
177 198
 	echo "<p>$tables_modified tables changed to our system_charset {$GLOBALS['egw_setup']->system_charset}($mysql_system_charset)</p>\n";
178 199
 
179
-	if ($running_standalone) $GLOBALS['egw_setup']->html->show_footer();
180
-}
200
+	if ($running_standalone)
201
+	{
202
+		$GLOBALS['egw_setup']->html->show_footer();
203
+	}
204
+	}
Please login to merge, or discard this patch.
setup/manageheader.php 2 patches
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 require_once('./inc/class.setup_header.inc.php');
19 19
 $GLOBALS['egw_setup']->header = new setup_header();
20 20
 
21
-$setup_tpl = new Framework\Template('./templates/default', 'keep');	// 'keep' to keep our {hash} prefix of passwords
21
+$setup_tpl = new Framework\Template('./templates/default', 'keep'); // 'keep' to keep our {hash} prefix of passwords
22 22
 $setup_tpl->set_file(array(
23 23
 	'T_head' => 'head.tpl',
24 24
 	'T_footer' => 'footer.tpl',
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 	'T_login_stage_header' => 'login_stage_header.tpl',
28 28
 	'T_setup_manage' => 'manageheader.tpl'
29 29
 ));
30
-$setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain');
31
-$setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain');
32
-$setup_tpl->set_block('T_setup_manage','manageheader','manageheader');
33
-$setup_tpl->set_block('T_setup_manage','domain','domain');
30
+$setup_tpl->set_block('T_login_stage_header', 'B_multi_domain', 'V_multi_domain');
31
+$setup_tpl->set_block('T_login_stage_header', 'B_single_domain', 'V_single_domain');
32
+$setup_tpl->set_block('T_setup_manage', 'manageheader', 'manageheader');
33
+$setup_tpl->set_block('T_setup_manage', 'domain', 'domain');
34 34
 
35 35
 $setup_tpl->set_var(array(
36 36
 	'lang_select' => '',
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
 
45 45
 if ($GLOBALS['egw_info']['setup']['stage']['header'] > 2 && !$GLOBALS['egw_setup']->auth('Header'))
46 46
 {
47
-	$GLOBALS['egw_setup']->html->show_header('Please login',True);
47
+	$GLOBALS['egw_setup']->html->show_header('Please login', True);
48 48
 	$GLOBALS['egw_setup']->html->login_form();
49 49
 	$GLOBALS['egw_setup']->html->show_footer();
50 50
 	exit;
51 51
 }
52 52
 // Detect current mode
53
-switch($GLOBALS['egw_info']['setup']['stage']['header'])
53
+switch ($GLOBALS['egw_info']['setup']['stage']['header'])
54 54
 {
55 55
 	case '1':
56 56
 		$GLOBALS['egw_info']['setup']['HeaderFormMSG'] = lang('Create your header.inc.php');
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 }
87 87
 if (isset($_POST['setting']))	// Post of the header-form
88 88
 {
89
-	$validation_errors = check_header_form();	// validate the submitted form
89
+	$validation_errors = check_header_form(); // validate the submitted form
90 90
 }
91 91
 if (!isset($_POST['action']) || $validation_errors)	// generate form to edit the header
92 92
 {
@@ -94,25 +94,25 @@  discard block
 block discarded – undo
94 94
 }
95 95
 else
96 96
 {
97
-	$newheader = $GLOBALS['egw_setup']->header->generate($GLOBALS['egw_info'],$GLOBALS['egw_domain']);
97
+	$newheader = $GLOBALS['egw_setup']->header->generate($GLOBALS['egw_info'], $GLOBALS['egw_domain']);
98 98
 
99 99
 	list($action) = @each($_POST['action']);
100
-	switch($action)
100
+	switch ($action)
101 101
 	{
102 102
 		case 'download':
103
-			Api\Header\Content::type('header.inc.php','application/octet-stream');
103
+			Api\Header\Content::type('header.inc.php', 'application/octet-stream');
104 104
 			echo $newheader;
105 105
 			break;
106 106
 
107 107
 		case 'view':
108 108
 			$GLOBALS['egw_setup']->html->show_header('Generated header.inc.php', False, 'header');
109 109
 			echo '<table width="90%"><tr><td>';
110
-			echo '<br />' . lang('Save this text as contents of your header.inc.php') . '<br /><hr />';
110
+			echo '<br />'.lang('Save this text as contents of your header.inc.php').'<br /><hr />';
111 111
 			echo "<pre>\n";
112 112
 			echo htmlentities($newheader);
113 113
 			echo "\n</pre><hr />\n";
114 114
 			echo '<form action="index.php" method="post">';
115
-			echo '<br />' . lang('After retrieving the file, put it into place as the header.inc.php.  Then, click "continue".') . '<br />';
115
+			echo '<br />'.lang('After retrieving the file, put it into place as the header.inc.php.  Then, click "continue".').'<br />';
116 116
 			echo '<input type="hidden" name="FormLogout" value="header" />';
117 117
 			echo '<input type="submit" name="junk" value="'.lang('Continue').'" />';
118 118
 			echo '</form>';
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
 
123 123
 		case 'write':
124 124
 			if ((is_writeable('../header.inc.php') || !file_exists('../header.inc.php') && is_writeable('../')) &&
125
-				($f = fopen('../header.inc.php','wb')))
125
+				($f = fopen('../header.inc.php', 'wb')))
126 126
 			{
127
-				fwrite($f,$newheader);
127
+				fwrite($f, $newheader);
128 128
 				fclose($f);
129 129
 				$GLOBALS['egw_setup']->html->show_header('Saved header.inc.php', False, 'header');
130 130
 				echo '<form action="index.php" method="post">';
131
-					echo '<br />' . lang('Created header.inc.php!');
131
+					echo '<br />'.lang('Created header.inc.php!');
132 132
 				echo '<input type="hidden" name="FormLogout" value="header" />';
133 133
 				echo '<input type="submit" name="junk" value="'.lang('Continue').'" />';
134 134
 				echo '</form>';
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 			else
139 139
 			{
140 140
 				$GLOBALS['egw_setup']->html->show_header('Error generating header.inc.php', False, 'header');
141
-				echo lang('Could not open header.inc.php for writing!') . '<br />' . "\n";
142
-				echo lang('Please check read/write permissions on directories, or back up and use another option.') . '<br />';
141
+				echo lang('Could not open header.inc.php for writing!').'<br />'."\n";
142
+				echo lang('Please check read/write permissions on directories, or back up and use another option.').'<br />';
143 143
 				$GLOBALS['egw_setup']->html->show_footer();
144 144
 			}
145 145
 			break;
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
 function check_header_form()
155 155
 {
156 156
 	// setting the non-domain settings from the posted content
157
-	foreach($_POST['setting'] as $name => $value)
157
+	foreach ($_POST['setting'] as $name => $value)
158 158
 	{
159 159
 		if (get_magic_quotes_gpc()) $value = stripslashes($value);
160 160
 
161
-		switch($name)
161
+		switch ($name)
162 162
 		{
163 163
 			case 'show_domain_selectbox':
164 164
 			case 'mcrypt_enabled':
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	}
176 176
 
177 177
 	// setting the domain settings from the posted content
178
-	foreach($_POST['domains'] as $key => $domain)
178
+	foreach ($_POST['domains'] as $key => $domain)
179 179
 	{
180 180
 		if ($_POST['deletedomain'][$key])
181 181
 		{
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 			continue;
185 185
 		}
186 186
 
187
-		foreach($_POST['setting_'.$key] as $name => $value)
187
+		foreach ($_POST['setting_'.$key] as $name => $value)
188 188
 		{
189 189
 			if (get_magic_quotes_gpc()) $value = stripslashes($value);
190 190
 
@@ -218,20 +218,20 @@  discard block
 block discarded – undo
218 218
 
219 219
 	$GLOBALS['egw_setup']->html->show_header($GLOBALS['egw_info']['setup']['HeaderFormMSG'], False, 'header');
220 220
 
221
-	if(empty($_REQUEST['ConfigLang']))
221
+	if (empty($_REQUEST['ConfigLang']))
222 222
 	{
223
-		$setup_tpl->set_var('lang_select','<tr><td colspan="2"><form action="manageheader.php" method="post">Please Select your language '.setup_html::lang_select(True,'en')."</form></td></tr>");
223
+		$setup_tpl->set_var('lang_select', '<tr><td colspan="2"><form action="manageheader.php" method="post">Please Select your language '.setup_html::lang_select(True, 'en')."</form></td></tr>");
224 224
 	}
225 225
 
226
-	$setup_tpl->set_var('pagemsg',$GLOBALS['egw_info']['setup']['PageMSG']);
226
+	$setup_tpl->set_var('pagemsg', $GLOBALS['egw_info']['setup']['PageMSG']);
227 227
 
228 228
 	// checking required PHP version
229
-	if ((float) PHP_VERSION < $GLOBALS['egw_setup']->required_php_version)
229
+	if ((float)PHP_VERSION < $GLOBALS['egw_setup']->required_php_version)
230 230
 	{
231
-		$GLOBALS['egw_setup']->html->show_header($GLOBALS['egw_info']['setup']['header_msg'],True);
231
+		$GLOBALS['egw_setup']->html->show_header($GLOBALS['egw_info']['setup']['header_msg'], True);
232 232
 		$GLOBALS['egw_setup']->html->show_alert_msg('Error',
233 233
 			lang('You are using PHP version %1. eGroupWare now requires %2 or later, recommended is PHP %3.',
234
-			PHP_VERSION,$GLOBALS['egw_setup']->required_php_version,$GLOBALS['egw_setup']->recommended_php_version));
234
+			PHP_VERSION, $GLOBALS['egw_setup']->required_php_version, $GLOBALS['egw_setup']->recommended_php_version));
235 235
 		$GLOBALS['egw_setup']->html->show_footer();
236 236
 		exit;
237 237
 	}
@@ -249,33 +249,33 @@  discard block
 block discarded – undo
249 249
 		exit;
250 250
 	}
251 251
 	$js_default_db_ports = 'var default_db_ports = new Array();'."\n";
252
-	foreach($GLOBALS['egw_setup']->header->default_db_ports as $db => $port)
252
+	foreach ($GLOBALS['egw_setup']->header->default_db_ports as $db => $port)
253 253
 	{
254 254
 		$js_default_db_ports .= '  default_db_ports["'.$db.'"]="'.$port.'";'."\n";
255 255
 	}
256
-	$setup_tpl->set_var('js_default_db_ports',$js_default_db_ports);
256
+	$setup_tpl->set_var('js_default_db_ports', $js_default_db_ports);
257 257
 
258
-	if ($validation_errors) $setup_tpl->set_var('detected','<ul><li>'.implode("</li>\n<li>",$validation_errors)."</li>\n</ul>\n");
258
+	if ($validation_errors) $setup_tpl->set_var('detected', '<ul><li>'.implode("</li>\n<li>", $validation_errors)."</li>\n</ul>\n");
259 259
 
260 260
 	if ($_POST['adddomain'])
261 261
 	{
262 262
 		$GLOBALS['egw_domain'][lang('new')] = $GLOBALS['egw_setup']->header->domain_defaults(
263 263
 			$GLOBALS['egw_info']['server']['header_admin_user'],
264
-			$GLOBALS['egw_info']['server']['header_admin_password'],$supported_db);
264
+			$GLOBALS['egw_info']['server']['header_admin_password'], $supported_db);
265 265
 	}
266 266
 	// show the non-domain settings
267 267
 	//echo "<pre>".print_r($GLOBALS['egw_info']['server'],true)."</pre>\n";
268
-	foreach($GLOBALS['egw_info']['server'] as $name => $value)
268
+	foreach ($GLOBALS['egw_info']['server'] as $name => $value)
269 269
 	{
270
-		switch($name)
270
+		switch ($name)
271 271
 		{
272 272
 			case 'db_persistent':
273 273
 			case 'show_domain_selectbox':
274 274
 			case 'mcrypt_enabled':
275
-				$setup_tpl->set_var($name.($GLOBALS['egw_info']['server'][$name] ? '_yes' : '_no'),' selected="selected"');
275
+				$setup_tpl->set_var($name.($GLOBALS['egw_info']['server'][$name] ? '_yes' : '_no'), ' selected="selected"');
276 276
 				break;
277 277
 			default:
278
-				if (!is_array($value)) $setup_tpl->set_var($name,htmlspecialchars($value));
278
+				if (!is_array($value)) $setup_tpl->set_var($name, htmlspecialchars($value));
279 279
 				break;
280 280
 		}
281 281
 	}
@@ -284,48 +284,48 @@  discard block
 block discarded – undo
284 284
 	);
285 285
 	if ($GLOBALS['egw_info']['server']['session_handler'] && !isset($supported_session_handler[$GLOBALS['egw_info']['server']['session_handler']]))
286 286
 	{
287
-		$supported_session_handler[$GLOBALS['egw_info']['server']['session_handler']] = lang("Custom handler: %1",$GLOBALS['egw_info']['server']['session_handler']);
287
+		$supported_session_handler[$GLOBALS['egw_info']['server']['session_handler']] = lang("Custom handler: %1", $GLOBALS['egw_info']['server']['session_handler']);
288 288
 	}
289 289
 	$options = array();
290
-	foreach($supported_session_handler as $type => $label)
290
+	foreach ($supported_session_handler as $type => $label)
291 291
 	{
292
-		$options[] = '<option ' . ($type == $GLOBALS['egw_info']['server']['session_handler'] ?
293
-			'selected="selected" ' : '') . 'value="' . $type . '">' . $label . '</option>';
292
+		$options[] = '<option '.($type == $GLOBALS['egw_info']['server']['session_handler'] ?
293
+			'selected="selected" ' : '').'value="'.$type.'">'.$label.'</option>';
294 294
 	}
295
-	$setup_tpl->set_var('session_options',implode("\n",$options));
295
+	$setup_tpl->set_var('session_options', implode("\n", $options));
296 296
 
297 297
 	// showing the settings of all domains
298
-	foreach($GLOBALS['egw_domain'] as $domain => $data)
298
+	foreach ($GLOBALS['egw_domain'] as $domain => $data)
299 299
 	{
300
-		$setup_tpl->set_var('db_domain',htmlspecialchars($domain));
301
-		foreach($data as $name => $value)
300
+		$setup_tpl->set_var('db_domain', htmlspecialchars($domain));
301
+		foreach ($data as $name => $value)
302 302
 		{
303 303
 			if ($name == 'db_port' && !$value)	// Set default here if the admin didn't set a port yet
304 304
 			{
305 305
 				$value = $GLOBALS['egw_setup']->header->default_db_ports[$data['db_type']];
306 306
 			}
307
-			$setup_tpl->set_var($name,htmlspecialchars($value));
307
+			$setup_tpl->set_var($name, htmlspecialchars($value));
308 308
 		}
309 309
 		$dbtype_options = '';
310
-		foreach($supported_db as $db)
310
+		foreach ($supported_db as $db)
311 311
 		{
312
-			$dbtype_options .= '<option ' . ($db == $data['db_type'] ? 'selected="selected" ' : '').
313
-				'value="' . $db . '">' . $GLOBALS['egw_setup']->header->db_fullnames[$db] . "</option>\n";
312
+			$dbtype_options .= '<option '.($db == $data['db_type'] ? 'selected="selected" ' : '').
313
+				'value="'.$db.'">'.$GLOBALS['egw_setup']->header->db_fullnames[$db]."</option>\n";
314 314
 		}
315
-		$setup_tpl->set_var('dbtype_options',$dbtype_options);
315
+		$setup_tpl->set_var('dbtype_options', $dbtype_options);
316 316
 
317
-		$setup_tpl->parse('domains','domain',True);
317
+		$setup_tpl->parse('domains', 'domain', True);
318 318
 	}
319
-	if(is_writeable('../header.inc.php') || !file_exists('../header.inc.php') && is_writeable('../'))
319
+	if (is_writeable('../header.inc.php') || !file_exists('../header.inc.php') && is_writeable('../'))
320 320
 	{
321
-		$setup_tpl->set_var('actions',lang('%1, %2 or %3 the configuration file.',
321
+		$setup_tpl->set_var('actions', lang('%1, %2 or %3 the configuration file.',
322 322
 			'<input type="submit" name="action[write]" value="'.htmlspecialchars(lang('Write')).'" />',
323 323
 			'<input type="submit" name="action[download]" value="'.htmlspecialchars(lang('Download')).'" />',
324 324
 			'<input type="submit" name="action[view]" value="'.htmlspecialchars(lang('View')).'" />'));
325 325
 	}
326 326
 	else
327 327
 	{
328
-		$setup_tpl->set_var('actions',lang('Cannot create the header.inc.php due to file permission restrictions.<br /> Instead you can %1 or %2 the file.',
328
+		$setup_tpl->set_var('actions', lang('Cannot create the header.inc.php due to file permission restrictions.<br /> Instead you can %1 or %2 the file.',
329 329
 			'<input type="submit" name="action[download]" value="'.htmlspecialchars(lang('Download')).'" />',
330 330
 			'<input type="submit" name="action[view]" value="'.htmlspecialchars(lang('View')).'" />'));
331 331
 	}
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 		'lang_Yes'             => lang('Yes'),
388 388
 		'lang_No'              => lang('No')
389 389
 	));
390
-	$setup_tpl->pfp('out','manageheader');
390
+	$setup_tpl->pfp('out', 'manageheader');
391 391
 
392 392
 	$GLOBALS['egw_setup']->html->show_footer();
393 393
 }
Please login to merge, or discard this patch.
Braces   +38 added lines, -10 removed lines patch added patch discarded remove patch
@@ -84,14 +84,21 @@  discard block
 block discarded – undo
84 84
 {
85 85
 	$GLOBALS['egw_info']['server']['server_root'] = EGW_SERVER_ROOT;
86 86
 }
87
-if (isset($_POST['setting']))	// Post of the header-form
87
+if (isset($_POST['setting']))
88 88
 {
89
-	$validation_errors = check_header_form();	// validate the submitted form
89
+	// Post of the header-form
90
+{
91
+	$validation_errors = check_header_form();
92
+}
93
+// validate the submitted form
90 94
 }
91
-if (!isset($_POST['action']) || $validation_errors)	// generate form to edit the header
95
+if (!isset($_POST['action']) || $validation_errors)
96
+{
97
+	// generate form to edit the header
92 98
 {
93 99
 	show_header_form($validation_errors);
94 100
 }
101
+}
95 102
 else
96 103
 {
97 104
 	$newheader = $GLOBALS['egw_setup']->header->generate($GLOBALS['egw_info'],$GLOBALS['egw_domain']);
@@ -156,7 +163,10 @@  discard block
 block discarded – undo
156 163
 	// setting the non-domain settings from the posted content
157 164
 	foreach($_POST['setting'] as $name => $value)
158 165
 	{
159
-		if (get_magic_quotes_gpc()) $value = stripslashes($value);
166
+		if (get_magic_quotes_gpc())
167
+		{
168
+			$value = stripslashes($value);
169
+		}
160 170
 
161 171
 		switch($name)
162 172
 		{
@@ -166,7 +176,10 @@  discard block
 block discarded – undo
166 176
 				$GLOBALS['egw_info']['server'][$name] = $value == 'True';
167 177
 				break;
168 178
 			case 'new_admin_password':
169
-				if ($value) $GLOBALS['egw_info']['server']['header_admin_password'] = $value;
179
+				if ($value)
180
+				{
181
+					$GLOBALS['egw_info']['server']['header_admin_password'] = $value;
182
+				}
170 183
 				break;
171 184
 			default:
172 185
 				$GLOBALS['egw_info']['server'][$name] = $value;
@@ -186,11 +199,17 @@  discard block
 block discarded – undo
186 199
 
187 200
 		foreach($_POST['setting_'.$key] as $name => $value)
188 201
 		{
189
-			if (get_magic_quotes_gpc()) $value = stripslashes($value);
202
+			if (get_magic_quotes_gpc())
203
+			{
204
+				$value = stripslashes($value);
205
+			}
190 206
 
191 207
 			if ($name == 'new_config_passwd')
192 208
 			{
193
-				if ($value) $GLOBALS['egw_domain'][$domain]['config_passwd'] = $value;
209
+				if ($value)
210
+				{
211
+					$GLOBALS['egw_domain'][$domain]['config_passwd'] = $value;
212
+				}
194 213
 				continue;
195 214
 			}
196 215
 			$GLOBALS['egw_domain'][$domain][$name] = $value;
@@ -255,7 +274,10 @@  discard block
 block discarded – undo
255 274
 	}
256 275
 	$setup_tpl->set_var('js_default_db_ports',$js_default_db_ports);
257 276
 
258
-	if ($validation_errors) $setup_tpl->set_var('detected','<ul><li>'.implode("</li>\n<li>",$validation_errors)."</li>\n</ul>\n");
277
+	if ($validation_errors)
278
+	{
279
+		$setup_tpl->set_var('detected','<ul><li>'.implode("</li>\n<li>",$validation_errors)."</li>\n</ul>\n");
280
+	}
259 281
 
260 282
 	if ($_POST['adddomain'])
261 283
 	{
@@ -275,7 +297,10 @@  discard block
 block discarded – undo
275 297
 				$setup_tpl->set_var($name.($GLOBALS['egw_info']['server'][$name] ? '_yes' : '_no'),' selected="selected"');
276 298
 				break;
277 299
 			default:
278
-				if (!is_array($value)) $setup_tpl->set_var($name,htmlspecialchars($value));
300
+				if (!is_array($value))
301
+				{
302
+					$setup_tpl->set_var($name,htmlspecialchars($value));
303
+				}
279 304
 				break;
280 305
 		}
281 306
 	}
@@ -300,10 +325,13 @@  discard block
 block discarded – undo
300 325
 		$setup_tpl->set_var('db_domain',htmlspecialchars($domain));
301 326
 		foreach($data as $name => $value)
302 327
 		{
303
-			if ($name == 'db_port' && !$value)	// Set default here if the admin didn't set a port yet
328
+			if ($name == 'db_port' && !$value)
329
+			{
330
+				// Set default here if the admin didn't set a port yet
304 331
 			{
305 332
 				$value = $GLOBALS['egw_setup']->header->default_db_ports[$data['db_type']];
306 333
 			}
334
+			}
307 335
 			$setup_tpl->set_var($name,htmlspecialchars($value));
308 336
 		}
309 337
 		$dbtype_options = '';
Please login to merge, or discard this patch.
setup/sqltoarray.php 2 patches
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 include('./inc/functions.inc.php');
22 22
 
23 23
 /* Check header and authentication */
24
-if(!$GLOBALS['egw_setup']->auth('Config'))
24
+if (!$GLOBALS['egw_setup']->auth('Config'))
25 25
 {
26 26
 	Header('Location: index.php');
27 27
 	exit;
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
 // Does not return unless user is authorized
30 30
 
31 31
 $tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup');
32
-$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
32
+$setup_tpl = CreateObject('phpgwapi.Template', $tpl_root);
33 33
 
34 34
 $cancel   = $_REQUEST['cancel'];
35
-if($cancel)
35
+if ($cancel)
36 36
 {
37 37
 	Header('Location: applications.php');
38 38
 	exit;
@@ -42,15 +42,15 @@  discard block
 block discarded – undo
42 42
 $submit   = $_REQUEST['submit'];
43 43
 $showall  = $_REQUEST['showall'];
44 44
 $appname  = $_REQUEST['appname'];
45
-if($download)
45
+if ($download)
46 46
 {
47 47
 	$setup_tpl->set_file(array(
48 48
 		'sqlarr'   => 'arraydl.tpl'
49 49
 	));
50
-	$setup_tpl->set_var('idstring',"/* \$Id" . ": tables_current.inc.php" . ",v 1.0" . " 2001/05/28 08:42:04 username " . "Exp \$ */");
51
-	$setup_tpl->set_block('sqlarr','sqlheader','sqlheader');
52
-	$setup_tpl->set_block('sqlarr','sqlbody','sqlbody');
53
-	$setup_tpl->set_block('sqlarr','sqlfooter','sqlfooter');
50
+	$setup_tpl->set_var('idstring', "/* \$Id".": tables_current.inc.php".",v 1.0"." 2001/05/28 08:42:04 username "."Exp \$ */");
51
+	$setup_tpl->set_block('sqlarr', 'sqlheader', 'sqlheader');
52
+	$setup_tpl->set_block('sqlarr', 'sqlbody', 'sqlbody');
53
+	$setup_tpl->set_block('sqlarr', 'sqlfooter', 'sqlfooter');
54 54
 }
55 55
 else
56 56
 {
@@ -66,44 +66,44 @@  discard block
 block discarded – undo
66 66
 		'T_head'   => 'head.tpl',
67 67
 		'T_footer' => 'footer.tpl'
68 68
 	));
69
-	$setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain');
70
-	$setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain');
71
-	$setup_tpl->set_block('T_setup_main','header','header');
72
-	$setup_tpl->set_block('applist','appheader','appheader');
73
-	$setup_tpl->set_block('applist','appitem','appitem');
74
-	$setup_tpl->set_block('applist','appfooter','appfooter');
75
-	$setup_tpl->set_block('sqlarr','sqlheader','sqlheader');
76
-	$setup_tpl->set_block('sqlarr','sqlbody','sqlbody');
77
-	$setup_tpl->set_block('sqlarr','sqlfooter','sqlfooter');
69
+	$setup_tpl->set_block('T_login_stage_header', 'B_multi_domain', 'V_multi_domain');
70
+	$setup_tpl->set_block('T_login_stage_header', 'B_single_domain', 'V_single_domain');
71
+	$setup_tpl->set_block('T_setup_main', 'header', 'header');
72
+	$setup_tpl->set_block('applist', 'appheader', 'appheader');
73
+	$setup_tpl->set_block('applist', 'appitem', 'appitem');
74
+	$setup_tpl->set_block('applist', 'appfooter', 'appfooter');
75
+	$setup_tpl->set_block('sqlarr', 'sqlheader', 'sqlheader');
76
+	$setup_tpl->set_block('sqlarr', 'sqlbody', 'sqlbody');
77
+	$setup_tpl->set_block('sqlarr', 'sqlfooter', 'sqlfooter');
78 78
 }
79 79
 
80 80
 $GLOBALS['egw_setup']->loaddb();
81 81
 
82
-function parse_vars($table,$term)
82
+function parse_vars($table, $term)
83 83
 {
84 84
 	$GLOBALS['setup_tpl']->set_var('table', $table);
85
-	$GLOBALS['setup_tpl']->set_var('term',$term);
85
+	$GLOBALS['setup_tpl']->set_var('term', $term);
86 86
 
87
-	list($arr,$pk,$fk,$ix,$uc) = $GLOBALS['egw_setup']->process->sql_to_array($table);
88
-	$GLOBALS['setup_tpl']->set_var('arr',$arr);
87
+	list($arr, $pk, $fk, $ix, $uc) = $GLOBALS['egw_setup']->process->sql_to_array($table);
88
+	$GLOBALS['setup_tpl']->set_var('arr', $arr);
89 89
 
90
-	foreach(array('pk','fk','ix','uc') as $kind)
90
+	foreach (array('pk', 'fk', 'ix', 'uc') as $kind)
91 91
 	{
92
-		$GLOBALS['setup_tpl']->set_var($kind.'s',_arr2str($$kind));
92
+		$GLOBALS['setup_tpl']->set_var($kind.'s', _arr2str($$kind));
93 93
 	}
94
-	unset($pk,$fk,$ix,$uc);
94
+	unset($pk, $fk, $ix, $uc);
95 95
 }
96 96
 
97 97
 function _arr2str($arr)
98 98
 {
99
-	if(!is_array($arr)) return $arr;
99
+	if (!is_array($arr)) return $arr;
100 100
 
101 101
 	$str = '';
102
-	foreach($arr as $key => $val)
102
+	foreach ($arr as $key => $val)
103 103
 	{
104
-		if($str) $str .= ',';
104
+		if ($str) $str .= ',';
105 105
 
106
-		if(!is_int($key))
106
+		if (!is_int($key))
107 107
 		{
108 108
 			$str .= "'$key' => ";
109 109
 		}
@@ -119,71 +119,71 @@  discard block
 block discarded – undo
119 119
 	$showall  = $_REQUEST['showall'];
120 120
 	$apps     = $GLOBALS['apps'] ? $GLOBALS['apps'] : '';
121 121
 
122
-	if($download)
122
+	if ($download)
123 123
 	{
124
-		$GLOBALS['setup_tpl']->set_var('appname',$appname);
125
-		$GLOBALS['setup_tpl']->set_var('apps',$apps);
126
-		$string = $GLOBALS['setup_tpl']->parse('out',$template);
124
+		$GLOBALS['setup_tpl']->set_var('appname', $appname);
125
+		$GLOBALS['setup_tpl']->set_var('apps', $apps);
126
+		$string = $GLOBALS['setup_tpl']->parse('out', $template);
127 127
 	}
128 128
 	else
129 129
 	{
130 130
 //			$url = $GLOBALS['appname'] ? 'applications.php' : 'sqltoarray.php';
131
-		$GLOBALS['setup_tpl']->set_var('appname',$appname);
132
-		$GLOBALS['setup_tpl']->set_var('lang_download',lang('Download'));
133
-		$GLOBALS['setup_tpl']->set_var('lang_cancel',lang('Cancel'));
134
-		$GLOBALS['setup_tpl']->set_var('showall',$showall);
135
-		$GLOBALS['setup_tpl']->set_var('apps',$apps);
136
-		$GLOBALS['setup_tpl']->set_var('action_url','sqltoarray.php');
137
-		$GLOBALS['setup_tpl']->pfp('out',$template);
131
+		$GLOBALS['setup_tpl']->set_var('appname', $appname);
132
+		$GLOBALS['setup_tpl']->set_var('lang_download', lang('Download'));
133
+		$GLOBALS['setup_tpl']->set_var('lang_cancel', lang('Cancel'));
134
+		$GLOBALS['setup_tpl']->set_var('showall', $showall);
135
+		$GLOBALS['setup_tpl']->set_var('apps', $apps);
136
+		$GLOBALS['setup_tpl']->set_var('action_url', 'sqltoarray.php');
137
+		$GLOBALS['setup_tpl']->pfp('out', $template);
138 138
 	}
139 139
 	return $string;
140 140
 }
141 141
 
142
-function download_handler($dlstring,$fn='tables_current.inc.php')
142
+function download_handler($dlstring, $fn = 'tables_current.inc.php')
143 143
 {
144 144
 	Api\Header\Content::type($fn);
145 145
 	echo $dlstring;
146 146
 	exit;
147 147
 }
148 148
 
149
-if($submit || $showall)
149
+if ($submit || $showall)
150 150
 {
151 151
 	$dlstring = '';
152 152
 	$term = '';
153 153
 
154
-	if(!$download)
154
+	if (!$download)
155 155
 	{
156 156
 		$GLOBALS['egw_setup']->html->show_header();
157 157
 	}
158 158
 
159
-	if($showall)
159
+	if ($showall)
160 160
 	{
161 161
 		$table = $appname = '';
162 162
 	}
163 163
 
164
-	if(!$table && !$appname)
164
+	if (!$table && !$appname)
165 165
 	{
166 166
 		$term = ',';
167 167
 		$dlstring .= printout('sqlheader');
168 168
 
169 169
 		$GLOBALS['egw_setup']->db->connect();
170
-		foreach($GLOBALS['egw_setup']->db->Link_ID->MetaTables() as $table)
170
+		foreach ($GLOBALS['egw_setup']->db->Link_ID->MetaTables() as $table)
171 171
 		{
172
-			parse_vars($table,$term);
172
+			parse_vars($table, $term);
173 173
 			$dlstring .= printout('sqlbody');
174 174
 		}
175 175
 		$dlstring .= printout('sqlfooter');
176 176
 
177 177
 	}
178
-	elseif($appname)
178
+	elseif ($appname)
179 179
 	{
180 180
 		$dlstring .= printout('sqlheader');
181 181
 		$term = ',';
182 182
 
183
-		if(!$setup_info[$appname]['tables'])
183
+		if (!$setup_info[$appname]['tables'])
184 184
 		{
185
-			$f = EGW_SERVER_ROOT . '/' . $appname . '/setup/setup.inc.php';
186
-			if(file_exists($f))
185
+			$f = EGW_SERVER_ROOT.'/'.$appname.'/setup/setup.inc.php';
186
+			if (file_exists($f))
187 187
 			{
188 188
 				include($f);
189 189
 			}
@@ -193,28 +193,28 @@  discard block
 block discarded – undo
193 193
 		$tables = $setup_info[$appname]['tables'];
194 194
 		$i = 0;
195 195
 		$tbls = count($tables);
196
-		while(list($key,$table) = @each($tables))
196
+		while (list($key, $table) = @each($tables))
197 197
 		{
198 198
 			$i++;
199
-			if($i == $tbls)
199
+			if ($i == $tbls)
200 200
 			{
201 201
 				$term = '';
202 202
 			}
203
-			parse_vars($table,$term);
203
+			parse_vars($table, $term);
204 204
 			$dlstring .= printout('sqlbody');
205 205
 			/* $i++; */
206 206
 		}
207 207
 		$dlstring .= printout('sqlfooter');
208 208
 	}
209
-	elseif($table)
209
+	elseif ($table)
210 210
 	{
211 211
 		$term = ';';
212
-		parse_vars($table,$term);
212
+		parse_vars($table, $term);
213 213
 		$dlstring .= printout('sqlheader');
214 214
 		$dlstring .= printout('sqlbody');
215 215
 		$dlstring .= printout('sqlfooter');
216 216
 	}
217
-	if($download)
217
+	if ($download)
218 218
 	{
219 219
 		download_handler($dlstring);
220 220
 	}
@@ -223,32 +223,32 @@  discard block
 block discarded – undo
223 223
 {
224 224
 	$GLOBALS['egw_setup']->html->show_header();
225 225
 
226
-	$setup_tpl->set_var('action_url','sqltoarray.php');
227
-	$setup_tpl->set_var('lang_submit','Show selected');
228
-	$setup_tpl->set_var('lang_showall','Show all');
229
-	$setup_tpl->set_var('title','SQL to schema_proc array util');
230
-	$setup_tpl->set_var('lang_applist','Applications');
231
-	$setup_tpl->set_var('select_to_download_file',lang('Select to download file'));
232
-	$setup_tpl->pfp('out','appheader');
226
+	$setup_tpl->set_var('action_url', 'sqltoarray.php');
227
+	$setup_tpl->set_var('lang_submit', 'Show selected');
228
+	$setup_tpl->set_var('lang_showall', 'Show all');
229
+	$setup_tpl->set_var('title', 'SQL to schema_proc array util');
230
+	$setup_tpl->set_var('lang_applist', 'Applications');
231
+	$setup_tpl->set_var('select_to_download_file', lang('Select to download file'));
232
+	$setup_tpl->pfp('out', 'appheader');
233 233
 
234 234
 	$d = dir(EGW_SERVER_ROOT);
235
-	while($entry = $d->read())
235
+	while ($entry = $d->read())
236 236
 	{
237
-		$f = EGW_SERVER_ROOT . '/' . $entry . '/setup/setup.inc.php';
238
-		if(file_exists($f))
237
+		$f = EGW_SERVER_ROOT.'/'.$entry.'/setup/setup.inc.php';
238
+		if (file_exists($f))
239 239
 		{
240 240
 			include($f);
241 241
 		}
242 242
 	}
243 243
 
244
-	while(list($key,$data) = @each($setup_info))
244
+	while (list($key, $data) = @each($setup_info))
245 245
 	{
246
-		if($data['tables'])
246
+		if ($data['tables'])
247 247
 		{
248
-			$setup_tpl->set_var('appname',$data['name']);
249
-			$setup_tpl->set_var('apptitle',$data['title']);
250
-			$setup_tpl->pfp('out','appitem');
248
+			$setup_tpl->set_var('appname', $data['name']);
249
+			$setup_tpl->set_var('apptitle', $data['title']);
250
+			$setup_tpl->pfp('out', 'appitem');
251 251
 		}
252 252
 	}
253
-	$setup_tpl->pfp('out','appfooter');
253
+	$setup_tpl->pfp('out', 'appfooter');
254 254
 }
Please login to merge, or discard this patch.
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,12 +96,18 @@
 block discarded – undo
96 96
 
97 97
 function _arr2str($arr)
98 98
 {
99
-	if(!is_array($arr)) return $arr;
99
+	if(!is_array($arr))
100
+	{
101
+		return $arr;
102
+	}
100 103
 
101 104
 	$str = '';
102 105
 	foreach($arr as $key => $val)
103 106
 	{
104
-		if($str) $str .= ',';
107
+		if($str)
108
+		{
109
+			$str .= ',';
110
+		}
105 111
 
106 112
 		if(!is_int($key))
107 113
 		{
Please login to merge, or discard this patch.
setup/inc/class.setup_translation.inc.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 if (!defined('MAX_MESSAGE_ID_LENGTH'))
17 17
 {
18
-	define('MAX_MESSAGE_ID_LENGTH',128);
18
+	define('MAX_MESSAGE_ID_LENGTH', 128);
19 19
 }
20 20
 
21 21
 // Define prefix for langfiles (historically 'phpgw_')
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 *
35 35
 	 * @var string
36 36
 	 */
37
-	var $no_translation_marker = '';//'*';
37
+	var $no_translation_marker = ''; //'*';
38 38
 
39 39
 	/**
40 40
 	 * constructor for the class, loads all phrases into langarray
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	{
46 46
 		$ConfigLang = setup::get_lang();
47 47
 
48
-		if(!$ConfigLang)
48
+		if (!$ConfigLang)
49 49
 		{
50 50
 			$lang = 'en';
51 51
 		}
@@ -54,18 +54,18 @@  discard block
 block discarded – undo
54 54
 			$lang = $ConfigLang;
55 55
 		}
56 56
 
57
-		$fn = './lang/' . EGW_LANGFILE_PREFIX . $lang . '.lang';
57
+		$fn = './lang/'.EGW_LANGFILE_PREFIX.$lang.'.lang';
58 58
 		if (!file_exists($fn))
59 59
 		{
60
-			$fn = './lang/' . EGW_LANGFILE_PREFIX .'en.lang';
60
+			$fn = './lang/'.EGW_LANGFILE_PREFIX.'en.lang';
61 61
 		}
62
-		if (file_exists($fn) && ($fp = fopen($fn,'r')))
62
+		if (file_exists($fn) && ($fp = fopen($fn, 'r')))
63 63
 		{
64
-			while (($data = fgets($fp,8000)))
64
+			while (($data = fgets($fp, 8000)))
65 65
 			{
66 66
 				// explode with "\t" and removing "\n" with str_replace, needed to work with mbstring.overload=7
67
-				list($message_id,,,$content) = explode("\t",$data);
68
-				$this->langarray[strtolower(trim($message_id))] = str_replace("\n",'',$content);
67
+				list($message_id,,, $content) = explode("\t", $data);
68
+				$this->langarray[strtolower(trim($message_id))] = str_replace("\n", '', $content);
69 69
 			}
70 70
 			fclose($fp);
71 71
 
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
 	 * @param $_key  phrase to translate
83 83
 	 * @param $vars vars sent to lang function, passed to us
84 84
 	 */
85
-	function translate($_key, $vars=False)
85
+	function translate($_key, $vars = False)
86 86
 	{
87
-		static $placeholders = array('%1','%2','%3','%4','%5','%6','%7','%8','%9','%10');
87
+		static $placeholders = array('%1', '%2', '%3', '%4', '%5', '%6', '%7', '%8', '%9', '%10');
88 88
 
89
-		$ret = $_key . $this->no_translation_marker;
89
+		$ret = $_key.$this->no_translation_marker;
90 90
 		$key = strtolower(trim($_key));
91 91
 		if (isset($this->langarray[$key]))
92 92
 		{
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		}
95 95
 		if ($GLOBALS['egw_setup']->system_charset != $this->langarray['charset'])
96 96
 		{
97
-			$ret = Api\Translation::convert($ret,$this->langarray['charset']);
97
+			$ret = Api\Translation::convert($ret, $this->langarray['charset']);
98 98
 		}
99 99
 		if (is_array($vars))
100 100
 		{
@@ -109,12 +109,12 @@  discard block
 block discarded – undo
109 109
 	 * @param boolean $array_values =true true: values are an array, false values are just the descriptiong
110 110
 	 * @return array
111 111
 	 */
112
-	static function get_supported_langs($array_values=true)
112
+	static function get_supported_langs($array_values = true)
113 113
 	{
114
-		$f = fopen(EGW_SERVER_ROOT.'/setup/lang/languages','rb');
115
-		while(($line = fgets($f)))
114
+		$f = fopen(EGW_SERVER_ROOT.'/setup/lang/languages', 'rb');
115
+		while (($line = fgets($f)))
116 116
 		{
117
-			list($lang2,$descr) = explode("\t",$line,2);
117
+			list($lang2, $descr) = explode("\t", $line, 2);
118 118
 			$lang = trim($lang2);
119 119
 			if ($array_values)
120 120
 			{
@@ -132,16 +132,16 @@  discard block
 block discarded – undo
132 132
 		if ($array_values)
133 133
 		{
134 134
 			$d = dir(EGW_SERVER_ROOT.'/setup/lang');
135
-			while(($file = $d->read()))
135
+			while (($file = $d->read()))
136 136
 			{
137 137
 				$matches = null;
138
-				if(preg_match('/^(php|e)gw_([-a-z]+).lang$/i',$file,$matches))
138
+				if (preg_match('/^(php|e)gw_([-a-z]+).lang$/i', $file, $matches))
139 139
 				{
140 140
 					$languages[$matches[2]]['available'] = True;
141 141
 				}
142 142
 			}
143 143
 			$d->close();
144
-			uasort($languages,create_function('$a,$b','return strcmp(@$a[\'descr\'],@$b[\'descr\']);'));
144
+			uasort($languages, create_function('$a,$b', 'return strcmp(@$a[\'descr\'],@$b[\'descr\']);'));
145 145
 		}
146 146
 		else
147 147
 		{
@@ -157,28 +157,28 @@  discard block
 block discarded – undo
157 157
 	 * @param string $selected selected charset
158 158
 	 * @return string|array html for a selectbox or array with charset / languages pairs
159 159
 	 */
160
-	static function get_charsets($name=false,$selected='')
160
+	static function get_charsets($name = false, $selected = '')
161 161
 	{
162 162
 		$charsets = array(
163 163
 			'utf-8' => 'utf-8: '.lang('all languages (incl. not listed ones)'),
164 164
 		);
165
-		if (($f = fopen('lang/languages','r')))
165
+		if (($f = fopen('lang/languages', 'r')))
166 166
 		{
167
-			while(($line = fgets($f)) !== false)
167
+			while (($line = fgets($f)) !== false)
168 168
 			{
169
-				list($lang,$language) = explode("\t",trim($line));
170
-				if ($lang && ($lf = @fopen("../phpgwapi/setup/" . EGW_LANGFILE_PREFIX . "$lang.lang",'r')))
169
+				list($lang, $language) = explode("\t", trim($line));
170
+				if ($lang && ($lf = @fopen("../phpgwapi/setup/".EGW_LANGFILE_PREFIX."$lang.lang", 'r')))
171 171
 				{
172
-					while(($line = fgets($lf)) !== false)
172
+					while (($line = fgets($lf)) !== false)
173 173
 					{
174
-						list($phrase,,,$charset) = explode("\t",$line);
174
+						list($phrase,,, $charset) = explode("\t", $line);
175 175
 						if ($phrase == 'charset')
176 176
 						{
177 177
 							$charset = trim(strtolower($charset));
178 178
 
179 179
 							if ($charset != 'utf-8')
180 180
 							{
181
-								$charsets[$charset] .= (isset($charsets[$charset]) ? ', ' : $charset.': ') . $language;
181
+								$charsets[$charset] .= (isset($charsets[$charset]) ? ', ' : $charset.': ').$language;
182 182
 							}
183 183
 							break;
184 184
 						}
@@ -192,6 +192,6 @@  discard block
 block discarded – undo
192 192
 		{
193 193
 			return $charsets;
194 194
 		}
195
-		return Api\Html::select($name,trim(strtolower($selected)),$charsets,true);
195
+		return Api\Html::select($name, trim(strtolower($selected)), $charsets, true);
196 196
 	}
197 197
 }
Please login to merge, or discard this patch.