Completed
Push — 14.2 ( e07840...cec2da )
by Ralf
83:18 queued 52:04
created
importexport/inc/class.importexport_iface_export_plugin.inc.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,8 @@
 block discarded – undo
34 34
  *
35 35
  * get_selector();  //returns array
36 36
  */
37
-interface importexport_iface_export_plugin {
37
+interface importexport_iface_export_plugin
38
+{
38 39
 	
39 40
 	/**
40 41
 	 * exports entries according to given definition object.
Please login to merge, or discard this patch.
importexport/inc/class.importexport_widget_filter.inc.php 3 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,7 +93,8 @@  discard block
 block discarded – undo
93 93
 						'get_rows'      => 'etemplate.ajax_select_widget.array_rows',
94 94
 						'id_field'      => ajax_select_widget::ARRAY_KEY,
95 95
 					);
96
-					if($field['rows']) {
96
+					if($field['rows'])
97
+					{
97 98
 						$options['num_rows'] = $field['rows'];
98 99
 					}
99 100
 
@@ -103,7 +104,9 @@  discard block
 block discarded – undo
103 104
 					{
104 105
 						$options['values'] = Api\Storage\Customfields::get_options_from_file($field['values']['@']);
105 106
 						unset($field['values']['@']);
106
-					} else {
107
+					}
108
+					else
109
+					{
107 110
 						$options['values'] = array_diff_key($field['values'], array_flip(ajax_select_widget::$known_options));
108 111
 					}
109 112
 					$options = array_merge($options, array_intersect_key($field['values'], array_flip(ajax_select_widget::$known_options)));
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @param string $cname
37 37
 	 */
38
-	public function beforeSendToClient($cname, Array $expand = Array())
38
+	public function beforeSendToClient($cname, array $expand = array())
39 39
 	{
40 40
 		$form_name = self::form_name($cname, $this->id);
41 41
 		if($this->getElementAttribute($form_name, 'customfields'))
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 *
186 186
 	 * @return Array of widget info
187 187
 	 */
188
-	protected static function do_relative_date($lname, Array &$value, $options, $readonly)
188
+	protected static function do_relative_date($lname, array &$value, $options, $readonly)
189 189
 	{
190 190
 		// Maybe this could be moved to date widget
191 191
 		$input = boetemplate::empty_cell('select',$lname, array(
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 	 *
212 212
 	 * @return Array of widget info
213 213
 	 */
214
-	protected static function do_absolute_date($lname, Array &$value, $options, $readonly)
214
+	protected static function do_absolute_date($lname, array &$value, $options, $readonly)
215 215
 	{
216 216
 		$input = boetemplate::empty_cell('hbox',$lname);
217 217
 
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -38,18 +38,18 @@  discard block
 block discarded – undo
38 38
 	public function beforeSendToClient($cname, Array $expand = Array())
39 39
 	{
40 40
 		$form_name = self::form_name($cname, $this->id);
41
-		if($this->getElementAttribute($form_name, 'customfields'))
41
+		if ($this->getElementAttribute($form_name, 'customfields'))
42 42
 		{
43 43
 			// Already done?  Still need to process, or sel_options may be missing
44 44
 			unset(self::$request->modifications[$form_name]);
45 45
 		}
46
-		$value =& self::get_array(self::$request->content, $form_name, true);
46
+		$value = & self::get_array(self::$request->content, $form_name, true);
47 47
 		$fields = $value['fields'];
48 48
 		unset($value['fields']);
49 49
 		$relative_dates = $this->attrs['relative_dates'];
50 50
 
51 51
 		// Fallback, so there's something there...
52
-		if(!is_array($fields))
52
+		if (!is_array($fields))
53 53
 		{
54 54
 			error_log("$this has no fields");
55 55
 			self::$transformation = array(
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
 		$this->setElementAttribute($form_name, 'prefix', self::$prefix);
67 67
 
68 68
 		$n = 1;
69
-		foreach($fields as $lname => &$field)
69
+		foreach ($fields as $lname => &$field)
70 70
 		{
71
-			$type =& $field['type'];
71
+			$type = & $field['type'];
72 72
 
73 73
 			// No filters are required
74 74
 			$field['needed'] = false;
75 75
 
76
-			switch($type)
76
+			switch ($type)
77 77
 			{
78 78
 				case 'date':
79 79
 				case 'date-time':
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 						'get_rows'      => 'etemplate.ajax_select_widget.array_rows',
91 91
 						'id_field'      => ajax_select_widget::ARRAY_KEY,
92 92
 					);
93
-					if($field['rows']) {
93
+					if ($field['rows']) {
94 94
 						$options['num_rows'] = $field['rows'];
95 95
 					}
96 96
 
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
 					break;
110 110
 				case 'select':
111 111
 				default:
112
-					if(strpos($field['type'],'select') === 0)
112
+					if (strpos($field['type'], 'select') === 0)
113 113
 					{
114 114
 						if (count($field['values']) == 1 && isset($field['values']['@']))
115 115
 						{
116 116
 							$field['values'] = egw_customfields::get_options_from_file($field['values']['@']);
117 117
 						}
118
-						foreach((array)$field['values'] as $key => $val)
118
+						foreach ((array)$field['values'] as $key => $val)
119 119
 						{
120
-							if (substr($val = lang($val),-1) != '*')
120
+							if (substr($val = lang($val), -1) != '*')
121 121
 							{
122 122
 								$field['values'][$key] = $val;
123 123
 							}
@@ -129,27 +129,27 @@  discard block
 block discarded – undo
129 129
 						$this->setElementAttribute($form_name.'['.self::$prefix.$lname.']', 'tags', TRUE);
130 130
 						$this->setElementAttribute($form_name.'['.self::$prefix.$lname.']', 'multiple', TRUE);
131 131
 					}
132
-					else if( $GLOBALS['egw_info']['apps'][$field['type']])
132
+					else if ($GLOBALS['egw_info']['apps'][$field['type']])
133 133
 					{
134 134
 						// Links
135 135
 					}
136 136
 					else
137 137
 					{
138
-						error_log('Trying to filter with unsupported field type ' . $lname . ': ' . $field['type']);
138
+						error_log('Trying to filter with unsupported field type '.$lname.': '.$field['type']);
139 139
 					}
140 140
 			}
141 141
 
142 142
 			// Send select options
143
-			if($field['values'])
143
+			if ($field['values'])
144 144
 			{
145 145
 				self::$request->sel_options[self::$prefix.$lname] = $field['values'];
146 146
 			}
147 147
 			$widget = self::factory($type, '<'.$type.' type="'.$type.'" id="'.self::$prefix.$lname.'"/>', self::$prefix.$lname);
148
-			if(method_exists($widget, 'beforeSendToClient'))
148
+			if (method_exists($widget, 'beforeSendToClient'))
149 149
 			{
150 150
 				$widget->id = self::$prefix.$lname;
151 151
 				$widget->attrs['type'] = $type;
152
-				if($type == 'link-to')
152
+				if ($type == 'link-to')
153 153
 				{
154 154
 					$widget->attrs['only_app'] = $field['type'];
155 155
 				}
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		parent::beforeSendToClient($cname, $expand);
162 162
 
163 163
 		$this->setElementAttribute($form_name, 'customfields', $fields);
164
-		$this->setElementAttribute($form_name, 'fields',array_fill_keys(array_keys($fields), true));
164
+		$this->setElementAttribute($form_name, 'fields', array_fill_keys(array_keys($fields), true));
165 165
 		return false;
166 166
 	}
167 167
 
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
 	protected static function do_relative_date($lname, Array &$value, $options, $readonly)
178 178
 	{
179 179
 		// Maybe this could be moved to date widget
180
-		$input = boetemplate::empty_cell('select',$lname, array(
180
+		$input = boetemplate::empty_cell('select', $lname, array(
181 181
 			'readonly'	=> $readonly,
182 182
 			'no_lang'	=> true,
183 183
 			'options'	=> $options,
184 184
 			'sel_options'	=> array('' => lang('all'))
185 185
 		));
186
-		foreach(importexport_helper_functions::$relative_dates as $label => $values)
186
+		foreach (importexport_helper_functions::$relative_dates as $label => $values)
187 187
 		{
188 188
 			$input['sel_options'][$label] = lang($label);
189 189
 		}
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	protected static function do_absolute_date($lname, Array &$value, $options, $readonly)
204 204
 	{
205
-		$input = boetemplate::empty_cell('hbox',$lname);
205
+		$input = boetemplate::empty_cell('hbox', $lname);
206 206
 
207 207
 		$type = 'date';
208
-		$from = boetemplate::empty_cell($type, $lname.'[from]',array(
208
+		$from = boetemplate::empty_cell($type, $lname.'[from]', array(
209 209
 			'readonly'      => $readonly,
210 210
 			'no_lang'       => True,
211 211
 			'size'          => $options
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 			'size'          => $options
218 218
 		));
219 219
 		boetemplate::add_child($input, $from);
220
-		boetemplate::add_child($input,boetemplate::empty_cell('label','',array(
220
+		boetemplate::add_child($input, boetemplate::empty_cell('label', '', array(
221 221
 			'label' => lang('to'),
222 222
 			'no_lang' => true
223 223
 		)));
@@ -226,18 +226,18 @@  discard block
 block discarded – undo
226 226
 	}
227 227
 
228 228
 
229
-	public function validate($cname, array $expand, array $content, &$validated=array())
229
+	public function validate($cname, array $expand, array $content, &$validated = array())
230 230
 	{
231 231
 		$form_name = self::form_name($cname, $this->id, $expand);
232 232
 		if (!$this->is_readonly($cname, $form_name))
233 233
 		{
234 234
 			$value_in = (array)self::get_array($content, $form_name);
235
-			$valid =& self::get_array($validated, $this->id ? $form_name : $field, true);
235
+			$valid = & self::get_array($validated, $this->id ? $form_name : $field, true);
236 236
 
237
-			foreach($value_in as $key => $value)
237
+			foreach ($value_in as $key => $value)
238 238
 			{
239 239
 				// Client side cf widget automatically prefixes #
240
-				$valid[substr($key,strlen(self::$prefix))] = $value;
240
+				$valid[substr($key, strlen(self::$prefix))] = $value;
241 241
 			}
242 242
 		}
243 243
 	}
Please login to merge, or discard this patch.
importexport/inc/class.importexport_wizard_basic_export_csv.inc.php 3 patches
Braces   +57 added lines, -21 removed lines patch added patch discarded remove patch
@@ -64,7 +64,11 @@  discard block
 block discarded – undo
64 64
 			'wizard_step80' => lang('Filters'),
65 65
 		);
66 66
 		list($appname, $part2) = explode('_', get_class($this));
67
-		if(!$GLOBALS['egw_info']['apps'][$appname]) $appname .= '_'.$part2; // Handle apps with _ in the name
67
+		if(!$GLOBALS['egw_info']['apps'][$appname])
68
+		{
69
+			$appname .= '_'.$part2;
70
+		}
71
+		// Handle apps with _ in the name
68 72
 		Api\Translation::add_app($appname);
69 73
 	}
70 74
 
@@ -73,7 +77,10 @@  discard block
 block discarded – undo
73 77
 	*/
74 78
 	function wizard_step30(&$content, &$sel_options, &$readonlys, &$preserv)
75 79
 	{
76
-		if($this->debug) error_log(get_class($this) . '::wizard_step30->$content '.print_r($content,true));
80
+		if($this->debug)
81
+		{
82
+			error_log(get_class($this) . '::wizard_step30->$content '.print_r($content,true));
83
+		}
77 84
 		// return from step30
78 85
 		if ($content['step'] == 'wizard_step30')
79 86
 		{
@@ -89,12 +96,17 @@  discard block
 block discarded – undo
89 96
 					$content['mapping'][$field_name] = $field_name;
90 97
 				}
91 98
 			}
92
-			if($content['mapping']['all_custom_fields']) {
99
+			if($content['mapping']['all_custom_fields'])
100
+			{
93 101
 				// Need the appname during actual export, to fetch the fields
94 102
 				$parts = explode('_', get_class($this));
95 103
 				$appname = $parts[0];
96
-				foreach($parts as $name_part) {
97
-					if($GLOBALS['egw_info']['apps'][$appname]) break;
104
+				foreach($parts as $name_part)
105
+				{
106
+					if($GLOBALS['egw_info']['apps'][$appname])
107
+					{
108
+						break;
109
+					}
98 110
 					$appname .= '_'.$name_part; // Handle apps with _ in the name
99 111
 				}
100 112
 				$content['mapping']['all_custom_fields'] = $appname;
@@ -125,15 +137,20 @@  discard block
 block discarded – undo
125 137
 			unset ($preserv['button']);
126 138
 			unset ($preserv['fields']);
127 139
 			$content['fields'] = array('');
128
-			if(!$content['mapping']) $content['mapping'] = $content['plugin_options']['mapping'];
140
+			if(!$content['mapping'])
141
+			{
142
+				$content['mapping'] = $content['plugin_options']['mapping'];
143
+			}
129 144
 		
130 145
 			$row = 1;
131
-			foreach($this->export_fields as $field => $name) {
146
+			foreach($this->export_fields as $field => $name)
147
+			{
132 148
 				$content['fields'][] = array(
133 149
 					'field'	=>	$field,
134 150
 					'name'	=>	lang($name),
135 151
 				);
136
-				if($content['mapping'][$field]) {
152
+				if($content['mapping'][$field])
153
+				{
137 154
 					$content['fields']['export'][$row] = $field;
138 155
 				}
139 156
 				$row++;
@@ -155,11 +172,17 @@  discard block
 block discarded – undo
155 172
 	 */
156 173
 	function wizard_step40(&$content, &$sel_options, &$readonlys, &$preserv)
157 174
 	{
158
-		if($this->debug) error_log(get_class($this) . '::wizard_step40->$content '.print_r($content,true));
175
+		if($this->debug)
176
+		{
177
+			error_log(get_class($this) . '::wizard_step40->$content '.print_r($content,true));
178
+		}
159 179
 		// return from step40
160
-		if ($content['step'] == 'wizard_step40') {
161
-			if($content['begin_with_fieldnames'] == 'label') {
162
-				foreach($content['mapping'] as $field => &$label) {
180
+		if ($content['step'] == 'wizard_step40')
181
+		{
182
+			if($content['begin_with_fieldnames'] == 'label')
183
+			{
184
+				foreach($content['mapping'] as $field => &$label)
185
+				{
163 186
 					// Check first, to avoid clearing any pseudo-columns (ex: All custom fields)
164 187
 					$label = $this->export_fields[$field] ? $this->export_fields[$field] : $label;
165 188
 				}
@@ -183,18 +206,24 @@  discard block
 block discarded – undo
183 206
 			$content['step'] = 'wizard_step40';
184 207
 
185 208
 			// If editing an existing definition, these will be in plugin_options
186
-			if(!$content['delimiter'] && $content['plugin_options']['delimiter']) {
209
+			if(!$content['delimiter'] && $content['plugin_options']['delimiter'])
210
+			{
187 211
 				$content['delimiter'] = $content['plugin_options']['delimiter'];
188
-			} elseif (!$content['delimiter']) {
212
+			}
213
+			elseif (!$content['delimiter'])
214
+			{
189 215
 				$content['delimiter'] = ';';
190 216
 			}
191
-			if(!$content['charset'] && $content['plugin_options']['charset']) {
217
+			if(!$content['charset'] && $content['plugin_options']['charset'])
218
+			{
192 219
 				$content['charset'] = $content['plugin_options']['charset'] ? $content['plugin_options']['charset'] : 'user';
193 220
 			}
194
-			if(!array_key_exists('begin_with_fieldnames', $content) && array_key_exists('begin_with_fieldnames', $content['plugin_options'])) {
221
+			if(!array_key_exists('begin_with_fieldnames', $content) && array_key_exists('begin_with_fieldnames', $content['plugin_options']))
222
+			{
195 223
 				$content['begin_with_fieldnames'] = $content['plugin_options']['begin_with_fieldnames'];
196 224
 			}
197
-			if(!array_key_exists('convert', $content) && array_key_exists('convert', $content['plugin_options'])) {
225
+			if(!array_key_exists('convert', $content) && array_key_exists('convert', $content['plugin_options']))
226
+			{
198 227
 				$content['convert'] = $content['plugin_options']['convert'];
199 228
 			}
200 229
 
@@ -238,15 +267,20 @@  discard block
 block discarded – undo
238 267
 	 */
239 268
 	function wizard_step80(&$content, &$sel_options, &$readonlys, &$preserv)
240 269
 	{
241
-		if($this->debug) error_log(get_class($this) . '::' . __METHOD__ .'->$content '.print_r($content,true));
270
+		if($this->debug)
271
+		{
272
+			error_log(get_class($this) . '::' . __METHOD__ .'->$content '.print_r($content,true));
273
+		}
242 274
 		// return from submit
243
-		if ($content['step'] == 'wizard_step80') {
275
+		if ($content['step'] == 'wizard_step80')
276
+		{
244 277
 			// Process submitted
245 278
 			unset($content['filter']);
246 279
 			unset($content['set_filter']['fields']);
247 280
 			foreach($content['set_filter'] as $key => $value)
248 281
 			{
249
-				if($value) {
282
+				if($value)
283
+				{
250 284
 					$content['filter'][$key] = $value;
251 285
 				}
252 286
 			}
@@ -264,7 +298,9 @@  discard block
 block discarded – undo
264 298
 				default :
265 299
 					return $this->wizard_step80($content,$sel_options,$readonlys,$preserv);
266 300
 			}
267
-		} else {
301
+		}
302
+		else
303
+		{
268 304
 
269 305
 			// Step 50 - filters
270 306
 			$content['text'] = $this->steps['wizard_step80'];
Please login to merge, or discard this patch.
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
 	const TEMPLATE_MARKER = '-eTemplate-';
22 22
 
23 23
 	/**
24
-	* List of steps.  Key is the function, value is the translated title.
25
-	*/
24
+	 * List of steps.  Key is the function, value is the translated title.
25
+	 */
26 26
 	public $steps;
27 27
 
28 28
 	/**
29
-	* List of eTemplates to use for each step.  You can override this with your own etemplates steps.
30
-	*/
29
+	 * List of eTemplates to use for each step.  You can override this with your own etemplates steps.
30
+	 */
31 31
 	protected $step_templates = array(
32 32
 		'wizard_step30' => 'importexport.wizard_basic_export_csv.choose_fields',
33 33
 		'wizard_step40' => 'importexport.wizard_basic_export_csv.choosesepncharset',
@@ -36,19 +36,19 @@  discard block
 block discarded – undo
36 36
 		
37 37
 
38 38
 	/**
39
-	* Destination fields for the export
40
-	* Key is the field name, value is the human version
41
-	*/
39
+	 * Destination fields for the export
40
+	 * Key is the field name, value is the human version
41
+	 */
42 42
 	protected $export_fields = array();
43 43
 	
44 44
 	/**
45
-	* List of conditions your plugin supports
46
-	*/
45
+	 * List of conditions your plugin supports
46
+	 */
47 47
 	protected $conditions = array();
48 48
 
49 49
 	/**
50
-	* List of actions your plugin supports
51
-	*/
50
+	 * List of actions your plugin supports
51
+	 */
52 52
 	protected $actions = array();
53 53
 
54 54
 	/**
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
 	}
68 68
 
69 69
 	/**
70
-	* Choose fields to export
71
-	*/
70
+	 * Choose fields to export
71
+	 */
72 72
 	function wizard_step30(&$content, &$sel_options, &$readonlys, &$preserv)
73 73
 	{
74 74
 		if($this->debug) error_log(get_class($this) . '::wizard_step30->$content '.print_r($content,true));
@@ -204,16 +204,16 @@  discard block
 block discarded – undo
204 204
 			);
205 205
 			$sel_options['charset'] = $GLOBALS['egw']->translation->get_installed_charsets()+
206 206
 			array(
207
-                                'user'  => lang('User preference'),
208
-                        );
207
+								'user'  => lang('User preference'),
208
+						);
209 209
 
210
-                        // Add in extra allowed charsets
211
-                        $config = config::read('importexport');
212
-                        $extra_charsets = array_intersect(explode(',',$config['import_charsets']), mb_list_encodings());
213
-                        if($extra_charsets)
214
-                        {
215
-                                $sel_options['charset'] += array(lang('Extra encodings') => array_combine($extra_charsets,$extra_charsets));
216
-                        }
210
+						// Add in extra allowed charsets
211
+						$config = config::read('importexport');
212
+						$extra_charsets = array_intersect(explode(',',$config['import_charsets']), mb_list_encodings());
213
+						if($extra_charsets)
214
+						{
215
+								$sel_options['charset'] += array(lang('Extra encodings') => array_combine($extra_charsets,$extra_charsets));
216
+						}
217 217
 			$sel_options['convert'] = array(
218 218
 				0	=> lang('Database values'),
219 219
 				1	=> lang('Human friendly values')
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 			'wizard_step80' => lang('Filters'),
63 63
 		);
64 64
 		list($appname, $part2) = explode('_', get_class($this));
65
-		if(!$GLOBALS['egw_info']['apps'][$appname]) $appname .= '_'.$part2; // Handle apps with _ in the name
65
+		if (!$GLOBALS['egw_info']['apps'][$appname]) $appname .= '_'.$part2; // Handle apps with _ in the name
66 66
 		translation::add_app($appname);
67 67
 	}
68 68
 
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
 	*/
72 72
 	function wizard_step30(&$content, &$sel_options, &$readonlys, &$preserv)
73 73
 	{
74
-		if($this->debug) error_log(get_class($this) . '::wizard_step30->$content '.print_r($content,true));
74
+		if ($this->debug) error_log(get_class($this).'::wizard_step30->$content '.print_r($content, true));
75 75
 		// return from step30
76 76
 		if ($content['step'] == 'wizard_step30')
77 77
 		{
78
-			foreach($content['fields']['export'] as $field_name)
78
+			foreach ($content['fields']['export'] as $field_name)
79 79
 			{
80 80
 				// Preserve original field names, where available
81
-				if($content['plugin_options']['no_header_translation'] && $content['plugin_options']['mapping'][$field_name])
81
+				if ($content['plugin_options']['no_header_translation'] && $content['plugin_options']['mapping'][$field_name])
82 82
 				{
83 83
 					$content['mapping'][$field_name] = $content['plugin_options']['mapping'][$field_name];
84 84
 				}
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
 					$content['mapping'][$field_name] = $field_name;
88 88
 				}
89 89
 			}
90
-			if($content['mapping']['all_custom_fields']) {
90
+			if ($content['mapping']['all_custom_fields']) {
91 91
 				// Need the appname during actual export, to fetch the fields
92 92
 				$parts = explode('_', get_class($this));
93 93
 				$appname = $parts[0];
94
-				foreach($parts as $name_part) {
95
-					if($GLOBALS['egw_info']['apps'][$appname]) break;
94
+				foreach ($parts as $name_part) {
95
+					if ($GLOBALS['egw_info']['apps'][$appname]) break;
96 96
 					$appname .= '_'.$name_part; // Handle apps with _ in the name
97 97
 				}
98 98
 				$content['mapping']['all_custom_fields'] = $appname;
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
 			switch (array_search('pressed', $content['button']))
104 104
 			{
105 105
 				case 'next':
106
-					return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1);
106
+					return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], 1);
107 107
 				case 'previous' :
108
-					return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1);
108
+					return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], -1);
109 109
 				case 'finish':
110 110
 					return 'wizard_finish';
111 111
 				default :
112
-					return $this->wizard_step30($content,$sel_options,$readonlys,$preserv);
112
+					return $this->wizard_step30($content, $sel_options, $readonlys, $preserv);
113 113
 			}
114 114
 		}
115 115
 		// init step30
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
 			unset ($preserv['button']);
124 124
 			unset ($preserv['fields']);
125 125
 			$content['fields'] = array('');
126
-			if(!$content['mapping']) $content['mapping'] = $content['plugin_options']['mapping'];
126
+			if (!$content['mapping']) $content['mapping'] = $content['plugin_options']['mapping'];
127 127
 		
128 128
 			$row = 1;
129
-			foreach($this->export_fields as $field => $name) {
129
+			foreach ($this->export_fields as $field => $name) {
130 130
 				$content['fields'][] = array(
131 131
 					'field'	=>	$field,
132 132
 					'name'	=>	lang($name),
133 133
 				);
134
-				if($content['mapping'][$field]) {
134
+				if ($content['mapping'][$field]) {
135 135
 					$content['fields']['export'][$row] = $field;
136 136
 				}
137 137
 				$row++;
@@ -153,11 +153,11 @@  discard block
 block discarded – undo
153 153
 	 */
154 154
 	function wizard_step40(&$content, &$sel_options, &$readonlys, &$preserv)
155 155
 	{
156
-		if($this->debug) error_log(get_class($this) . '::wizard_step40->$content '.print_r($content,true));
156
+		if ($this->debug) error_log(get_class($this).'::wizard_step40->$content '.print_r($content, true));
157 157
 		// return from step40
158 158
 		if ($content['step'] == 'wizard_step40') {
159
-			if($content['begin_with_fieldnames'] == 'label') {
160
-				foreach($content['mapping'] as $field => &$label) {
159
+			if ($content['begin_with_fieldnames'] == 'label') {
160
+				foreach ($content['mapping'] as $field => &$label) {
161 161
 					// Check first, to avoid clearing any pseudo-columns (ex: All custom fields)
162 162
 					$label = $this->export_fields[$field] ? $this->export_fields[$field] : $label;
163 163
 				}
@@ -165,13 +165,13 @@  discard block
 block discarded – undo
165 165
 			switch (array_search('pressed', $content['button']))
166 166
 			{
167 167
 				case 'next':
168
-					return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1);
168
+					return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], 1);
169 169
 				case 'previous' :
170
-					return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1);
170
+					return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], -1);
171 171
 				case 'finish':
172 172
 					return 'wizard_finish';
173 173
 				default :
174
-					return $this->wizard_step40($content,$sel_options,$readonlys,$preserv);
174
+					return $this->wizard_step40($content, $sel_options, $readonlys, $preserv);
175 175
 			}
176 176
 		}
177 177
 		// init step40
@@ -181,18 +181,18 @@  discard block
 block discarded – undo
181 181
 			$content['step'] = 'wizard_step40';
182 182
 
183 183
 			// If editing an existing definition, these will be in plugin_options
184
-			if(!$content['delimiter'] && $content['plugin_options']['delimiter']) {
184
+			if (!$content['delimiter'] && $content['plugin_options']['delimiter']) {
185 185
 				$content['delimiter'] = $content['plugin_options']['delimiter'];
186 186
 			} elseif (!$content['delimiter']) {
187 187
 				$content['delimiter'] = ';';
188 188
 			}
189
-			if(!$content['charset'] && $content['plugin_options']['charset']) {
189
+			if (!$content['charset'] && $content['plugin_options']['charset']) {
190 190
 				$content['charset'] = $content['plugin_options']['charset'] ? $content['plugin_options']['charset'] : 'user';
191 191
 			}
192
-			if(!array_key_exists('begin_with_fieldnames', $content) && array_key_exists('begin_with_fieldnames', $content['plugin_options'])) {
192
+			if (!array_key_exists('begin_with_fieldnames', $content) && array_key_exists('begin_with_fieldnames', $content['plugin_options'])) {
193 193
 				$content['begin_with_fieldnames'] = $content['plugin_options']['begin_with_fieldnames'];
194 194
 			}
195
-			if(!array_key_exists('convert', $content) && array_key_exists('convert', $content['plugin_options'])) {
195
+			if (!array_key_exists('convert', $content) && array_key_exists('convert', $content['plugin_options'])) {
196 196
 				$content['convert'] = $content['plugin_options']['convert'];
197 197
 			}
198 198
 
@@ -202,17 +202,17 @@  discard block
 block discarded – undo
202 202
 				1	=> lang('Field names'),
203 203
 				'label'	=> lang('Field labels')
204 204
 			);
205
-			$sel_options['charset'] = $GLOBALS['egw']->translation->get_installed_charsets()+
205
+			$sel_options['charset'] = $GLOBALS['egw']->translation->get_installed_charsets() +
206 206
 			array(
207 207
                                 'user'  => lang('User preference'),
208 208
                         );
209 209
 
210 210
                         // Add in extra allowed charsets
211 211
                         $config = config::read('importexport');
212
-                        $extra_charsets = array_intersect(explode(',',$config['import_charsets']), mb_list_encodings());
213
-                        if($extra_charsets)
212
+                        $extra_charsets = array_intersect(explode(',', $config['import_charsets']), mb_list_encodings());
213
+                        if ($extra_charsets)
214 214
                         {
215
-                                $sel_options['charset'] += array(lang('Extra encodings') => array_combine($extra_charsets,$extra_charsets));
215
+                                $sel_options['charset'] += array(lang('Extra encodings') => array_combine($extra_charsets, $extra_charsets));
216 216
                         }
217 217
 			$sel_options['convert'] = array(
218 218
 				0	=> lang('Database values'),
@@ -236,15 +236,15 @@  discard block
 block discarded – undo
236 236
 	 */
237 237
 	function wizard_step80(&$content, &$sel_options, &$readonlys, &$preserv)
238 238
 	{
239
-		if($this->debug) error_log(get_class($this) . '::' . __METHOD__ .'->$content '.print_r($content,true));
239
+		if ($this->debug) error_log(get_class($this).'::'.__METHOD__.'->$content '.print_r($content, true));
240 240
 		// return from submit
241 241
 		if ($content['step'] == 'wizard_step80') {
242 242
 			// Process submitted
243 243
 			unset($content['filter']);
244 244
 			unset($content['set_filter']['fields']);
245
-			foreach($content['set_filter'] as $key => $value)
245
+			foreach ($content['set_filter'] as $key => $value)
246 246
 			{
247
-				if($value) {
247
+				if ($value) {
248 248
 					$content['filter'][$key] = $value;
249 249
 				}
250 250
 			}
@@ -254,13 +254,13 @@  discard block
 block discarded – undo
254 254
 			switch (array_search('pressed', $content['button']))
255 255
 			{
256 256
 				case 'next':
257
-					return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1);
257
+					return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], 1);
258 258
 				case 'previous' :
259
-					return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1);
259
+					return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], -1);
260 260
 				case 'finish':
261 261
 					return 'wizard_finish';
262 262
 				default :
263
-					return $this->wizard_step80($content,$sel_options,$readonlys,$preserv);
263
+					return $this->wizard_step80($content, $sel_options, $readonlys, $preserv);
264 264
 			}
265 265
 		} else {
266 266
 
@@ -271,15 +271,15 @@  discard block
 block discarded – undo
271 271
 			unset ($preserv['button']);
272 272
 
273 273
 			$content['set_filter']['fields'] = importexport_helper_functions::get_filter_fields(
274
-				$content['application'],$content['plugin'],$this
274
+				$content['application'], $content['plugin'], $this
275 275
 			);
276 276
 			// Load existing filter from either content or definition
277
-			foreach($content['set_filter']['fields'] as $field => $settings)
277
+			foreach ($content['set_filter']['fields'] as $field => $settings)
278 278
 			{
279 279
 				$content['set_filter'][$field] = $content['filter'][$field];
280 280
 			}
281 281
 
282
-			if(!$content['set_filter']['fields'])
282
+			if (!$content['set_filter']['fields'])
283 283
 			{
284 284
 				// No fields
285 285
 				return importexport_definitions_ui::SKIP;
Please login to merge, or discard this patch.
importexport/inc/class.importexport_definitions_ui.inc.php 4 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -940,7 +940,7 @@
 block discarded – undo
940 940
 	 * Determine if the user is allowed to edit the definition
941 941
 	 *
942 942
 	 */
943
-	protected function can_edit(Array $definition)
943
+	protected function can_edit(array $definition)
944 944
 	{
945 945
 		if($definition['owner'] && $definition['owner'] == $GLOBALS['egw_info']['user']['account_id'])
946 946
 		{
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	/**
77 77
 	 * List defined {im|ex}ports
78 78
 	 *
79
-	 * @param array $content=null
79
+	 * @param array $content
80 80
 	 */
81 81
 	function index($content = null,$msg='')
82 82
 	{
@@ -303,7 +303,8 @@  discard block
 block discarded – undo
303 303
 	 * @param int &$success number of succeded actions
304 304
 	 * @param int &$failed number of failed actions (not enought permissions)
305 305
 	 * @param string &$action_msg translated verb for the actions, to be used in a message like %1 entries 'deleted'
306
-	 * @param string/array $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup
306
+	 * @param string $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup
307
+	 * @param string $msg
307 308
 	 * @return boolean true if all actions succeded, false otherwise
308 309
 	 */
309 310
 	function action($action,$selected,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg)
Please login to merge, or discard this patch.
Spacing   +157 added lines, -158 removed lines patch added patch discarded remove patch
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
 	function __construct()
57 57
 	{
58 58
 		// we cant deal with notice and warnings, as we are on ajax!
59
-		error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
59
+		error_reporting(E_ALL&~E_NOTICE&~E_WARNING);
60 60
 		$GLOBALS['egw']->translation->add_app(self::_appname);
61 61
 		$GLOBALS['egw_info']['flags']['currentapp'] = self::_appname;
62 62
 		
63 63
 		$this->etpl = new etemplate_new();
64
-		$this->clock = html::image(self::_appname,'clock');
64
+		$this->clock = html::image(self::_appname, 'clock');
65 65
 		$this->steps = array(
66 66
 			'wizard_step10' => lang('Choose an application'),
67 67
 			'wizard_step20' => lang('Choose a plugin'),
@@ -78,18 +78,18 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @param array $content=null
80 80
 	 */
81
-	function index($content = null,$msg='')
81
+	function index($content = null, $msg = '')
82 82
 	{
83 83
 		$filter = array('name' => '*');
84 84
 
85
-		if($GLOBALS['egw_info']['user']['apps']['admin']) {
85
+		if ($GLOBALS['egw_info']['user']['apps']['admin']) {
86 86
 			// Any public definition
87
-			$filter[] = '(owner=0 OR owner IS NULL OR allowed_users IS NOT NULL OR owner = ' . $GLOBALS['egw_info']['user']['account_id'] . ')';
87
+			$filter[] = '(owner=0 OR owner IS NULL OR allowed_users IS NOT NULL OR owner = '.$GLOBALS['egw_info']['user']['account_id'].')';
88 88
 		} else {
89 89
 			// Filter private definitions
90 90
 			$filter['owner'] = $GLOBALS['egw_info']['user']['account_id'];
91 91
 			$config = config::read('phpgwapi');
92
-			if($config['export_limit'] == 'no' && !bo_merge::is_export_limit_excepted()) {
92
+			if ($config['export_limit'] == 'no' && !bo_merge::is_export_limit_excepted()) {
93 93
 				$filter['type'] = 'import';
94 94
 			}
95 95
 		}
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
 			if (isset($content['nm']['rows']['delete']))
101 101
 			{
102 102
 				$content['nm']['action'] = 'delete';
103
-				$content['nm']['selected'] = array_keys($content['nm']['rows']['delete'],'pressed');
103
+				$content['nm']['selected'] = array_keys($content['nm']['rows']['delete'], 'pressed');
104 104
 			}
105
-			elseif(($button = array_search('pressed',$content['nm']['rows'])) !== false)
105
+			elseif (($button = array_search('pressed', $content['nm']['rows'])) !== false)
106 106
 			{
107 107
 				$selected = $content['nm']['rows']['selected'];
108
-				if(count($selected) < 1 || !is_array($selected)) common::egw_exit();
108
+				if (count($selected) < 1 || !is_array($selected)) common::egw_exit();
109 109
 				switch ($button)
110 110
 				{
111 111
 					case 'delete_selected' :
@@ -127,54 +127,54 @@  discard block
 block discarded – undo
127 127
 				else
128 128
 				{
129 129
 					// Action has an additional parameter
130
-					if(in_array($content['nm']['action'], array('owner', 'allowed')))
130
+					if (in_array($content['nm']['action'], array('owner', 'allowed')))
131 131
 					{
132 132
 						$action = $content['nm']['action'];
133
-						if($content['nm']['action'] == 'allowed')
133
+						if ($content['nm']['action'] == 'allowed')
134 134
 						{
135 135
 							$content['allowed'] = $content['allowed_popup']['allowed_private'] == 'true' ? null : (
136
-								$content['allowed_popup']['all_users']=='true' ? 'all' : implode(',',$content['allowed_popup']['allowed'])
136
+								$content['allowed_popup']['all_users'] == 'true' ? 'all' : implode(',', $content['allowed_popup']['allowed'])
137 137
 							);
138 138
 						}
139 139
 						else
140 140
 						{
141 141
 							$content['owner'] = $content['owner_popup']['owner'];
142 142
 						}
143
-						if(is_array($content[$content['nm']['action']]))
143
+						if (is_array($content[$content['nm']['action']]))
144 144
 						{
145
-							$content[$content['nm']['action']] = implode(',',$content[$content['nm']['action']]);
145
+							$content[$content['nm']['action']] = implode(',', $content[$content['nm']['action']]);
146 146
 						}
147
-						$content['nm']['action'] .= '_' . $content[$action];
147
+						$content['nm']['action'] .= '_'.$content[$action];
148 148
 						unset($content[$action]);
149 149
 						unset($content['allowed_popup']);
150 150
 					}
151
-					if ($this->action($content['nm']['action'],$content['nm']['selected'],$content['nm']['select_all'],
152
-						$success,$failed,$action_msg,'index',$msg))
151
+					if ($this->action($content['nm']['action'], $content['nm']['selected'], $content['nm']['select_all'],
152
+						$success, $failed, $action_msg, 'index', $msg))
153 153
 					{
154
-						$msg .= lang('%1 definition(s) %2',$success,$action_msg);
154
+						$msg .= lang('%1 definition(s) %2', $success, $action_msg);
155 155
 					}
156
-					elseif(empty($msg))
156
+					elseif (empty($msg))
157 157
 					{
158
-						$msg .= lang('%1 definition(s) %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed);
158
+						$msg .= lang('%1 definition(s) %2, %3 failed because of insufficent rights !!!', $success, $action_msg, $failed);
159 159
 					}
160 160
 				}
161 161
 			}
162 162
 		}
163 163
 
164
-		if(!is_array($content['nm'])) {
164
+		if (!is_array($content['nm'])) {
165 165
 			$content['nm'] = array(
166 166
 				'get_rows'	=> 'importexport.importexport_definitions_ui.get_rows',
167 167
 				'no_cat'	=> true,
168 168
 				'no_filter'	=> true,
169 169
 				'no_filter2'	=> true,
170
-				'csv_fields'	=> false,	// Disable CSV export, uses own export
171
-				'default_cols'  => '!actions',  // switch legacy actions column and row off by default
170
+				'csv_fields'	=> false, // Disable CSV export, uses own export
171
+				'default_cols'  => '!actions', // switch legacy actions column and row off by default
172 172
 				'row_id'	=> 'definition_id',
173 173
 				'placeholder_actions' => array('add')
174 174
 			);
175
-			if($_GET['application']) $content['nm']['col_filter']['application'] = $_GET['application'];
175
+			if ($_GET['application']) $content['nm']['col_filter']['application'] = $_GET['application'];
176 176
 		}
177
-		if(egw_session::appsession('index', 'importexport'))
177
+		if (egw_session::appsession('index', 'importexport'))
178 178
 		{
179 179
 			$content['nm'] = array_merge($content['nm'], egw_session::appsession('index', 'importexport'));
180 180
 		}
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
 		);
192 192
 		foreach ($this->plugins as $appname => $options)
193 193
 		{
194
-			if($GLOBALS['egw_info']['user']['apps'][$appname] || $GLOBALS['egw_info']['user']['apps']['admin']) {
194
+			if ($GLOBALS['egw_info']['user']['apps'][$appname] || $GLOBALS['egw_info']['user']['apps']['admin']) {
195 195
 				$sel_options['application'][$appname] = lang($appname);
196 196
 			}
197 197
 		}
198
-		if($msg) $content['msg'] = $msg;
198
+		if ($msg) $content['msg'] = $msg;
199 199
 
200 200
 		$etpl = new etemplate_new(self::_appname.'.definition_index');
201
-		return $etpl->exec( self::_appname.'.importexport_definitions_ui.index', $content, $sel_options, $readonlys, $preserv );
201
+		return $etpl->exec(self::_appname.'.importexport_definitions_ui.index', $content, $sel_options, $readonlys, $preserv);
202 202
 	}
203 203
 
204 204
 	private function get_actions() {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		);
288 288
 
289 289
 		// Unset admin actions
290
-		if(!$GLOBALS['egw_info']['user']['apps']['admin'])
290
+		if (!$GLOBALS['egw_info']['user']['apps']['admin'])
291 291
 		{
292 292
 			unset($actions['schedule']);
293 293
 		}
@@ -306,27 +306,27 @@  discard block
 block discarded – undo
306 306
 	 * @param string/array $session_name 'index' or 'email', or array with session-data depending if we are in the main list or the popup
307 307
 	 * @return boolean true if all actions succeded, false otherwise
308 308
 	 */
309
-	function action($action,$selected,$use_all,&$success,&$failed,&$action_msg,$session_name,&$msg)
309
+	function action($action, $selected, $use_all, &$success, &$failed, &$action_msg, $session_name, &$msg)
310 310
 	{
311 311
 		//error_log( __METHOD__."('$action', ".array2string($selected).', '.array2string($use_all).",,, '$session_name')");
312 312
 		if ($use_all)
313 313
 		{
314 314
 			// get the whole selection
315
-			$old_query = $query = is_array($session_name) ? $session_name : egw_session::appsession($session_name,'importexport');
315
+			$old_query = $query = is_array($session_name) ? $session_name : egw_session::appsession($session_name, 'importexport');
316 316
 
317
-			@set_time_limit(0);				// switch off the execution time limit, as it's for big selections to small
318
-			$query['num_rows'] = -1;		// all
319
-			$query['csv_export'] = true;	// so get_rows method _can_ produce different content or not store state in the session
320
-			$this->get_rows($query,$rows,$readonlys);
317
+			@set_time_limit(0); // switch off the execution time limit, as it's for big selections to small
318
+			$query['num_rows'] = -1; // all
319
+			$query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session
320
+			$this->get_rows($query, $rows, $readonlys);
321 321
 
322 322
 			$selected = array();
323
-			foreach($rows as $row) {
323
+			foreach ($rows as $row) {
324 324
 				$selected[] = $row['definition_id'];
325 325
 			}
326
-			if(!is_array($session_name))
326
+			if (!is_array($session_name))
327 327
 			{
328 328
 				// Restore old query
329
-				egw_session::appsession($session_name, 'importexport',$old_query);
329
+				egw_session::appsession($session_name, 'importexport', $old_query);
330 330
 			}
331 331
 		}
332 332
 
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
 
336 336
 		$bodefinitions = new importexport_definitions_bo(false, true);
337 337
 
338
-		switch($action) {
338
+		switch ($action) {
339 339
 			case 'execute':
340 340
 				// There's probably a way to do this in just JS, all the info should be there...
341
-				foreach($selected as $id) {
341
+				foreach ($selected as $id) {
342 342
 					$definition = $bodefinitions->read((int)$id);
343 343
 					$link = egw::link('/index.php', array(
344 344
 						'menuaction' => 'importexport.importexport_'.$definition['type'].'_ui.'.$definition['type'].'_dialog',
@@ -349,14 +349,14 @@  discard block
 block discarded – undo
349 349
 				}
350 350
 				break;
351 351
 			case 'allowed':
352
-				$action = 'allowed_users';// Field is allowed_users, popup doesn't like _
352
+				$action = 'allowed_users'; // Field is allowed_users, popup doesn't like _
353 353
 			case 'owner':
354
-				$action_msg = lang('changed'. ' ' . $action);
355
-				foreach($selected as $id) {
354
+				$action_msg = lang('changed'.' '.$action);
355
+				foreach ($selected as $id) {
356 356
 					$definition = $bodefinitions->read((int)$id);
357
-					if($definition['definition_id']) {
357
+					if ($definition['definition_id']) {
358 358
 						// Prevent private with no owner
359
-						if(!$definition['owner'] && !$settings) $definition['owner'] = $GLOBALS['egw_info']['user']['account_id'];
359
+						if (!$definition['owner'] && !$settings) $definition['owner'] = $GLOBALS['egw_info']['user']['account_id'];
360 360
 
361 361
 						$definition[$action] = $settings;
362 362
 						$bodefinitions->save($definition);
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 				$mime_type = ($GLOBALS['egw']->html->user_agent == 'msie' || $GLOBALS['egw']->html->user_agent == 'opera') ?
375 375
 					'application/octetstream' : 'application/octet-stream';
376 376
 				$name = 'importexport_definition.xml';
377
-				header('Content-Type: ' . $mime_type);
377
+				header('Content-Type: '.$mime_type);
378 378
 				header('Content-Disposition: attachment; filename="'.$name.'"');
379 379
 				echo $bodefinitions->export($selected);
380 380
 				common::egw_exit();
@@ -383,16 +383,16 @@  discard block
 block discarded – undo
383 383
 			case 'copy':
384 384
 				$action_msg = lang('copied');
385 385
 				// Should only be one selected
386
-				foreach($selected as $id) {
386
+				foreach ($selected as $id) {
387 387
 					$definition = $bodefinitions->read((int)$id);
388
-					if($definition['definition_id']) {
388
+					if ($definition['definition_id']) {
389 389
 						unset($definition['definition_id']);
390
-						$definition['name'] = $settings ? $settings : $definition['name'] . ' copy';
390
+						$definition['name'] = $settings ? $settings : $definition['name'].' copy';
391 391
 						try {
392 392
 							$bodefinitions->save($definition);
393 393
 						} catch (Exception $e) {
394 394
 							try {
395
-								$definition['name'] .= ' ' . $GLOBALS['egw_info']['user']['account_lid'];
395
+								$definition['name'] .= ' '.$GLOBALS['egw_info']['user']['account_lid'];
396 396
 								$bodefinitions->save($definition);
397 397
 							} catch (Exception $ex) {
398 398
 								$failed++;
@@ -407,16 +407,16 @@  discard block
 block discarded – undo
407 407
 			case 'createexport':
408 408
 				$action_msg = lang('created');
409 409
 				// Should only be one selected
410
-				foreach($selected as $id) {
410
+				foreach ($selected as $id) {
411 411
 					$definition = new importexport_definition($id);
412 412
 					try {
413 413
 						$export = $bodefinitions->export_from_import($definition);
414 414
 						$export->save();
415 415
 					} catch (Exception $e) {
416
-						if($export)
416
+						if ($export)
417 417
 						{
418 418
 							try {
419
-								$export->name = $export->name.' ' . $GLOBALS['egw_info']['user']['account_lid'];
419
+								$export->name = $export->name.' '.$GLOBALS['egw_info']['user']['account_lid'];
420 420
 								$export->save();
421 421
 							} catch (Exception $ex) {
422 422
 								$failed++;
@@ -438,13 +438,13 @@  discard block
 block discarded – undo
438 438
 
439 439
 	public function get_rows(&$query, &$rows, &$readonlys) {
440 440
 		$rows = array();
441
-		egw_session::appsession('index','importexport',$query);
441
+		egw_session::appsession('index', 'importexport', $query);
442 442
 
443 443
 		// Special handling for allowed users 'private'
444
-		if($query['col_filter']['allowed_users'] == 'private')
444
+		if ($query['col_filter']['allowed_users'] == 'private')
445 445
 		{
446 446
 			unset($query['col_filter']['allowed_users']);
447
-			$query['col_filter'][] = 'allowed_users = ' . $GLOBALS['egw']->db->quote(',,');
447
+			$query['col_filter'][] = 'allowed_users = '.$GLOBALS['egw']->db->quote(',,');
448 448
 		}
449 449
 		$bodefinitions = new importexport_definitions_bo($query['col_filter'], true);
450 450
 		// We don't care about readonlys for the UI
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 	 */
460 460
 	function edit()
461 461
 	{
462
-		if(!$_definition = $_GET['definition'])
462
+		if (!$_definition = $_GET['definition'])
463 463
 		{
464 464
 			$content = array(
465 465
 				'edit'		=> true,
@@ -468,11 +468,11 @@  discard block
 block discarded – undo
468 468
 			);
469 469
 
470 470
 			// Jump to a step
471
-			if($_GET['step'])
471
+			if ($_GET['step'])
472 472
 			{
473 473
 				$content['edit'] = false;
474 474
 				// Wizard will process previous step, then advance
475
-				$content['step'] = $this->get_step($_GET['step'],-1);
475
+				$content['step'] = $this->get_step($_GET['step'], -1);
476 476
 				$content['button']['next'] = 'pressed';
477 477
 				$this->wizard($content);
478 478
 			}
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 			}
484 484
 			return;
485 485
 		}
486
-		if(is_numeric($_GET['definition']))
486
+		if (is_numeric($_GET['definition']))
487 487
 		{
488 488
 			$definition = (int)$_GET['definition'];
489 489
 		}
@@ -495,31 +495,31 @@  discard block
 block discarded – undo
495 495
 		$definition = $bodefinitions->read($definition);
496 496
 		$definition['edit'] = true;
497 497
 		// Jump to a step
498
-		if($_GET['step'])
498
+		if ($_GET['step'])
499 499
 		{
500 500
 			$definition['edit'] = false;
501 501
 			// Wizard will process previous step, then advance
502
-			$definition['step'] = $_GET['step'];;
502
+			$definition['step'] = $_GET['step']; ;
503 503
 			$definition['button'] = array('next' => 'pressed');
504 504
 		}
505 505
 		$this->wizard($definition);
506 506
 	}
507 507
 
508
-	function wizard($content = null, $msg='')
508
+	function wizard($content = null, $msg = '')
509 509
 	{
510 510
 		$this->etpl->read('importexport.wizardbox');
511 511
 
512
-		if(is_array($content) &&! $content['edit'])
512
+		if (is_array($content) && !$content['edit'])
513 513
 		{
514
-			if(self::_debug) error_log('importexport.wizard->$content '. print_r($content,true));
514
+			if (self::_debug) error_log('importexport.wizard->$content '.print_r($content, true));
515 515
 			//foreach($content as $key => $val) error_log(" $key : ".array2string($val));
516 516
 			// fetch plugin object
517
-			if($content['plugin'] && $content['application'])
517
+			if ($content['plugin'] && $content['application'])
518 518
 			{
519
-				$wizard_name = $content['application'] . '_wizard_' . str_replace($content['application'] . '_', '', $content['plugin']);
519
+				$wizard_name = $content['application'].'_wizard_'.str_replace($content['application'].'_', '', $content['plugin']);
520 520
 
521 521
 				// we need to deal with the wizard object if exists
522
-				if (file_exists(EGW_SERVER_ROOT . '/'. $content['application']."/inc/class.$wizard_name.inc.php"))
522
+				if (file_exists(EGW_SERVER_ROOT.'/'.$content['application']."/inc/class.$wizard_name.inc.php"))
523 523
 				{
524 524
 					$wizard_plugin = $wizard_name;
525 525
 				}
@@ -528,38 +528,38 @@  discard block
 block discarded – undo
528 528
 					$wizard_plugin = $content['plugin'];
529 529
 				}
530 530
 				// App translations
531
-				if($content['application']) translation::add_app($content['application']);
531
+				if ($content['application']) translation::add_app($content['application']);
532 532
 
533 533
 				$this->plugin = is_object($GLOBALS['egw']->$wizard_plugin) ? $GLOBALS['egw']->$wizard_plugin : new $wizard_plugin;
534 534
 
535 535
 				// Global object needs to be the same, or references to plugin don't work
536
-				if(!is_object($GLOBALS['egw']->importexport_definitions_ui) || $GLOBALS['egw']->importexport_definitions_ui !== $this)
537
-					$GLOBALS['egw']->importexport_definitions_ui =& $this;
536
+				if (!is_object($GLOBALS['egw']->importexport_definitions_ui) || $GLOBALS['egw']->importexport_definitions_ui !== $this)
537
+					$GLOBALS['egw']->importexport_definitions_ui = & $this;
538 538
 			}
539 539
 			// deal with buttons even if we are not on ajax
540
-			if(isset($content['button']) && array_search('pressed',$content['button']) === false && count($content['button']) == 1)
540
+			if (isset($content['button']) && array_search('pressed', $content['button']) === false && count($content['button']) == 1)
541 541
 			{
542 542
 				$button = array_keys($content['button']);
543 543
 				$content['button'] = array($button[0] => 'pressed');
544 544
 			}
545 545
 
546 546
 			// post process submitted step
547
-			if($content['step'])
547
+			if ($content['step'])
548 548
 			{
549
-				if(!$this->can_edit($content))
549
+				if (!$this->can_edit($content))
550 550
 				{
551 551
 					// Each step changes definition, reload it
552 552
 					$bodefinitions = new importexport_definitions_bo();
553 553
 					$definition = $bodefinitions->read($content);
554 554
 					$content = $definition + array('step' => $content['step'], 'button' => $content['button']);
555 555
 				}
556
-				if(!key_exists($content['step'],$this->steps))
556
+				if (!key_exists($content['step'], $this->steps))
557 557
 				{
558
-					$next_step = $this->plugin->$content['step']($content,$sel_options,$readonlys,$preserv);
558
+					$next_step = $this->plugin->$content['step']($content, $sel_options, $readonlys, $preserv);
559 559
 				}
560 560
 				else
561 561
 				{
562
-					$next_step = $this->$content['step']($content,$sel_options,$readonlys,$preserv);
562
+					$next_step = $this->$content['step']($content, $sel_options, $readonlys, $preserv);
563 563
 				}
564 564
 			}
565 565
 			else
@@ -571,23 +571,23 @@  discard block
 block discarded – undo
571 571
 			$sel_options = $readonlys = $preserv = array();
572 572
 
573 573
 			// Disable finish button if required fields are missing
574
-			if(!$content['name'] || !$content['type'] || !$content['plugin'])
574
+			if (!$content['name'] || !$content['type'] || !$content['plugin'])
575 575
 			{
576 576
 				$readonlys['button[finish]'] = true;
577 577
 			}
578 578
 			do
579 579
 			{
580
-				if(!key_exists($next_step,$this->steps))
580
+				if (!key_exists($next_step, $this->steps))
581 581
 				{
582
-					$this->wizard_content_template = $this->plugin->$next_step($content,$sel_options,$readonlys,$preserv);
582
+					$this->wizard_content_template = $this->plugin->$next_step($content, $sel_options, $readonlys, $preserv);
583 583
 				}
584 584
 				else
585 585
 				{
586
-					$this->wizard_content_template = $this->$next_step($content,$sel_options,$readonlys,$preserv);
586
+					$this->wizard_content_template = $this->$next_step($content, $sel_options, $readonlys, $preserv);
587 587
 				}
588
-				if($this->wizard_content_template == self::SKIP)
588
+				if ($this->wizard_content_template == self::SKIP)
589 589
 				{
590
-					if(!key_exists($content['step'],$this->steps))
590
+					if (!key_exists($content['step'], $this->steps))
591 591
 					{
592 592
 						$next_step = $this->plugin->$content['step']($content);
593 593
 					}
@@ -596,9 +596,9 @@  discard block
 block discarded – undo
596 596
 						$next_step = $this->$content['step']($content);
597 597
 					}
598 598
 				}
599
-			} while($this->wizard_content_template == self::SKIP);
599
+			} while ($this->wizard_content_template == self::SKIP);
600 600
 			
601
-			if(!$this->can_edit($content))
601
+			if (!$this->can_edit($content))
602 602
 			{
603 603
 				$readonlys[$this->wizard_content_template] = true;
604 604
 				$preserve = $content;
@@ -607,21 +607,21 @@  discard block
 block discarded – undo
607 607
 
608 608
 			unset($content['button']);
609 609
 			$content['wizard_content'] = $this->wizard_content_template;
610
-			$this->etpl->exec(self::_appname.'.importexport_definitions_ui.wizard',$content,$sel_options,$readonlys,$preserv,2);
610
+			$this->etpl->exec(self::_appname.'.importexport_definitions_ui.wizard', $content, $sel_options, $readonlys, $preserv, 2);
611 611
 		}
612 612
 		else
613 613
 		{
614 614
 			// initial content
615 615
 			$sel_options = $readonlys = $preserv = array();
616 616
 			$readonlys['button[previous]'] = true;
617
-			if($content['edit'])
617
+			if ($content['edit'])
618 618
 			{
619 619
 				unset ($content['edit']);
620 620
 			}
621 621
 
622 622
 			$this->wizard_content_template = $this->wizard_step10($content, $sel_options, $readonlys, $preserv);
623 623
 
624
-			if(!$this->can_edit($content))
624
+			if (!$this->can_edit($content))
625 625
 			{
626 626
 				$readonlys[$this->wizard_content_template] = true;
627 627
 				$preserve = $content;
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
 			}
630 630
 
631 631
 			$content['wizard_content'] = $this->wizard_content_template;
632
-			$this->etpl->exec(self::_appname.'.importexport_definitions_ui.wizard',$content,$sel_options,$readonlys,$preserv,2);
632
+			$this->etpl->exec(self::_appname.'.importexport_definitions_ui.wizard', $content, $sel_options, $readonlys, $preserv, 2);
633 633
 		}
634 634
 	}
635 635
 
@@ -640,31 +640,31 @@  discard block
 block discarded – undo
640 640
 	 * @param int $step_width
641 641
 	 * @return string containing function name of next step
642 642
 	 */
643
-	function get_step ($curr_step, $step_width)
643
+	function get_step($curr_step, $step_width)
644 644
 	{
645 645
 		/*if($content['plugin'] && $content['application']&& !is_object($this->plugin))
646 646
 		{
647 647
 			$plugin_definition =  $this->plugins[$content['application']][$content['plugin']]['definition'];
648 648
 			if($plugin_definition) $this->plugin = new $plugin_definition;
649 649
 		}*/
650
-		if(is_object($this->plugin) && is_array($this->plugin->steps))
650
+		if (is_object($this->plugin) && is_array($this->plugin->steps))
651 651
 		{
652
-			$steps = array_merge($this->steps,$this->plugin->steps);
653
-			$steps = array_flip($steps); asort($steps);	$steps = array_flip($steps);
652
+			$steps = array_merge($this->steps, $this->plugin->steps);
653
+			$steps = array_flip($steps); asort($steps); $steps = array_flip($steps);
654 654
 		}
655 655
 		else
656 656
 		{
657 657
 			$steps = $this->steps;
658 658
 		}
659 659
 		$step_keys = array_keys($steps);
660
-		$nn = array_search($curr_step,$step_keys)+(int)$step_width;
661
-		return (key_exists($nn,$step_keys)) ? $step_keys[$nn] : 'wizard_finish';
660
+		$nn = array_search($curr_step, $step_keys) + (int)$step_width;
661
+		return (key_exists($nn, $step_keys)) ? $step_keys[$nn] : 'wizard_finish';
662 662
 	}
663 663
 
664 664
 
665 665
 	function wizard_step10(&$content, &$sel_options, &$readonlys, &$preserv)
666 666
 	{
667
-		if(self::_debug) error_log('importexport.importexport_definitions_ui::wizard_step10->$content '.print_r($content,true));
667
+		if (self::_debug) error_log('importexport.importexport_definitions_ui::wizard_step10->$content '.print_r($content, true));
668 668
 
669 669
 		// return from step10
670 670
 		if ($content['step'] == 'wizard_step10')
@@ -672,11 +672,11 @@  discard block
 block discarded – undo
672 672
 			switch (array_search('pressed', $content['button']))
673 673
 			{
674 674
 				case 'next':
675
-					return $this->get_step($content['step'],1);
675
+					return $this->get_step($content['step'], 1);
676 676
 				case 'finish':
677 677
 					return 'wizard_finish';
678 678
 				default :
679
-					return $this->wizard_step10($content,$sel_options,$readonlys,$preserv);
679
+					return $this->wizard_step10($content, $sel_options, $readonlys, $preserv);
680 680
 			}
681 681
 
682 682
 		}
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 			$content['text'] = $this->steps['wizard_step10'];
687 687
 			foreach ($this->plugins as $appname => $options)
688 688
 			{
689
-				if($GLOBALS['egw_info']['user']['apps'][$appname] || $GLOBALS['egw_info']['user']['apps']['admin']) {
689
+				if ($GLOBALS['egw_info']['user']['apps'][$appname] || $GLOBALS['egw_info']['user']['apps']['admin']) {
690 690
 					$sel_options['application'][$appname] = lang($appname);
691 691
 				}
692 692
 			}
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 	// get plugin
703 703
 	function wizard_step20(&$content, &$sel_options, &$readonlys, &$preserv)
704 704
 	{
705
-		if(self::_debug) error_log('importexport.' . get_class($this) . '::wizard_step20->$content '.print_r($content,true));
705
+		if (self::_debug) error_log('importexport.'.get_class($this).'::wizard_step20->$content '.print_r($content, true));
706 706
 
707 707
 		// return from step20
708 708
 		if ($content['step'] == 'wizard_step20')
@@ -711,21 +711,21 @@  discard block
 block discarded – undo
711 711
 			{
712 712
 				case 'next':
713 713
 					// There's no real reason the plugin has to come from any of these, as long as it has a $steps variable
714
-					if($this->plugin instanceof importexport_iface_import_plugin || $this->plugin instanceof importexport_wizard_basic_import_csv || strpos(get_class($this->plugin), 'import') !== false) {
714
+					if ($this->plugin instanceof importexport_iface_import_plugin || $this->plugin instanceof importexport_wizard_basic_import_csv || strpos(get_class($this->plugin), 'import') !== false) {
715 715
 						$content['type'] = 'import';
716
-					} elseif($this->plugin instanceof importexport_iface_export_plugin || $this->plugin instanceof importexport_wizard_basic_export_csv || strpos(get_class($this->plugin),'export') !== false) {
716
+					} elseif ($this->plugin instanceof importexport_iface_export_plugin || $this->plugin instanceof importexport_wizard_basic_export_csv || strpos(get_class($this->plugin), 'export') !== false) {
717 717
 						$content['type'] = 'export';
718 718
 					} else {
719 719
 						throw new egw_exception('Invalid plugin');
720 720
 					}
721
-					return $this->get_step($content['step'],1);
721
+					return $this->get_step($content['step'], 1);
722 722
 				case 'previous' :
723 723
 					$readonlys['button[previous]'] = true;
724
-					return $this->get_step($content['step'],-1);
724
+					return $this->get_step($content['step'], -1);
725 725
 				case 'finish':
726 726
 					return 'wizard_finish';
727 727
 				default :
728
-					return $this->wizard_step20($content,$sel_options,$readonlys,$preserv);
728
+					return $this->wizard_step20($content, $sel_options, $readonlys, $preserv);
729 729
 			}
730 730
 		}
731 731
 		// init step20
@@ -734,8 +734,8 @@  discard block
 block discarded – undo
734 734
 			$content['text'] = $this->steps['wizard_step20'];
735 735
 			$config = config::read('phpgwapi');
736 736
 			foreach ($this->plugins[$content['application']] as $type => $plugins) {
737
-				if($config['export_limit'] == 'no' && !$GLOBALS['egw_info']['user']['apps']['admin'] && $type == 'export') continue;
738
-				foreach($plugins as $plugin => $name) {
737
+				if ($config['export_limit'] == 'no' && !$GLOBALS['egw_info']['user']['apps']['admin'] && $type == 'export') continue;
738
+				foreach ($plugins as $plugin => $name) {
739 739
 					$sel_options['plugin'][$plugin] = $name;
740 740
 				}
741 741
 			}
@@ -751,15 +751,15 @@  discard block
 block discarded – undo
751 751
 	// name
752 752
 	function wizard_step21(&$content, &$sel_options, &$readonlys, &$preserv)
753 753
 	{
754
-		if(self::_debug) error_log('importexport.importexport_definitions_ui::wizard_step21->$content '.print_r($content,true));
754
+		if (self::_debug) error_log('importexport.importexport_definitions_ui::wizard_step21->$content '.print_r($content, true));
755 755
 
756 756
 		// Check for duplicate name
757 757
 		$duplicate = isset($content['duplicate_error']);
758
-		if($content['name'] && !$duplicate)
758
+		if ($content['name'] && !$duplicate)
759 759
 		{
760 760
 			try {
761 761
 				$check_definition = new importexport_definition($content['name']);
762
-				if($check_definition && $check_definition->definition_id && $check_definition->definition_id != $content['definition_id'])
762
+				if ($check_definition && $check_definition->definition_id && $check_definition->definition_id != $content['definition_id'])
763 763
 				{
764 764
 					throw new Exception('Already exists');
765 765
 				}
@@ -769,21 +769,21 @@  discard block
 block discarded – undo
769 769
 
770 770
 				// Try some suggestions
771 771
 				$suggestions = array(
772
-					$content['name'] .'-'. $GLOBALS['egw_info']['user']['account_lid'],
773
-					$content['name'] .'-'. $GLOBALS['egw_info']['user']['account_id'],
774
-					$content['name'] .'-'. egw_time::to('now', true),
772
+					$content['name'].'-'.$GLOBALS['egw_info']['user']['account_lid'],
773
+					$content['name'].'-'.$GLOBALS['egw_info']['user']['account_id'],
774
+					$content['name'].'-'.egw_time::to('now', true),
775 775
 					//$content['name'] .'-'. rand(0,100),
776 776
 				);
777
-				foreach($suggestions as $key => $suggestion) {
777
+				foreach ($suggestions as $key => $suggestion) {
778 778
 					$sug_definition = new importexport_definition($suggestion);
779
-					if($sug_definition->definition_id) {
779
+					if ($sug_definition->definition_id) {
780 780
 						unset($suggestions[$key]);
781 781
 					}
782 782
 				}
783
-				if($suggestions) {
784
-					$content['duplicate_error'] .= '  '. lang('Try')." \n" . implode("\n", $suggestions);
783
+				if ($suggestions) {
784
+					$content['duplicate_error'] .= '  '.lang('Try')." \n".implode("\n", $suggestions);
785 785
 				}
786
-				return $this->get_step($content['step'],0);
786
+				return $this->get_step($content['step'], 0);
787 787
 			}
788 788
 		}
789 789
 
@@ -793,19 +793,19 @@  discard block
 block discarded – undo
793 793
 			switch (array_search('pressed', $content['button']))
794 794
 			{
795 795
 				case 'next':
796
-					return $this->get_step($content['step'],1);
796
+					return $this->get_step($content['step'], 1);
797 797
 				case 'previous' :
798
-					return $this->get_step($content['step'],-1);
798
+					return $this->get_step($content['step'], -1);
799 799
 				case 'finish':
800 800
 					return 'wizard_finish';
801 801
 				default :
802
-					return $this->wizard_step21($content,$sel_options,$readonlys,$preserv);
802
+					return $this->wizard_step21($content, $sel_options, $readonlys, $preserv);
803 803
 			}
804 804
 		}
805 805
 		// init step21
806 806
 		else
807 807
 		{
808
-			$content['text'] = $this->steps['wizard_step21'] . ($duplicate ? "\n".$content['duplicate_error'] : '');
808
+			$content['text'] = $this->steps['wizard_step21'].($duplicate ? "\n".$content['duplicate_error'] : '');
809 809
 			$content['step'] = 'wizard_step21';
810 810
 			unset($content['duplicate_error']);
811 811
 			$preserv = $content;
@@ -817,17 +817,16 @@  discard block
 block discarded – undo
817 817
 	// allowed users
818 818
 	function wizard_step90(&$content, &$sel_options, &$readonlys, &$preserv)
819 819
 	{
820
-		if(self::_debug) error_log('importexport.importexport_definitions_ui::wizard_step90->$content '.print_r($content,true));
820
+		if (self::_debug) error_log('importexport.importexport_definitions_ui::wizard_step90->$content '.print_r($content, true));
821 821
 
822 822
 		// return from step90
823 823
 		if ($content['step'] == 'wizard_step90')
824 824
 		{
825
-			if($this->can_edit($content))
825
+			if ($this->can_edit($content))
826 826
 			{
827
-				$content['owner'] = $content['just_me'] || !$GLOBALS['egw']->acl->check('share_definitions', EGW_ACL_READ,'importexport') ?
828
-					($content['owner'] ? $content['owner'] : $GLOBALS['egw_info']['user']['account_id']) :
829
-					null;
830
-				$content['allowed_users'] = $content['just_me'] ? '' : ($content['all_users'] ? 'all' : implode(',',$content['allowed_users']));
827
+				$content['owner'] = $content['just_me'] || !$GLOBALS['egw']->acl->check('share_definitions', EGW_ACL_READ, 'importexport') ?
828
+					($content['owner'] ? $content['owner'] : $GLOBALS['egw_info']['user']['account_id']) : null;
829
+				$content['allowed_users'] = $content['just_me'] ? '' : ($content['all_users'] ? 'all' : implode(',', $content['allowed_users']));
831 830
 				unset($content['just_me']);
832 831
 			}
833 832
 
@@ -835,12 +834,12 @@  discard block
 block discarded – undo
835 834
 			switch (array_search('pressed', $content['button']))
836 835
 			{
837 836
 				case 'previous' :
838
-					return $this->get_step($content['step'],-1);
837
+					return $this->get_step($content['step'], -1);
839 838
 				case 'next':
840 839
 				case 'finish':
841 840
 					return 'wizard_finish';
842 841
 				default :
843
-					return $this->wizard_step90($content,$sel_options,$readonlys,$preserv);
842
+					return $this->wizard_step90($content, $sel_options, $readonlys, $preserv);
844 843
 			}
845 844
 		}
846 845
 		// init step90
@@ -851,10 +850,10 @@  discard block
 block discarded – undo
851 850
 			$preserv = $content;
852 851
 
853 852
 			// Set owner for non-admins
854
-			$content['just_me'] = ((!$content['allowed_users'] || !$content['allowed_users'][0] && count($content['allowed_users']) ==1) && $content['owner']);
855
-			$content['all_users'] = is_array($content['allowed_users']) && array_key_exists('0',$content['allowed_users']) && $content['allowed_users'][0] == 'all' ||
853
+			$content['just_me'] = ((!$content['allowed_users'] || !$content['allowed_users'][0] && count($content['allowed_users']) == 1) && $content['owner']);
854
+			$content['all_users'] = is_array($content['allowed_users']) && array_key_exists('0', $content['allowed_users']) && $content['allowed_users'][0] == 'all' ||
856 855
 			$content['allowed_users'] == 'all';
857
-			if(!$GLOBALS['egw']->acl->check('share_definition', EGW_ACL_READ, 'importexport') && !$GLOBALS['egw_info']['user']['apps']['admin'])
856
+			if (!$GLOBALS['egw']->acl->check('share_definition', EGW_ACL_READ, 'importexport') && !$GLOBALS['egw_info']['user']['apps']['admin'])
858 857
 			{
859 858
 				$content['allowed_users'] = array();
860 859
 				$readonlys['allowed_users'] = true;
@@ -870,11 +869,11 @@  discard block
 block discarded – undo
870 869
 				)
871 870
 			);
872 871
 			// Hide 'just me' checkbox, users get confused by read-only
873
-			if($readonlys['just_me'] || !$this->can_edit($content))
872
+			if ($readonlys['just_me'] || !$this->can_edit($content))
874 873
 			{
875 874
 				$content['no_just_me'] = true;
876 875
 			}
877
-			if($readonlys['all_users'] || !$this->can_edit($content))
876
+			if ($readonlys['all_users'] || !$this->can_edit($content))
878 877
 			{
879 878
 				$content['no_all_users'] = true;
880 879
 			}
@@ -887,7 +886,7 @@  discard block
 block discarded – undo
887 886
 
888 887
 	function wizard_finish(&$content)
889 888
 	{
890
-		if(self::_debug) error_log('importexport.importexport_definitions_ui::wizard_finish->$content '.print_r($content,true));
889
+		if (self::_debug) error_log('importexport.importexport_definitions_ui::wizard_finish->$content '.print_r($content, true));
891 890
 		// Take out some UI leavings
892 891
 		unset($content['text']);
893 892
 		unset($content['step']);
@@ -897,26 +896,26 @@  discard block
 block discarded – undo
897 896
 		$bodefinitions->save($content);
898 897
 		// This message is displayed if browser cant close window
899 898
 		$content['msg'] = lang('ImportExport wizard finished successfully!');
900
-		egw_framework::refresh_opener('','importexport');
899
+		egw_framework::refresh_opener('', 'importexport');
901 900
 		egw_framework::window_close();
902 901
 		return 'importexport.wizard_close';
903 902
 	}
904 903
 
905
-	function import_definition($content='')
904
+	function import_definition($content = '')
906 905
 	{
907 906
 		$bodefinitions = new importexport_definitions_bo();
908 907
 		if (is_array($content))
909 908
 		{
910
-			if($content['import_file']['tmp_name'])
909
+			if ($content['import_file']['tmp_name'])
911 910
 			{
912 911
 				$result = $bodefinitions->import($content['import_file']['tmp_name']);
913
-				$msg = lang('%1 definitions %2', count($result), lang('imported')) ."\n". implode("\n", array_keys($result));
912
+				$msg = lang('%1 definitions %2', count($result), lang('imported'))."\n".implode("\n", array_keys($result));
914 913
 				return $this->index(null, $msg);
915 914
 			}
916
-			if($content['update'])
915
+			if ($content['update'])
917 916
 			{
918 917
 				$applist = importexport_helper_functions::get_apps('all', true);
919
-				foreach($applist as $appname) {
918
+				foreach ($applist as $appname) {
920 919
 					importexport_helper_functions::load_defaults($appname);
921 920
 				}
922 921
 				return $this->index();
@@ -926,7 +925,7 @@  discard block
 block discarded – undo
926 925
 		{
927 926
 			$content = array();
928 927
 			$etpl = new etemplate(self::_appname.'.import_definition');
929
-			return $etpl->exec(self::_appname.'.importexport_definitions_ui.import_definition',$content,array(),$readonlys,$preserv);
928
+			return $etpl->exec(self::_appname.'.importexport_definitions_ui.import_definition', $content, array(), $readonlys, $preserv);
930 929
 		}
931 930
 	}
932 931
 
@@ -936,17 +935,17 @@  discard block
 block discarded – undo
936 935
 	 */
937 936
 	protected function can_edit(Array $definition)
938 937
 	{
939
-		if($definition['owner'] && $definition['owner'] == $GLOBALS['egw_info']['user']['account_id'])
938
+		if ($definition['owner'] && $definition['owner'] == $GLOBALS['egw_info']['user']['account_id'])
940 939
 		{
941 940
 			// Definition belongs to user
942 941
 			return true;
943 942
 		}
944
-		elseif($definition['definition_id'] && !$definition['owner'] && $GLOBALS['egw_info']['user']['apps']['admin'])
943
+		elseif ($definition['definition_id'] && !$definition['owner'] && $GLOBALS['egw_info']['user']['apps']['admin'])
945 944
 		{
946 945
 			// Definition is unowned, and user is an admin
947 946
 			return true;
948 947
 		}
949
-		elseif(!$definition['definition_id'])
948
+		elseif (!$definition['definition_id'])
950 949
 		{
951 950
 			// Definition is in-progress, not saved yet
952 951
 			return true;
@@ -959,26 +958,26 @@  discard block
 block discarded – undo
959 958
 	 */
960 959
 	public function site_config($content = array())
961 960
 	{
962
-		if(!$GLOBALS['egw_info']['user']['apps']['admin'])
961
+		if (!$GLOBALS['egw_info']['user']['apps']['admin'])
963 962
 		{
964 963
 			egw::redirect_link('/home');
965 964
 		}
966
-		if($content['save'])
965
+		if ($content['save'])
967 966
 		{
968 967
 			unset($content['save']);
969 968
 
970 969
 			// ACL
971
-			$GLOBALS['egw']->acl->delete_repository(self::_appname, 'definition',false);
972
-			$GLOBALS['egw']->acl->delete_repository(self::_appname, 'share_definition',false);
970
+			$GLOBALS['egw']->acl->delete_repository(self::_appname, 'definition', false);
971
+			$GLOBALS['egw']->acl->delete_repository(self::_appname, 'share_definition', false);
973 972
 
974
-			foreach($content['share_definition'] as $group)
973
+			foreach ($content['share_definition'] as $group)
975 974
 			{
976
-				$GLOBALS['egw']->acl->add_repository(self::_appname, 'share_definition', $group,EGW_ACL_READ);
975
+				$GLOBALS['egw']->acl->add_repository(self::_appname, 'share_definition', $group, EGW_ACL_READ);
977 976
 			}
978 977
 			unset($content['share_definition']);
979 978
 
980 979
 			// Other config
981
-			foreach($content as $key=>$value)
980
+			foreach ($content as $key=>$value)
982 981
 			{
983 982
 				config::save_value($key, $value, 'importexport');
984 983
 			}
@@ -988,18 +987,18 @@  discard block
 block discarded – undo
988 987
 
989 988
 		$data = config::read(self::_appname);
990 989
 		$data['share_definition'] = $GLOBALS['egw']->acl->get_ids_for_location('share_definition', EGW_ACL_READ, self::_appname);
991
-		$sel_options['import_charsets'] = array_combine(mb_list_encodings(),mb_list_encodings());
990
+		$sel_options['import_charsets'] = array_combine(mb_list_encodings(), mb_list_encodings());
992 991
 
993 992
 		// Remove 'standard' encodings to prevent doubles
994
-		foreach($GLOBALS['egw']->translation->get_installed_charsets() as $charset => $label)
993
+		foreach ($GLOBALS['egw']->translation->get_installed_charsets() as $charset => $label)
995 994
 		{
996 995
 			unset($sel_options['import_charsets'][strtoupper($charset)]);
997 996
 		}
998 997
 
999
-		if(!$data['update']) $data['update'] = 'request';
998
+		if (!$data['update']) $data['update'] = 'request';
1000 999
 
1001
-		$GLOBALS['egw_info']['flags']['app_header'] = lang('Site configuration') . ' - ' . lang(self::_appname);
1000
+		$GLOBALS['egw_info']['flags']['app_header'] = lang('Site configuration').' - '.lang(self::_appname);
1002 1001
 		$etpl = new etemplate(self::_appname.'.config');
1003
-		$etpl->exec(self::_appname.'.importexport_definitions_ui.site_config',$data,$sel_options,$readonlys,$preserv);
1002
+		$etpl->exec(self::_appname.'.importexport_definitions_ui.site_config', $data, $sel_options, $readonlys, $preserv);
1004 1003
 	}
1005 1004
 }
Please login to merge, or discard this patch.
Braces   +121 added lines, -45 removed lines patch added patch discarded remove patch
@@ -82,14 +82,18 @@  discard block
 block discarded – undo
82 82
 	{
83 83
 		$filter = array('name' => '*');
84 84
 
85
-		if($GLOBALS['egw_info']['user']['apps']['admin']) {
85
+		if($GLOBALS['egw_info']['user']['apps']['admin'])
86
+		{
86 87
 			// Any public definition
87 88
 			$filter[] = '(owner=0 OR owner IS NULL OR allowed_users IS NOT NULL OR owner = ' . $GLOBALS['egw_info']['user']['account_id'] . ')';
88
-		} else {
89
+		}
90
+		else
91
+		{
89 92
 			// Filter private definitions
90 93
 			$filter['owner'] = $GLOBALS['egw_info']['user']['account_id'];
91 94
 			$config = config::read('phpgwapi');
92
-			if($config['export_limit'] == 'no' && !bo_merge::is_export_limit_excepted()) {
95
+			if($config['export_limit'] == 'no' && !bo_merge::is_export_limit_excepted())
96
+			{
93 97
 				$filter['type'] = 'import';
94 98
 			}
95 99
 		}
@@ -105,7 +109,10 @@  discard block
 block discarded – undo
105 109
 			elseif(($button = array_search('pressed',$content['nm']['rows'])) !== false)
106 110
 			{
107 111
 				$selected = $content['nm']['rows']['selected'];
108
-				if(count($selected) < 1 || !is_array($selected)) common::egw_exit();
112
+				if(count($selected) < 1 || !is_array($selected))
113
+				{
114
+					common::egw_exit();
115
+				}
109 116
 				switch ($button)
110 117
 				{
111 118
 					case 'delete_selected' :
@@ -161,7 +168,8 @@  discard block
 block discarded – undo
161 168
 			}
162 169
 		}
163 170
 
164
-		if(!is_array($content['nm'])) {
171
+		if(!is_array($content['nm']))
172
+		{
165 173
 			$content['nm'] = array(
166 174
 				'get_rows'	=> 'importexport.importexport_definitions_ui.get_rows',
167 175
 				'no_cat'	=> true,
@@ -172,7 +180,10 @@  discard block
 block discarded – undo
172 180
 				'row_id'	=> 'definition_id',
173 181
 				'placeholder_actions' => array('add')
174 182
 			);
175
-			if($_GET['application']) $content['nm']['col_filter']['application'] = $_GET['application'];
183
+			if($_GET['application'])
184
+			{
185
+				$content['nm']['col_filter']['application'] = $_GET['application'];
186
+			}
176 187
 		}
177 188
 		if(egw_session::appsession('index', 'importexport'))
178 189
 		{
@@ -191,17 +202,22 @@  discard block
 block discarded – undo
191 202
 		);
192 203
 		foreach ($this->plugins as $appname => $options)
193 204
 		{
194
-			if($GLOBALS['egw_info']['user']['apps'][$appname] || $GLOBALS['egw_info']['user']['apps']['admin']) {
205
+			if($GLOBALS['egw_info']['user']['apps'][$appname] || $GLOBALS['egw_info']['user']['apps']['admin'])
206
+			{
195 207
 				$sel_options['application'][$appname] = lang($appname);
196 208
 			}
197 209
 		}
198
-		if($msg) $content['msg'] = $msg;
210
+		if($msg)
211
+		{
212
+			$content['msg'] = $msg;
213
+		}
199 214
 
200 215
 		$etpl = new etemplate_new(self::_appname.'.definition_index');
201 216
 		return $etpl->exec( self::_appname.'.importexport_definitions_ui.index', $content, $sel_options, $readonlys, $preserv );
202 217
 	}
203 218
 
204
-	private function get_actions() {
219
+	private function get_actions()
220
+	{
205 221
 		$group = 0;
206 222
 		$actions = array(
207 223
 			'edit' => array(
@@ -320,7 +336,8 @@  discard block
 block discarded – undo
320 336
 			$this->get_rows($query,$rows,$readonlys);
321 337
 
322 338
 			$selected = array();
323
-			foreach($rows as $row) {
339
+			foreach($rows as $row)
340
+			{
324 341
 				$selected[] = $row['definition_id'];
325 342
 			}
326 343
 			if(!is_array($session_name))
@@ -335,10 +352,12 @@  discard block
 block discarded – undo
335 352
 
336 353
 		$bodefinitions = new importexport_definitions_bo(false, true);
337 354
 
338
-		switch($action) {
355
+		switch($action)
356
+		{
339 357
 			case 'execute':
340 358
 				// There's probably a way to do this in just JS, all the info should be there...
341
-				foreach($selected as $id) {
359
+				foreach($selected as $id)
360
+				{
342 361
 					$definition = $bodefinitions->read((int)$id);
343 362
 					$link = egw::link('/index.php', array(
344 363
 						'menuaction' => 'importexport.importexport_'.$definition['type'].'_ui.'.$definition['type'].'_dialog',
@@ -352,11 +371,16 @@  discard block
 block discarded – undo
352 371
 				$action = 'allowed_users';// Field is allowed_users, popup doesn't like _
353 372
 			case 'owner':
354 373
 				$action_msg = lang('changed'. ' ' . $action);
355
-				foreach($selected as $id) {
374
+				foreach($selected as $id)
375
+				{
356 376
 					$definition = $bodefinitions->read((int)$id);
357
-					if($definition['definition_id']) {
377
+					if($definition['definition_id'])
378
+					{
358 379
 						// Prevent private with no owner
359
-						if(!$definition['owner'] && !$settings) $definition['owner'] = $GLOBALS['egw_info']['user']['account_id'];
380
+						if(!$definition['owner'] && !$settings)
381
+						{
382
+							$definition['owner'] = $GLOBALS['egw_info']['user']['account_id'];
383
+						}
360 384
 
361 385
 						$definition[$action] = $settings;
362 386
 						$bodefinitions->save($definition);
@@ -383,18 +407,22 @@  discard block
 block discarded – undo
383 407
 			case 'copy':
384 408
 				$action_msg = lang('copied');
385 409
 				// Should only be one selected
386
-				foreach($selected as $id) {
410
+				foreach($selected as $id)
411
+				{
387 412
 					$definition = $bodefinitions->read((int)$id);
388
-					if($definition['definition_id']) {
413
+					if($definition['definition_id'])
414
+					{
389 415
 						unset($definition['definition_id']);
390 416
 						$definition['name'] = $settings ? $settings : $definition['name'] . ' copy';
391 417
 						try {
392 418
 							$bodefinitions->save($definition);
393
-						} catch (Exception $e) {
419
+						}
420
+						catch (Exception $e) {
394 421
 							try {
395 422
 								$definition['name'] .= ' ' . $GLOBALS['egw_info']['user']['account_lid'];
396 423
 								$bodefinitions->save($definition);
397
-							} catch (Exception $ex) {
424
+							}
425
+							catch (Exception $ex) {
398 426
 								$failed++;
399 427
 								$msg .= lang('Duplicate name, please choose another.');
400 428
 								continue;
@@ -407,18 +435,21 @@  discard block
 block discarded – undo
407 435
 			case 'createexport':
408 436
 				$action_msg = lang('created');
409 437
 				// Should only be one selected
410
-				foreach($selected as $id) {
438
+				foreach($selected as $id)
439
+				{
411 440
 					$definition = new importexport_definition($id);
412 441
 					try {
413 442
 						$export = $bodefinitions->export_from_import($definition);
414 443
 						$export->save();
415
-					} catch (Exception $e) {
444
+					}
445
+					catch (Exception $e) {
416 446
 						if($export)
417 447
 						{
418 448
 							try {
419 449
 								$export->name = $export->name.' ' . $GLOBALS['egw_info']['user']['account_lid'];
420 450
 								$export->save();
421
-							} catch (Exception $ex) {
451
+							}
452
+							catch (Exception $ex) {
422 453
 								$failed++;
423 454
 								$msg .= lang('Duplicate name, please choose another.');
424 455
 								continue;
@@ -436,7 +467,8 @@  discard block
 block discarded – undo
436 467
 		return !$failed;
437 468
 	}
438 469
 
439
-	public function get_rows(&$query, &$rows, &$readonlys) {
470
+	public function get_rows(&$query, &$rows, &$readonlys)
471
+	{
440 472
 		$rows = array();
441 473
 		egw_session::appsession('index','importexport',$query);
442 474
 
@@ -511,7 +543,10 @@  discard block
 block discarded – undo
511 543
 
512 544
 		if(is_array($content) &&! $content['edit'])
513 545
 		{
514
-			if(self::_debug) error_log('importexport.wizard->$content '. print_r($content,true));
546
+			if(self::_debug)
547
+			{
548
+				error_log('importexport.wizard->$content '. print_r($content,true));
549
+			}
515 550
 			//foreach($content as $key => $val) error_log(" $key : ".array2string($val));
516 551
 			// fetch plugin object
517 552
 			if($content['plugin'] && $content['application'])
@@ -528,13 +563,18 @@  discard block
 block discarded – undo
528 563
 					$wizard_plugin = $content['plugin'];
529 564
 				}
530 565
 				// App translations
531
-				if($content['application']) translation::add_app($content['application']);
566
+				if($content['application'])
567
+				{
568
+					translation::add_app($content['application']);
569
+				}
532 570
 
533 571
 				$this->plugin = is_object($GLOBALS['egw']->$wizard_plugin) ? $GLOBALS['egw']->$wizard_plugin : new $wizard_plugin;
534 572
 
535 573
 				// Global object needs to be the same, or references to plugin don't work
536 574
 				if(!is_object($GLOBALS['egw']->importexport_definitions_ui) || $GLOBALS['egw']->importexport_definitions_ui !== $this)
537
-					$GLOBALS['egw']->importexport_definitions_ui =& $this;
575
+				{
576
+									$GLOBALS['egw']->importexport_definitions_ui =& $this;
577
+				}
538 578
 			}
539 579
 			// deal with buttons even if we are not on ajax
540 580
 			if(isset($content['button']) && array_search('pressed',$content['button']) === false && count($content['button']) == 1)
@@ -664,7 +704,10 @@  discard block
 block discarded – undo
664 704
 
665 705
 	function wizard_step10(&$content, &$sel_options, &$readonlys, &$preserv)
666 706
 	{
667
-		if(self::_debug) error_log('importexport.importexport_definitions_ui::wizard_step10->$content '.print_r($content,true));
707
+		if(self::_debug)
708
+		{
709
+			error_log('importexport.importexport_definitions_ui::wizard_step10->$content '.print_r($content,true));
710
+		}
668 711
 
669 712
 		// return from step10
670 713
 		if ($content['step'] == 'wizard_step10')
@@ -686,7 +729,8 @@  discard block
 block discarded – undo
686 729
 			$content['text'] = $this->steps['wizard_step10'];
687 730
 			foreach ($this->plugins as $appname => $options)
688 731
 			{
689
-				if($GLOBALS['egw_info']['user']['apps'][$appname] || $GLOBALS['egw_info']['user']['apps']['admin']) {
732
+				if($GLOBALS['egw_info']['user']['apps'][$appname] || $GLOBALS['egw_info']['user']['apps']['admin'])
733
+				{
690 734
 					$sel_options['application'][$appname] = lang($appname);
691 735
 				}
692 736
 			}
@@ -702,7 +746,10 @@  discard block
 block discarded – undo
702 746
 	// get plugin
703 747
 	function wizard_step20(&$content, &$sel_options, &$readonlys, &$preserv)
704 748
 	{
705
-		if(self::_debug) error_log('importexport.' . get_class($this) . '::wizard_step20->$content '.print_r($content,true));
749
+		if(self::_debug)
750
+		{
751
+			error_log('importexport.' . get_class($this) . '::wizard_step20->$content '.print_r($content,true));
752
+		}
706 753
 
707 754
 		// return from step20
708 755
 		if ($content['step'] == 'wizard_step20')
@@ -711,11 +758,16 @@  discard block
 block discarded – undo
711 758
 			{
712 759
 				case 'next':
713 760
 					// There's no real reason the plugin has to come from any of these, as long as it has a $steps variable
714
-					if($this->plugin instanceof importexport_iface_import_plugin || $this->plugin instanceof importexport_wizard_basic_import_csv || strpos(get_class($this->plugin), 'import') !== false) {
761
+					if($this->plugin instanceof importexport_iface_import_plugin || $this->plugin instanceof importexport_wizard_basic_import_csv || strpos(get_class($this->plugin), 'import') !== false)
762
+					{
715 763
 						$content['type'] = 'import';
716
-					} elseif($this->plugin instanceof importexport_iface_export_plugin || $this->plugin instanceof importexport_wizard_basic_export_csv || strpos(get_class($this->plugin),'export') !== false) {
764
+					}
765
+					elseif($this->plugin instanceof importexport_iface_export_plugin || $this->plugin instanceof importexport_wizard_basic_export_csv || strpos(get_class($this->plugin),'export') !== false)
766
+					{
717 767
 						$content['type'] = 'export';
718
-					} else {
768
+					}
769
+					else
770
+					{
719 771
 						throw new egw_exception('Invalid plugin');
720 772
 					}
721 773
 					return $this->get_step($content['step'],1);
@@ -733,9 +785,14 @@  discard block
 block discarded – undo
733 785
 		{
734 786
 			$content['text'] = $this->steps['wizard_step20'];
735 787
 			$config = config::read('phpgwapi');
736
-			foreach ($this->plugins[$content['application']] as $type => $plugins) {
737
-				if($config['export_limit'] == 'no' && !$GLOBALS['egw_info']['user']['apps']['admin'] && $type == 'export') continue;
738
-				foreach($plugins as $plugin => $name) {
788
+			foreach ($this->plugins[$content['application']] as $type => $plugins)
789
+			{
790
+				if($config['export_limit'] == 'no' && !$GLOBALS['egw_info']['user']['apps']['admin'] && $type == 'export')
791
+				{
792
+					continue;
793
+				}
794
+				foreach($plugins as $plugin => $name)
795
+				{
739 796
 					$sel_options['plugin'][$plugin] = $name;
740 797
 				}
741 798
 			}
@@ -751,7 +808,10 @@  discard block
 block discarded – undo
751 808
 	// name
752 809
 	function wizard_step21(&$content, &$sel_options, &$readonlys, &$preserv)
753 810
 	{
754
-		if(self::_debug) error_log('importexport.importexport_definitions_ui::wizard_step21->$content '.print_r($content,true));
811
+		if(self::_debug)
812
+		{
813
+			error_log('importexport.importexport_definitions_ui::wizard_step21->$content '.print_r($content,true));
814
+		}
755 815
 
756 816
 		// Check for duplicate name
757 817
 		$duplicate = isset($content['duplicate_error']);
@@ -763,7 +823,8 @@  discard block
 block discarded – undo
763 823
 				{
764 824
 					throw new Exception('Already exists');
765 825
 				}
766
-			} catch (Exception $e) {
826
+			}
827
+			catch (Exception $e) {
767 828
 			//		throw new Exception('Already exists');
768 829
 				$content['duplicate_error'] = lang('Duplicate name, please choose another.');
769 830
 
@@ -774,13 +835,16 @@  discard block
 block discarded – undo
774 835
 					$content['name'] .'-'. egw_time::to('now', true),
775 836
 					//$content['name'] .'-'. rand(0,100),
776 837
 				);
777
-				foreach($suggestions as $key => $suggestion) {
838
+				foreach($suggestions as $key => $suggestion)
839
+				{
778 840
 					$sug_definition = new importexport_definition($suggestion);
779
-					if($sug_definition->definition_id) {
841
+					if($sug_definition->definition_id)
842
+					{
780 843
 						unset($suggestions[$key]);
781 844
 					}
782 845
 				}
783
-				if($suggestions) {
846
+				if($suggestions)
847
+				{
784 848
 					$content['duplicate_error'] .= '  '. lang('Try')." \n" . implode("\n", $suggestions);
785 849
 				}
786 850
 				return $this->get_step($content['step'],0);
@@ -817,7 +881,10 @@  discard block
 block discarded – undo
817 881
 	// allowed users
818 882
 	function wizard_step90(&$content, &$sel_options, &$readonlys, &$preserv)
819 883
 	{
820
-		if(self::_debug) error_log('importexport.importexport_definitions_ui::wizard_step90->$content '.print_r($content,true));
884
+		if(self::_debug)
885
+		{
886
+			error_log('importexport.importexport_definitions_ui::wizard_step90->$content '.print_r($content,true));
887
+		}
821 888
 
822 889
 		// return from step90
823 890
 		if ($content['step'] == 'wizard_step90')
@@ -887,7 +954,10 @@  discard block
 block discarded – undo
887 954
 
888 955
 	function wizard_finish(&$content)
889 956
 	{
890
-		if(self::_debug) error_log('importexport.importexport_definitions_ui::wizard_finish->$content '.print_r($content,true));
957
+		if(self::_debug)
958
+		{
959
+			error_log('importexport.importexport_definitions_ui::wizard_finish->$content '.print_r($content,true));
960
+		}
891 961
 		// Take out some UI leavings
892 962
 		unset($content['text']);
893 963
 		unset($content['step']);
@@ -916,7 +986,8 @@  discard block
 block discarded – undo
916 986
 			if($content['update'])
917 987
 			{
918 988
 				$applist = importexport_helper_functions::get_apps('all', true);
919
-				foreach($applist as $appname) {
989
+				foreach($applist as $appname)
990
+				{
920 991
 					importexport_helper_functions::load_defaults($appname);
921 992
 				}
922 993
 				return $this->index();
@@ -982,7 +1053,9 @@  discard block
 block discarded – undo
982 1053
 			{
983 1054
 				config::save_value($key, $value, 'importexport');
984 1055
 			}
985
-		} elseif (isset($content['cancel'])) {
1056
+		}
1057
+		elseif (isset($content['cancel']))
1058
+		{
986 1059
 			$GLOBALS['egw']->redirect_link('/admin/index.php');
987 1060
 		}
988 1061
 
@@ -996,7 +1069,10 @@  discard block
 block discarded – undo
996 1069
 			unset($sel_options['import_charsets'][strtoupper($charset)]);
997 1070
 		}
998 1071
 
999
-		if(!$data['update']) $data['update'] = 'request';
1072
+		if(!$data['update'])
1073
+		{
1074
+			$data['update'] = 'request';
1075
+		}
1000 1076
 
1001 1077
 		$GLOBALS['egw_info']['flags']['app_header'] = lang('Site configuration') . ' - ' . lang(self::_appname);
1002 1078
 		$etpl = new etemplate(self::_appname.'.config');
Please login to merge, or discard this patch.
admin/inc/class.admin_cmd_edit_user.inc.php 2 patches
Braces   +28 added lines, -7 removed lines patch added patch discarded remove patch
@@ -52,16 +52,22 @@  discard block
 block discarded – undo
52 52
 	protected function exec($check_only=false)
53 53
 	{
54 54
 		// check creator is still admin and not explicitly forbidden to edit accounts/groups
55
-		if ($this->creator) $this->_check_admin('account_access',$this->account ? 16 : 4);
55
+		if ($this->creator)
56
+		{
57
+			$this->_check_admin('account_access',$this->account ? 16 : 4);
58
+		}
56 59
 
57 60
 		admin_cmd::_instanciate_accounts();
58 61
 
59 62
 		$data = $this->set;
60 63
 		$data['account_type'] = 'u';
61 64
 
62
-		if ($this->account)	// existing account
65
+		if ($this->account)
66
+		{
67
+			// existing account
63 68
 		{
64 69
 			$data['account_id'] = admin_cmd::parse_account($this->account);
70
+		}
65 71
 			//error_log(__METHOD__."($check_only) this->account=".array2string($this->account).', data[account_id]='.array2string($data['account_id']).", ...)");
66 72
 
67 73
 			$data['old_loginid'] = admin_cmd::$accounts->id2name($data['account_id']);
@@ -91,9 +97,12 @@  discard block
 block discarded – undo
91 97
 			throw new Api\Exception\WrongUserinput(lang('The two passwords are not the same'),0);
92 98
 		}
93 99
 		$expires = self::_parse_expired($data['account_expires'],(boolean)$this->account);
94
-		if ($expires === 0)	// deactivated
100
+		if ($expires === 0)
101
+		{
102
+			// deactivated
95 103
 		{
96 104
 			$data['account_expires'] = -1;
105
+		}
97 106
 			$data['account_status'] = '';
98 107
 		}
99 108
 		else
@@ -133,7 +142,10 @@  discard block
 block discarded – undo
133 142
 			}
134 143
 			$data['account_groups'] = admin_cmd::parse_accounts($data['account_groups'],false);
135 144
 		}
136
-		if ($check_only) return true;
145
+		if ($check_only)
146
+		{
147
+			return true;
148
+		}
137 149
 
138 150
 		if ($this->account)
139 151
 		{
@@ -146,7 +158,10 @@  discard block
 block discarded – undo
146 158
 			// as the current account class always sets all values, we have to add the not specified ones
147 159
 			foreach($data as $name => &$value)
148 160
 			{
149
-				if (is_null($value)) $value = $old[$name];
161
+				if (is_null($value))
162
+				{
163
+					$value = $old[$name];
164
+				}
150 165
 			}
151 166
 		}
152 167
 		else
@@ -165,7 +180,10 @@  discard block
 block discarded – undo
165 180
 		}
166 181
 		// make new account_id available to caller
167 182
 		$update = (boolean)$this->account;
168
-		if (!$this->account) $this->account = $data['account_id'];
183
+		if (!$this->account)
184
+		{
185
+			$this->account = $data['account_id'];
186
+		}
169 187
 
170 188
 		if ($data['account_groups'])
171 189
 		{
@@ -236,7 +254,10 @@  discard block
 block discarded – undo
236 254
 		switch($str)
237 255
 		{
238 256
 			case '':
239
-				if ($existing) return null;
257
+				if ($existing)
258
+				{
259
+					return null;
260
+				}
240 261
 				// fall through --> default for new Api\Accounts is never
241 262
 			case 'never':
242 263
 				return -1;
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 * @param string $password =null password
24 24
 	 * @param boolean $run_addaccount_hook =null default run addaccount for new accounts and editaccount for existing ones
25 25
 	 */
26
-	function __construct($account,$set=null,$password=null,$run_addaccount_hook=null)
26
+	function __construct($account, $set = null, $password = null, $run_addaccount_hook = null)
27 27
 	{
28 28
 		if (!is_array($account))
29 29
 		{
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
 	 * @throws egw_exception_wrong_userinput(lang("Unknown account: %1 !!!",$this->account),15);
48 48
 	 * @throws egw_exception_wrong_userinput(lang('Error changing the password for %1 !!!',$this->account),99);
49 49
 	 */
50
-	protected function exec($check_only=false)
50
+	protected function exec($check_only = false)
51 51
 	{
52 52
 		// check creator is still admin and not explicitly forbidden to edit accounts/groups
53
-		if ($this->creator) $this->_check_admin('account_access',$this->account ? 16 : 4);
53
+		if ($this->creator) $this->_check_admin('account_access', $this->account ? 16 : 4);
54 54
 
55 55
 		admin_cmd::_instanciate_accounts();
56 56
 
@@ -66,29 +66,29 @@  discard block
 block discarded – undo
66 66
 		}
67 67
 		if (!$data['account_lid'] && (!$this->account || !is_null($data['account_lid'])))
68 68
 		{
69
-			throw new egw_exception_wrong_userinput(lang('You must enter a loginid'),9);
69
+			throw new egw_exception_wrong_userinput(lang('You must enter a loginid'), 9);
70 70
 		}
71 71
 		// Check if an account already exists as system user, and if it does deny creation
72 72
 		if ($GLOBALS['egw_info']['server']['account_repository'] == 'ldap' &&
73 73
 			!$GLOBALS['egw_info']['server']['ldap_allow_systemusernames'] && !$data['account_id'] &&
74 74
 			function_exists('posix_getpwnam') && posix_getpwnam($data['account_lid']))
75 75
 		{
76
-			throw new egw_exception_wrong_userinput(lang('There already is a system-user with this name. User\'s should not have the same name as a systemuser'),99);
76
+			throw new egw_exception_wrong_userinput(lang('There already is a system-user with this name. User\'s should not have the same name as a systemuser'), 99);
77 77
 		}
78 78
 		if (!$data['account_lastname'] && (!$this->account || !is_null($data['account_lastname'])))
79 79
 		{
80
-			throw new egw_exception_wrong_userinput(lang('You must enter a lastname'),9);
80
+			throw new egw_exception_wrong_userinput(lang('You must enter a lastname'), 9);
81 81
 		}
82
-		if (!is_null($data['account_lid']) && ($id = admin_cmd::$accounts->name2id($data['account_lid'],'account_lid','u')) &&
82
+		if (!is_null($data['account_lid']) && ($id = admin_cmd::$accounts->name2id($data['account_lid'], 'account_lid', 'u')) &&
83 83
 			(string)$id !== (string)$data['account_id'])
84 84
 		{
85
-			throw new egw_exception_wrong_userinput(lang('That loginid has already been taken'),999);
85
+			throw new egw_exception_wrong_userinput(lang('That loginid has already been taken'), 999);
86 86
 		}
87 87
 		if (isset($data['account_passwd_2']) && $data['account_passwd'] != $data['account_passwd_2'])
88 88
 		{
89
-			throw new egw_exception_wrong_userinput(lang('The two passwords are not the same'),0);
89
+			throw new egw_exception_wrong_userinput(lang('The two passwords are not the same'), 0);
90 90
 		}
91
-		$expires = self::_parse_expired($data['account_expires'],(boolean)$this->account);
91
+		$expires = self::_parse_expired($data['account_expires'], (boolean)$this->account);
92 92
 		if ($expires === 0)	// deactivated
93 93
 		{
94 94
 			$data['account_expires'] = -1;
@@ -100,16 +100,16 @@  discard block
 block discarded – undo
100 100
 			$data['account_status'] = is_null($expires) ? null : ($expires == -1 || $expires > time() ? 'A' : '');
101 101
 		}
102 102
 
103
-		$data['changepassword'] = admin_cmd::parse_boolean($data['changepassword'],$this->account ? null : true);
104
-		$data['anonymous'] = admin_cmd::parse_boolean($data['anonymous'],$this->account ? null : false);
103
+		$data['changepassword'] = admin_cmd::parse_boolean($data['changepassword'], $this->account ? null : true);
104
+		$data['anonymous'] = admin_cmd::parse_boolean($data['anonymous'], $this->account ? null : false);
105 105
 		if ($data['mustchangepassword'] && $data['changepassword'])
106 106
 		{
107
-			$data['account_lastpwd_change']=0;
107
+			$data['account_lastpwd_change'] = 0;
108 108
 		}
109 109
 
110 110
 		if (!$data['account_primary_group'] && $this->account)
111 111
 		{
112
-			$data['account_primary_group'] = null;	// dont change
112
+			$data['account_primary_group'] = null; // dont change
113 113
 		}
114 114
 		else
115 115
 		{
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
 			{
118 118
 				$data['account_primary_group'] = 'Default';
119 119
 			}
120
-			$data['account_primary_group'] = admin_cmd::parse_account($data['account_primary_group'],false);
120
+			$data['account_primary_group'] = admin_cmd::parse_account($data['account_primary_group'], false);
121 121
 		}
122 122
 		if (!$data['account_groups'] && $this->account)
123 123
 		{
124
-			$data['account_groups'] = null;	// dont change
124
+			$data['account_groups'] = null; // dont change
125 125
 		}
126 126
 		else
127 127
 		{
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 			{
130 130
 				$data['account_groups'] = array('Default');
131 131
 			}
132
-			$data['account_groups'] = admin_cmd::parse_accounts($data['account_groups'],false);
132
+			$data['account_groups'] = admin_cmd::parse_accounts($data['account_groups'], false);
133 133
 		}
134 134
 		if ($check_only) return true;
135 135
 
@@ -139,27 +139,27 @@  discard block
 block discarded – undo
139 139
 			accounts::cache_invalidate($data['account_id']);
140 140
 			if (!($old = admin_cmd::$accounts->read($data['account_id'])))
141 141
 			{
142
-				throw new egw_exception_wrong_userinput(lang("Unknown account: %1 !!!",$this->account),15);
142
+				throw new egw_exception_wrong_userinput(lang("Unknown account: %1 !!!", $this->account), 15);
143 143
 			}
144 144
 			// as the current account class always sets all values, we have to add the not specified ones
145
-			foreach($data as $name => &$value)
145
+			foreach ($data as $name => &$value)
146 146
 			{
147 147
 				if (is_null($value)) $value = $old[$name];
148 148
 			}
149 149
 		}
150 150
 		else
151 151
 		{
152
-			unset($data['account_id']);	// otherwise add will fail under postgres
152
+			unset($data['account_id']); // otherwise add will fail under postgres
153 153
 		}
154 154
 		// hook allowing apps to intercept adding/editing accounts before saving them
155
-		$GLOBALS['egw']->hooks->process($data+array(
155
+		$GLOBALS['egw']->hooks->process($data + array(
156 156
 			'location' => $this->account ? 'pre_editaccount' : 'pre_addaccount',
157
-		),False,True);	// called for every app now, not only enabled ones)
157
+		), False, True); // called for every app now, not only enabled ones)
158 158
 
159 159
 		if (!($data['account_id'] = admin_cmd::$accounts->save($data)))
160 160
 		{
161 161
 			//_debug_array($data);
162
-			throw new egw_exception_db(lang("Error saving account!"),11);
162
+			throw new egw_exception_db(lang("Error saving account!"), 11);
163 163
 		}
164 164
 		// make new account_id available to caller
165 165
 		$update = (boolean)$this->account;
@@ -167,44 +167,44 @@  discard block
 block discarded – undo
167 167
 
168 168
 		if ($data['account_groups'])
169 169
 		{
170
-			admin_cmd::$accounts->set_memberships($data['account_groups'],$data['account_id']);
170
+			admin_cmd::$accounts->set_memberships($data['account_groups'], $data['account_id']);
171 171
 		}
172 172
 		if (!is_null($data['anonymous']))
173 173
 		{
174 174
 			admin_cmd::_instanciate_acl();
175 175
 			if ($data['anonymous'])
176 176
 			{
177
-				admin_cmd::$acl->add_repository('phpgwapi','anonymous',$data['account_id'],1);
177
+				admin_cmd::$acl->add_repository('phpgwapi', 'anonymous', $data['account_id'], 1);
178 178
 			}
179 179
 			else
180 180
 			{
181
-				admin_cmd::$acl->delete_repository('phpgwapi','anonymous',$data['account_id']);
181
+				admin_cmd::$acl->delete_repository('phpgwapi', 'anonymous', $data['account_id']);
182 182
 			}
183 183
 		}
184 184
 		if (!is_null($data['changepassword']))
185 185
 		{
186 186
 			if (!$data['changepassword'])
187 187
 			{
188
-				admin_cmd::$acl->add_repository('preferences','nopasswordchange',$data['account_id'],1);
188
+				admin_cmd::$acl->add_repository('preferences', 'nopasswordchange', $data['account_id'], 1);
189 189
 			}
190 190
 			else
191 191
 			{
192
-				admin_cmd::$acl->delete_repository('preferences','nopasswordchange',$data['account_id']);
192
+				admin_cmd::$acl->delete_repository('preferences', 'nopasswordchange', $data['account_id']);
193 193
 			}
194 194
 		}
195 195
 		// if we have a password and it's not a hash, and auth_type != account_repository
196 196
 		if (!is_null($this->password) &&
197
-			!preg_match('/^\\{[a-z5]{3,5}\\}.+/i',$this->password) &&
198
-			!preg_match('/^[0-9a-f]{32}$/',$this->password) &&	// md5 hash
197
+			!preg_match('/^\\{[a-z5]{3,5}\\}.+/i', $this->password) &&
198
+			!preg_match('/^[0-9a-f]{32}$/', $this->password) && // md5 hash
199 199
 			admin_cmd::$accounts->config['auth_type'] != admin_cmd::$accounts->config['account_repository'])
200 200
 		{
201
-			admin_cmd_change_pw::exec();		// calling the exec method of the admin_cmd_change_pw
201
+			admin_cmd_change_pw::exec(); // calling the exec method of the admin_cmd_change_pw
202 202
 		}
203 203
 		$data['account_passwd'] = $this->password;
204
-		$GLOBALS['hook_values'] =& $data;
205
-		$GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array(
204
+		$GLOBALS['hook_values'] = & $data;
205
+		$GLOBALS['egw']->hooks->process($GLOBALS['hook_values'] + array(
206 206
 			'location' => $update && $this->run_addaccount_hook !== true ? 'editaccount' : 'addaccount'
207
-		),False,True);	// called for every app now, not only enabled ones)
207
+		), False, True); // called for every app now, not only enabled ones)
208 208
 
209 209
 		return lang("Account %1 %2", $data['account_lid'] ? $data['account_lid'] : accounts::id2name($this->account),
210 210
 			$update ? lang('updated') : lang("created with id #%1", $this->account));
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 */
218 218
 	function __tostring()
219 219
 	{
220
-		return lang('%1 user %2',$this->account ? lang('Edit') : lang('Add'),
220
+		return lang('%1 user %2', $this->account ? lang('Edit') : lang('Add'),
221 221
 			admin_cmd::display_account($this->account ? $this->account : $this->set['account_lid']));
222 222
 	}
223 223
 
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
 	 * @return int timestamp, 0 for already, -1 for never or null for dont change
230 230
 	 * @throws egw_exception_wrong_userinput(lang('Invalid formated date "%1"!',$datein),6);
231 231
 	 */
232
-	private function _parse_expired($str,$existing)
232
+	private function _parse_expired($str, $existing)
233 233
 	{
234
-		switch($str)
234
+		switch ($str)
235 235
 		{
236 236
 			case '':
237 237
 				if ($existing) return null;
Please login to merge, or discard this patch.
admin/inc/class.admin_cmds.inc.php 3 patches
Braces   +10 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,10 @@  discard block
 block discarded – undo
37 37
 
38 38
 		$total = admin_cmd::get_rows($query,$rows,$readonlys);
39 39
 
40
-		if (!$rows) return array();
40
+		if (!$rows)
41
+		{
42
+			return array();
43
+		}
41 44
 
42 45
 		foreach($rows as &$row)
43 46
 		{
@@ -193,11 +196,15 @@  discard block
 block discarded – undo
193 196
 						try {
194 197
 							$content['remote']['remote_id'] = admin_cmd::save_remote($content['remote']);
195 198
 							$content['msg'] = lang('Remote instance saved');
196
-						} catch (Exception $e) {
199
+						}
200
+						catch (Exception $e) {
197 201
 							$content['msg'] = lang('Error saving').': '.$e->getMessage().' ('.$e->getCode().')';
198 202
 							break;
199 203
 						}
200
-						if ($button == 'apply') break;
204
+						if ($button == 'apply')
205
+						{
206
+							break;
207
+						}
201 208
 						// fall through for save
202 209
 					case 'cancel':
203 210
 						unset($content['remote']);
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	/**
55 55
 	 * Showing the command history and the scheduled commands
56 56
 	 *
57
-	 * @param array $content=null
57
+	 * @param array $content
58 58
 	 */
59 59
 	static function index(array $content=null)
60 60
 	{
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	/**
109 109
 	 * Showing remote administration instances
110 110
 	 *
111
-	 * @param array $content=null
111
+	 * @param array $content
112 112
 	 */
113 113
 	static function remotes(array $content=null)
114 114
 	{
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -28,19 +28,19 @@  discard block
 block discarded – undo
28 28
 	 * @param array &$readonlys
29 29
 	 * @return int
30 30
 	 */
31
-	static function get_rows(array $query,&$rows,&$readonlys)
31
+	static function get_rows(array $query, &$rows, &$readonlys)
32 32
 	{
33
-		$GLOBALS['egw']->session->appsession('cmds','admin',$query);
33
+		$GLOBALS['egw']->session->appsession('cmds', 'admin', $query);
34 34
 
35
-		$total = admin_cmd::get_rows($query,$rows,$readonlys);
35
+		$total = admin_cmd::get_rows($query, $rows, $readonlys);
36 36
 		
37 37
 		if (!$rows) return array();
38 38
 
39
-		foreach($rows as &$row)
39
+		foreach ($rows as &$row)
40 40
 		{
41 41
 			try {
42 42
 				$cmd = admin_cmd::instanciate($row);
43
-				$row['title'] = $cmd->__tostring();	// we call __tostring explicit, as a cast to string requires php5.2+
43
+				$row['title'] = $cmd->__tostring(); // we call __tostring explicit, as a cast to string requires php5.2+
44 44
 			}
45 45
 			catch (Exception $e) {
46 46
 				$row['title'] = $e->getMessage();
@@ -56,20 +56,20 @@  discard block
 block discarded – undo
56 56
 	 *
57 57
 	 * @param array $content=null
58 58
 	 */
59
-	static function index(array $content=null)
59
+	static function index(array $content = null)
60 60
 	{
61 61
 		$tpl = new etemplate('admin.cmds');
62 62
 
63 63
 		if (!is_array($content))
64 64
 		{
65
-			$content['nm'] = $GLOBALS['egw']->session->appsession('cmds','admin');
65
+			$content['nm'] = $GLOBALS['egw']->session->appsession('cmds', 'admin');
66 66
 			if (!is_array($content['nm']))
67 67
 			{
68 68
 				$content['nm'] = array(
69
-					'get_rows' => 'admin.admin_cmds.get_rows',	// I  method/callback to request the data for the rows eg. 'notes.bo.get_rows'
70
-					'no_filter' => true,	// I  disable the 1. filter
71
-					'no_filter2' => true,	// I  disable the 2. filter (params are the same as for filter)
72
-					'no_cat' => true,		// I  disable the cat-selectbox
69
+					'get_rows' => 'admin.admin_cmds.get_rows', // I  method/callback to request the data for the rows eg. 'notes.bo.get_rows'
70
+					'no_filter' => true, // I  disable the 1. filter
71
+					'no_filter2' => true, // I  disable the 2. filter (params are the same as for filter)
72
+					'no_cat' => true, // I  disable the cat-selectbox
73 73
 					'order' => 'cmd_created',
74 74
 					'sort' => 'DESC',
75 75
 				);		
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
 			}
87 87
 			unset($cmd);
88 88
 		}
89
-		$tpl->exec('admin.admin_cmds.index',$content,array(
89
+		$tpl->exec('admin.admin_cmds.index', $content, array(
90 90
 			'status' => admin_cmd::$stati,
91 91
 			'remote_id' => admin_cmd::remote_sites(),
92
-		),array(),$content);
92
+		), array(), $content);
93 93
 	}
94 94
 	
95 95
 	/**
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 	 * @param array &$readonlys
101 101
 	 * @return int
102 102
 	 */
103
-	static function get_remotes(array $query,&$rows,&$readonlys)
103
+	static function get_remotes(array $query, &$rows, &$readonlys)
104 104
 	{
105
-		return admin_cmd::get_remotes($query,$rows,$readonlys);
105
+		return admin_cmd::get_remotes($query, $rows, $readonlys);
106 106
 	}
107 107
 
108 108
 	/**
@@ -110,20 +110,20 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @param array $content=null
112 112
 	 */
113
-	static function remotes(array $content=null)
113
+	static function remotes(array $content = null)
114 114
 	{
115 115
 		$tpl = new etemplate('admin.remotes');
116 116
 
117 117
 		if (!is_array($content))
118 118
 		{
119
-			$content['nm'] = $GLOBALS['egw']->session->appsession('remotes','admin');
119
+			$content['nm'] = $GLOBALS['egw']->session->appsession('remotes', 'admin');
120 120
 			if (!is_array($content['nm']))
121 121
 			{
122 122
 				$content['nm'] = array(
123
-					'get_rows' => 'admin.admin_cmds.get_remotes',	// I  method/callback to request the data for the rows eg. 'notes.bo.get_rows'
124
-					'no_filter' => true,	// I  disable the 1. filter
125
-					'no_filter2' => true,	// I  disable the 2. filter (params are the same as for filter)
126
-					'no_cat' => true,		// I  disable the cat-selectbox
123
+					'get_rows' => 'admin.admin_cmds.get_remotes', // I  method/callback to request the data for the rows eg. 'notes.bo.get_rows'
124
+					'no_filter' => true, // I  disable the 1. filter
125
+					'no_filter2' => true, // I  disable the 2. filter (params are the same as for filter)
126
+					'no_cat' => true, // I  disable the cat-selectbox
127 127
 					'order' => 'remote_name',
128 128
 					'sort' => 'ASC',
129 129
 					'header_right' => 'admin.remotes.header_right',
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 				
143 143
 				$content['remote'] = admin_cmd::read_remote($id);
144 144
 			}
145
-			elseif($content['remote']['button'])
145
+			elseif ($content['remote']['button'])
146 146
 			{
147 147
 				list($button) = each($content['remote']['button']);
148 148
 				unset($content['remote']['button']);
149
-				switch($button)
149
+				switch ($button)
150 150
 				{
151 151
 					case 'save':
152 152
 					case 'apply':
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 				unset($content['nm']['add']);
178 178
 			}
179 179
 		}
180
-		$tpl->exec('admin.admin_cmds.remotes',$content,array(),array(),$content);
180
+		$tpl->exec('admin.admin_cmds.remotes', $content, array(), array(), $content);
181 181
 		
182 182
 	}
183 183
 }
Please login to merge, or discard this patch.
admin/inc/class.admin_customtranslation.inc.php 3 patches
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,8 +62,14 @@
 block discarded – undo
62 62
 							++$saved;
63 63
 						}
64 64
 					}
65
-					if ($saved) $msg = lang('%1 phrases saved.', $saved);
66
-					if ($action == 'apply') break;
65
+					if ($saved)
66
+					{
67
+						$msg = lang('%1 phrases saved.', $saved);
68
+					}
69
+					if ($action == 'apply')
70
+					{
71
+						break;
72
+					}
67 73
 					// fall through
68 74
 				case 'cancel':
69 75
 					Egw::redirect_link('/admin/index.php');
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -127,8 +127,7 @@
 block discarded – undo
127 127
 	/**
128 128
 	 * Show files shared
129 129
 	 *
130
-	 * @param array $content=null
131
-	 * @param string $msg=''
130
+	 * @param array $content
132 131
 	 */
133 132
 	public function index(array $content=null)
134 133
 	{
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 * @param array $content=null
31 31
 	 * @param string $msg=''
32 32
 	 */
33
-	function index(array $content=null, $msg='')
33
+	function index(array $content = null, $msg = '')
34 34
 	{
35 35
 		if (is_array($content))
36 36
 		{
@@ -40,17 +40,17 @@  discard block
 block discarded – undo
40 40
 				list($action) = each($content['button']);
41 41
 				unset($content['button']);
42 42
 			}
43
-			elseif($content['rows']['delete'])
43
+			elseif ($content['rows']['delete'])
44 44
 			{
45 45
 				list($action) = each($content['rows']['delete']);
46 46
 				unset($content['rows']['delete']);
47 47
 			}
48
-			switch($action)
48
+			switch ($action)
49 49
 			{
50 50
 				case 'save':
51 51
 				case 'apply':
52 52
 					$saved = 0;
53
-					foreach($content['rows'] as $n => $data)
53
+					foreach ($content['rows'] as $n => $data)
54 54
 					{
55 55
 						if (!empty($data['phrase']))
56 56
 						{
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 			}
76 76
 		}
77 77
 		$content = array('rows' => array());
78
-		foreach(translation::load_app('custom', 'en') as $phrase => $translation)
78
+		foreach (translation::load_app('custom', 'en') as $phrase => $translation)
79 79
 		{
80 80
 			$content['rows'][++$row] = array(
81 81
 				'phrase' => $phrase,
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 			'phrase' => '',
88 88
 			'translation' => '',
89 89
 		);
90
-		$readonlys["delete[$row]"] = true;	// no delete for empty row
90
+		$readonlys["delete[$row]"] = true; // no delete for empty row
91 91
 		$content['msg'] = $msg;
92 92
 
93 93
 		$GLOBALS['egw_info']['flags']['app_header'] = lang('Custom translation');
Please login to merge, or discard this patch.
admin/inc/class.admin_cmd_edit_group.inc.php 3 patches
Braces   +21 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,16 +46,22 @@  discard block
 block discarded – undo
46 46
 	protected function exec($check_only=false)
47 47
 	{
48 48
 		// check creator is still admin and not explicitly forbidden to edit accounts/groups
49
-		if ($this->creator) $this->_check_admin('group_access',$this->account ? 16 : 4);
49
+		if ($this->creator)
50
+		{
51
+			$this->_check_admin('group_access',$this->account ? 16 : 4);
52
+		}
50 53
 
51 54
 		admin_cmd::_instanciate_accounts();
52 55
 
53 56
 		$data = $this->set;
54 57
 
55
-		if ($this->account)	// existing account
58
+		if ($this->account)
59
+		{
60
+			// existing account
56 61
 		{
57 62
 			$data['account_id'] = admin_cmd::parse_account($this->account,false);
58 63
 		}
64
+		}
59 65
 		else
60 66
 		{
61 67
 			$data += array(
@@ -81,7 +87,10 @@  discard block
 block discarded – undo
81 87
 		{
82 88
 			$data['account_members'] = admin_cmd::parse_accounts($data['account_members'],true);
83 89
 		}
84
-		if ($check_only) return true;
90
+		if ($check_only)
91
+		{
92
+			return true;
93
+		}
85 94
 
86 95
 		if (($update = $this->account))
87 96
 		{
@@ -94,7 +103,10 @@  discard block
 block discarded – undo
94 103
 			// as the current account class always sets all values, we have to add the not specified ones
95 104
 			foreach($data as $name => &$value)
96 105
 			{
97
-				if (is_null($value)) $value = $old[$name];
106
+				if (is_null($value))
107
+				{
108
+					$value = $old[$name];
109
+				}
98 110
 			}
99 111
 		}
100 112
 		if (!($data['account_id'] = admin_cmd::$accounts->save($data)))
@@ -103,7 +115,11 @@  discard block
 block discarded – undo
103 115
 			throw new Api\Db\Exception(lang("Error saving account!"),11);
104 116
 		}
105 117
 		$data['account_name'] = $data['account_lid'];	// also set deprecated name
106
-		if ($update) $data['old_name'] = $old['account_lid'];	// make old name available for hooks
118
+		if ($update)
119
+		{
120
+			$data['old_name'] = $old['account_lid'];
121
+		}
122
+		// make old name available for hooks
107 123
 		$GLOBALS['hook_values'] =& $data;
108 124
 		Api\Hooks::process($GLOBALS['hook_values']+array(
109 125
 			'location' => $update ? 'editgroup' : 'addgroup'
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,6 @@  discard block
 block discarded – undo
19 19
 	 * Constructor
20 20
 	 *
21 21
 	 * @param string/int/array $account account name or id (!$account to add a new account), or array with all parameters
22
-	 * @param array $set=null array with all data to change
23 22
 	 */
24 23
 	function __construct($account,$set=null)
25 24
 	{
@@ -36,7 +35,7 @@  discard block
 block discarded – undo
36 35
 	/**
37 36
 	 * change the password of a given user
38 37
 	 *
39
-	 * @param boolean $check_only=false only run the checks (and throw the exceptions), but not the command itself
38
+	 * @param boolean $check_only only run the checks (and throw the exceptions), but not the command itself
40 39
 	 * @return string success message
41 40
 	 * @throws egw_exception_no_admin
42 41
 	 * @throws egw_exception_wrong_userinput(lang("Unknown account: %1 !!!",$this->account),15);
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 * @param string/int/array $account account name or id (!$account to add a new account), or array with all parameters
22 22
 	 * @param array $set=null array with all data to change
23 23
 	 */
24
-	function __construct($account,$set=null)
24
+	function __construct($account, $set = null)
25 25
 	{
26 26
 		if (!is_array($account))
27 27
 		{
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 	 * @throws egw_exception_no_admin
42 42
 	 * @throws egw_exception_wrong_userinput(lang("Unknown account: %1 !!!",$this->account),15);
43 43
 	 */
44
-	protected function exec($check_only=false)
44
+	protected function exec($check_only = false)
45 45
 	{
46 46
 		// check creator is still admin and not explicitly forbidden to edit accounts/groups
47
-		if ($this->creator) $this->_check_admin('group_access',$this->account ? 16 : 4);
47
+		if ($this->creator) $this->_check_admin('group_access', $this->account ? 16 : 4);
48 48
 
49 49
 		admin_cmd::_instanciate_accounts();
50 50
 
@@ -52,32 +52,32 @@  discard block
 block discarded – undo
52 52
 
53 53
 		if ($this->account)	// existing account
54 54
 		{
55
-			$data['account_id'] = admin_cmd::parse_account($this->account,false);
55
+			$data['account_id'] = admin_cmd::parse_account($this->account, false);
56 56
 		}
57 57
 		else
58 58
 		{
59 59
 			$data += array(
60 60
 				'account_type' => 'g',
61
-				'account_status' => 'A',	// not used, but so we do the same thing as the web-interface
61
+				'account_status' => 'A', // not used, but so we do the same thing as the web-interface
62 62
 				'account_expires' => -1,
63 63
 			);
64 64
 		}
65 65
 		if (!$data['account_lid'] && (!$this->account || !is_null($data['account_lid'])))
66 66
 		{
67
-			throw new egw_exception_wrong_userinput(lang('You must enter a group name.'),9);
67
+			throw new egw_exception_wrong_userinput(lang('You must enter a group name.'), 9);
68 68
 		}
69
-		if (!is_null($data['account_lid']) && ($id = admin_cmd::$accounts->name2id($data['account_lid'],'account_lid','g')) &&
69
+		if (!is_null($data['account_lid']) && ($id = admin_cmd::$accounts->name2id($data['account_lid'], 'account_lid', 'g')) &&
70 70
 			$id !== $data['account_id'])
71 71
 		{
72
-			throw new egw_exception_wrong_userinput(lang('That loginid has already been taken'),999);
72
+			throw new egw_exception_wrong_userinput(lang('That loginid has already been taken'), 999);
73 73
 		}
74 74
 		if (!$data['account_members'] && !$this->account)
75 75
 		{
76
-			throw new egw_exception_wrong_userinput(lang('You must select at least one group member.'),9);
76
+			throw new egw_exception_wrong_userinput(lang('You must select at least one group member.'), 9);
77 77
 		}
78 78
 		if ($data['account_members'])
79 79
 		{
80
-			$data['account_members'] = admin_cmd::parse_accounts($data['account_members'],true);
80
+			$data['account_members'] = admin_cmd::parse_accounts($data['account_members'], true);
81 81
 		}
82 82
 		if ($check_only) return true;
83 83
 
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 			accounts::cache_invalidate($data['account_id']);
88 88
 			if (!($old = admin_cmd::$accounts->read($data['account_id'])))
89 89
 			{
90
-				throw new egw_exception_wrong_userinput(lang("Unknown account: %1 !!!",$this->account),15);
90
+				throw new egw_exception_wrong_userinput(lang("Unknown account: %1 !!!", $this->account), 15);
91 91
 			}
92 92
 			// as the current account class always sets all values, we have to add the not specified ones
93
-			foreach($data as $name => &$value)
93
+			foreach ($data as $name => &$value)
94 94
 			{
95 95
 				if (is_null($value)) $value = $old[$name];
96 96
 			}
@@ -98,18 +98,18 @@  discard block
 block discarded – undo
98 98
 		if (!($data['account_id'] = admin_cmd::$accounts->save($data)))
99 99
 		{
100 100
 			//_debug_array($data);
101
-			throw new egw_exception_db(lang("Error saving account!"),11);
101
+			throw new egw_exception_db(lang("Error saving account!"), 11);
102 102
 		}
103
-		$data['account_name'] = $data['account_lid'];	// also set deprecated name
104
-		if ($update) $data['old_name'] = $old['account_lid'];	// make old name available for hooks
105
-		$GLOBALS['hook_values'] =& $data;
106
-		$GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array(
103
+		$data['account_name'] = $data['account_lid']; // also set deprecated name
104
+		if ($update) $data['old_name'] = $old['account_lid']; // make old name available for hooks
105
+		$GLOBALS['hook_values'] = & $data;
106
+		$GLOBALS['egw']->hooks->process($GLOBALS['hook_values'] + array(
107 107
 			'location' => $update ? 'editgroup' : 'addgroup'
108
-		),False,True);	// called for every app now, not only enabled ones)
108
+		), False, True); // called for every app now, not only enabled ones)
109 109
 
110 110
 		if ($data['account_members'])
111 111
 		{
112
-			admin_cmd::$accounts->set_members($data['account_members'],$data['account_id']);
112
+			admin_cmd::$accounts->set_members($data['account_members'], $data['account_id']);
113 113
 		}
114 114
 		// make new account_id available to caller
115 115
 		$this->account = $data['account_id'];
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	function __tostring()
127 127
 	{
128
-		return lang('%1 group %2',$this->account ? lang('Edit') : lang('Add'),
128
+		return lang('%1 group %2', $this->account ? lang('Edit') : lang('Add'),
129 129
 			admin_cmd::display_account($this->account ? $this->account : $this->set['account_lid']));
130 130
 	}
131 131
 }
Please login to merge, or discard this patch.
admin/inc/class.admin_cmd_delete_account.inc.php 3 patches
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,9 +57,15 @@
 block discarded – undo
57 57
 			$new_user = admin_cmd::parse_account($this->new_user,true);	// true = user, no group
58 58
 		}
59 59
 		// check creator is still admin and not explicitly forbidden to edit accounts
60
-		if ($this->creator) $this->_check_admin($this->is_user ? 'account_access' : 'group_access',32);
60
+		if ($this->creator)
61
+		{
62
+			$this->_check_admin($this->is_user ? 'account_access' : 'group_access',32);
63
+		}
61 64
 
62
-		if ($check_only) return true;
65
+		if ($check_only)
66
+		{
67
+			return true;
68
+		}
63 69
 
64 70
 		// delete the account
65 71
 		$GLOBALS['hook_values'] = array(
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 	 * Constructor
20 20
 	 *
21 21
 	 * @param string/int/array $account account name or id, or array with all parameters
22
-	 * @param string $new_user=null if specified, account to transfer the data to (users only)
23
-	 * @param string $is_user=true type of the account: true=user, false=group
22
+	 * @param string $new_user if specified, account to transfer the data to (users only)
23
+	 * @param string $is_user type of the account: true=user, false=group
24 24
 	 */
25 25
 	function __construct($account,$new_user=null,$is_user=true)
26 26
 	{
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	/**
39 39
 	 * delete an account (user or group)
40 40
 	 *
41
-	 * @param boolean $check_only=false only run the checks (and throw the exceptions), but not the command itself
41
+	 * @param boolean $check_only only run the checks (and throw the exceptions), but not the command itself
42 42
 	 * @return string success message
43 43
 	 * @throws egw_exception_no_admin
44 44
 	 * @throws egw_exception_wrong_userinput(lang("Unknown account: %1 !!!",$this->account),15);
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 * @param string $new_user=null if specified, account to transfer the data to (users only)
23 23
 	 * @param string $is_user=true type of the account: true=user, false=group
24 24
 	 */
25
-	function __construct($account,$new_user=null,$is_user=true)
25
+	function __construct($account, $new_user = null, $is_user = true)
26 26
 	{
27 27
 		if (!is_array($account))
28 28
 		{
@@ -44,18 +44,18 @@  discard block
 block discarded – undo
44 44
 	 * @throws egw_exception_wrong_userinput(lang("Unknown account: %1 !!!",$this->account),15);
45 45
 	 * @throws egw_exception_wrong_userinput(lang('Error changing the password for %1 !!!',$this->account),99);
46 46
 	 */
47
-	protected function exec($check_only=false)
47
+	protected function exec($check_only = false)
48 48
 	{
49
-		$account_id = admin_cmd::parse_account($this->account,$this->is_user);
49
+		$account_id = admin_cmd::parse_account($this->account, $this->is_user);
50 50
 		admin_cmd::_instanciate_accounts();
51 51
 		$account_lid = admin_cmd::$accounts->id2name($account_id);
52 52
 
53 53
 		if ($this->is_user && $this->new_user)
54 54
 		{
55
-			$new_user = admin_cmd::parse_account($this->new_user,true);	// true = user, no group
55
+			$new_user = admin_cmd::parse_account($this->new_user, true); // true = user, no group
56 56
 		}
57 57
 		// check creator is still admin and not explicitly forbidden to edit accounts
58
-		if ($this->creator) $this->_check_admin($this->is_user ? 'account_access' : 'group_access',32);
58
+		if ($this->creator) $this->_check_admin($this->is_user ? 'account_access' : 'group_access', 32);
59 59
 
60 60
 		if ($check_only) return true;
61 61
 
@@ -63,22 +63,22 @@  discard block
 block discarded – undo
63 63
 		$GLOBALS['hook_values'] = array(
64 64
 			'account_id'  => $account_id,
65 65
 			'account_lid' => $account_lid,
66
-			'account_name'=> $account_lid,		// depericated name for deletegroup hook
67
-			'new_owner'   => (int)$new_user,	// deleteaccount only
66
+			'account_name'=> $account_lid, // depericated name for deletegroup hook
67
+			'new_owner'   => (int)$new_user, // deleteaccount only
68 68
 			'location'    => $this->is_user ? 'deleteaccount' : 'deletegroup',
69 69
 		);
70 70
 		// first all other apps, then preferences and admin
71
-		foreach(array_merge(array_diff(array_keys($GLOBALS['egw_info']['apps']),array('preferences','admin')),array('preferences','admin')) as $app)
71
+		foreach (array_merge(array_diff(array_keys($GLOBALS['egw_info']['apps']), array('preferences', 'admin')), array('preferences', 'admin')) as $app)
72 72
 		{
73
-			$GLOBALS['egw']->hooks->single($GLOBALS['hook_values'],$app);
73
+			$GLOBALS['egw']->hooks->single($GLOBALS['hook_values'], $app);
74 74
 		}
75 75
 		$GLOBALS['egw']->accounts->delete($account_id);
76 76
 
77 77
 		if ($account_id < 0)
78 78
 		{
79
-			return lang("Group '%1' deleted.",$account_lid)."\n\n";
79
+			return lang("Group '%1' deleted.", $account_lid)."\n\n";
80 80
 		}
81
-		return lang("Account '%1' deleted.",$account_lid)."\n\n";
81
+		return lang("Account '%1' deleted.", $account_lid)."\n\n";
82 82
 	}
83 83
 
84 84
 	/**
@@ -88,6 +88,6 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	function __tostring()
90 90
 	{
91
-		return lang('Delete account %1',admin_cmd::display_account($this->account));
91
+		return lang('Delete account %1', admin_cmd::display_account($this->account));
92 92
 	}
93 93
 }
Please login to merge, or discard this patch.