Completed
Push — master ( 4911d3...2a36d1 )
by Michael
02:09
created
include/projax_/classes/Prototype.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
     }
213 213
 
214 214
     /**
215
-     * @param         $klass
215
+     * @param         string $klass
216 216
      * @param         $name
217 217
      * @param  null   $options
218 218
      * @return string
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
     }
312 312
 
313 313
     /**
314
-     * @param $variable
314
+     * @param string $variable
315 315
      * @param $value
316 316
      * @return string
317 317
      */
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
     }
322 322
 
323 323
     /**
324
-     * @param         $function
324
+     * @param         string $function
325 325
      * @param  null   $args
326 326
      * @return string
327 327
      */
Please login to merge, or discard this patch.
Indentation   +448 added lines, -448 removed lines patch added patch discarded remove patch
@@ -15,452 +15,452 @@
 block discarded – undo
15 15
  */
16 16
 class Prototype extends JavaScript
17 17
 {
18
-    public $CALLBACKS = [
19
-        'uninitialized',
20
-        'loading',
21
-        'loaded',
22
-        'interactive',
23
-        'complete',
24
-        'failure',
25
-        'success'
26
-    ];
27
-
28
-    public $AJAX_OPTIONS = [
29
-        'before',
30
-        'after',
31
-        'condition',
32
-        'url',
33
-        'asynchronous',
34
-        'method',
35
-        'insertion',
36
-        'position',
37
-        'form',
38
-        'with',
39
-        'update',
40
-        'script',
41
-        'uninitialized',
42
-        'loading',
43
-        'loaded',
44
-        'interactive',
45
-        'complete',
46
-        'failure',
47
-        'success'
48
-    ];
49
-
50
-    /**
51
-     * @return string
52
-     */
53
-    public function evaluate_remote_response()
54
-    {
55
-        return 'eval(request.responseText)';
56
-    }
57
-
58
-    /**
59
-     * @param $options
60
-     * @return string
61
-     */
62
-    public function form_remote_tag($options)
63
-    {
64
-        $options['form'] = true;
65
-
66
-        return '<form action="' . $options['url'] . '" onsubmit="' . $this->remote_function($options) . '; return false;" method="' . (isset($options['method']) ? $options['method'] : 'post') . '"  >';
67
-    }
68
-
69
-    /**
70
-     * @param         $name
71
-     * @param  null   $options
72
-     * @param  null   $html_options
73
-     * @return string
74
-     */
75
-    public function link_to_remote($name, $options = null, $html_options = null)
76
-    {
77
-        return $this->link_to_function($name, $this->remote_function($options), $html_options);
78
-    }
79
-
80
-    /**
81
-     * @param         $field_id
82
-     * @param  null   $options
83
-     * @return string
84
-     */
85
-    public function observe_field($field_id, $options = null)
86
-    {
87
-        if (isset($options['frequency']) && $options['frequency'] > 0) {
88
-            return $this->_build_observer('Form.Element.Observer', $field_id, $options);
89
-        } else {
90
-            return $this->_build_observer('Form.Element.EventObserver', $field_id, $options);
91
-        }
92
-    }
93
-
94
-    /**
95
-     * @param         $form_id
96
-     * @param  null   $options
97
-     * @return string
98
-     */
99
-    public function observe_form($form_id, $options = null)
100
-    {
101
-        if (isset($options['frequency'])) {
102
-            return $this->_build_observer('Form.Observer', $form_id, $options);
103
-        } else {
104
-            return $this->_build_observer('Form.EventObserver', $form_id, $options);
105
-        }
106
-    }
107
-
108
-    /**
109
-     * @param  null $options
110
-     * @return string
111
-     */
112
-    public function periodically_call_remote($options = null)
113
-    {
114
-        $frequency = isset($options['frequency']) ? $options['frequency'] : 10;
115
-        $code      = 'new PeriodicalExecuter(function() {' . $this->remote_function($options) . '},' . $frequency . ')';
116
-
117
-        return $code;
118
-    }
119
-
120
-    /**
121
-     * @param $options
122
-     * @return string
123
-     */
124
-    public function remote_function($options)
125
-    {
126
-        $javascript_options = $this->_options_for_ajax($options);
127
-
128
-        $update = '';
129
-
130
-        if (isset($options['update']) && is_array($options['update'])) {
131
-            $update = isset($options['update']['success']) ? 'success: ' . $options['update']['success'] : '';
132
-            $update .= empty($update) ? '' : ',';
133
-            $update .= isset($options['update']['failure']) ? 'failure: ' . $options['update']['failure'] : '';
134
-        } else {
135
-            $update .= isset($options['update']) ? $options['update'] : '';
136
-        }
137
-
138
-        $ajax_function = empty($update) ? 'new Ajax.Request(' : 'new Ajax.Updater(\'' . $update . '\',';
139
-
140
-        $ajax_function .= "'" . $options['url'] . "'";
141
-        $ajax_function .= ',' . $javascript_options . ')';
142
-
143
-        $ajax_function = isset($options['before']) ? $options['before'] . ';' . $ajax_function : $ajax_function;
144
-        $ajax_function = isset($options['after']) ? $ajax_function . ';' . $options['after'] : $ajax_function;
145
-        $ajax_function = isset($options['condition']) ? 'if (' . $options['condition'] . ') {' . $ajax_function . '}' : $ajax_function;
146
-        $ajax_function = isset($options['confirm']) ? 'if ( confirm(\'' . $options['confirm'] . '\' ) ) { ' . $ajax_function . ' } ' : $ajax_function;
147
-
148
-        return $ajax_function;
149
-    }
150
-
151
-    /**
152
-     * @param $name
153
-     * @param $value
154
-     * @param $options
155
-     * @return string
156
-     */
157
-    public function submit_to_remote($name, $value, $options)
158
-    {
159
-        if (isset($options['with'])) {
160
-            $options['with'] = 'Form.serialize(this.form)';
161
-        }
162
-
163
-        return '<input type="button" onclick="' . $this->remote_function($options) . '" name="' . $name . '" value ="' . $value . '">';
164
-    }
165
-
166
-    /**
167
-     * @param      $element_id
168
-     * @param null $options
169
-     * @param      $block
170
-     */
171
-    public function update_element_function($element_id, $options = null, $block)
172
-    {
173
-        $content = isset($options['content']) ? $options['content'] : '';
174
-        $content = $this->escape($content);
175
-    }
176
-
177
-    /**
178
-     * @param $block
179
-     */
180
-    public function update_page($block)
181
-    {
182
-    }
183
-
184
-    /**
185
-     * @param $block
186
-     * @return string
187
-     */
188
-    public function update_page_tag(& $block)
189
-    {
190
-        return $this->tag($block);
191
-    }
192
-
193
-    /////////////////////////////////////////////////////////////////////////////////////
194
-    //                             Private functions
195
-    /////////////////////////////////////////////////////////////////////////////////////
196
-
197
-    /**
198
-     * @param $options
199
-     * @return array
200
-     */
201
-    public function _build_callbacks($options)
202
-    {
203
-        $callbacks = [];
204
-        foreach ($options as $callback => $code) {
205
-            if (in_array($callback, $this->CALLBACKS)) {
206
-                $name             = 'on' . ucfirst($callback);
207
-                $callbacks[$name] = 'function(request){' . $code . '}';
208
-            }
209
-        }
210
-
211
-        return $callbacks;
212
-    }
213
-
214
-    /**
215
-     * @param         $klass
216
-     * @param         $name
217
-     * @param  null   $options
218
-     * @return string
219
-     */
220
-    public function _build_observer($klass, $name, $options = null)
221
-    {
222
-        if (isset($options['with']) && false === strpos($options['with'], '=')) {
223
-            $options['with'] = '\'' . $options['with'] . '=\' + value';
224
-        } elseif (isset($options['with']) && isset($options['update'])) {
225
-            $options['with'] = 'value';
226
-        }
227
-
228
-        $callback = $options['function'] ?: $this->remote_function($options);
229
-
230
-        $javascript = "new $klass('$name', ";
231
-        $javascript .= isset($options['frequency']) ? $options['frequency'] . ', ' : '';
232
-        $javascript .= 'function (element,value) { ';
233
-        $javascript .= $callback;
234
-        $javascript .= isset($options['on']) ? ', ' . $options['on'] : '';
235
-        $javascript .= '})';
236
-
237
-        return $javascript;
238
-    }
239
-
240
-    /**
241
-     * @param $method
242
-     * @return string
243
-     */
244
-    public function _method_option_to_s($method)
245
-    {
246
-        return strstr($method, "'") ? $method : "'$method'";
247
-    }
248
-
249
-    /**
250
-     * @param $options
251
-     * @return string
252
-     */
253
-    public function _options_for_ajax($options)
254
-    {
255
-        $js_options = is_array($options) ? $this->_build_callbacks($options) : [];
256
-
257
-        if (isset($options['type']) && $option['type'] === 'synchronous') {
258
-            $js_options['asynchronous'] = 'false';
259
-        }
260
-
261
-        if (isset($options['method'])) {
262
-            $js_options['method'] = $this->_method_option_to_s($options['method']);
263
-        }
264
-
265
-        if (isset($options['position'])) {
266
-            $js_options['insertion'] = 'Insertion.' . ucfirst($options['position']);
267
-        }
268
-
269
-        $js_options['evalScripts'] = isset($options['script']) ? $options['script'] : 'true';
270
-
271
-        if (isset($options['form'])) {
272
-            $js_options['parameters'] = 'Form.serialize(this)';
273
-        } elseif (isset($options['parameters'])) {
274
-            $js_options['parameters'] = 'Form.serialize(\'' . $options['submit'] . '\')';
275
-        } elseif (isset($options['with'])) {
276
-            $js_options['parameters'] = $options['with'];
277
-        }
278
-
279
-        return $this->_options_for_javascript($js_options);
280
-    }
281
-
282
-    /////////////////////////////////////////////////////////////////////////////////////
283
-    //                            Mergerd Javascript Generator helpers
284
-    /////////////////////////////////////////////////////////////////////////////////////
285
-
286
-    /**
287
-     * @param $javascript
288
-     */
289
-    public function dump($javascript)
290
-    {
291
-        echo $javascript;
292
-    }
293
-
294
-    /**
295
-     * @param         $id
296
-     * @param  null   $extend
297
-     * @return string
298
-     */
299
-    public function ID($id, $extend = null)
300
-    {
301
-        return "$('$id')" . (!empty($extend)) ? '.' . $extend . '()' : '';
302
-    }
303
-
304
-    /**
305
-     * @param $message
306
-     * @return string
307
-     */
308
-    public function alert($message)
309
-    {
310
-        return $this->call('alert', $message);
311
-    }
312
-
313
-    /**
314
-     * @param $variable
315
-     * @param $value
316
-     * @return string
317
-     */
318
-    public function assign($variable, $value)
319
-    {
320
-        return "$variable = $value;";
321
-    }
322
-
323
-    /**
324
-     * @param         $function
325
-     * @param  null   $args
326
-     * @return string
327
-     */
328
-    public function call($function, $args = null)
329
-    {
330
-        $arg_str = '';
331
-        if (is_array($args)) {
332
-            foreach ($args as $arg) {
333
-                if (!empty($arg_str)) {
334
-                    $arg_str .= ', ';
335
-                }
336
-                if (is_string($arg)) {
337
-                    $arg_str .= "'$arg'";
338
-                } else {
339
-                    $arg_str .= $arg;
340
-                }
341
-            }
342
-        } else {
343
-            if (is_string($args)) {
344
-                $arg_str .= "'$args'";
345
-            } else {
346
-                $arg_str .= $args;
347
-            }
348
-        }
349
-
350
-        return "$function($arg_str)";
351
-    }
352
-
353
-    /**
354
-     * @param  int    $seconds
355
-     * @param  string $script
356
-     * @return string
357
-     */
358
-    public function delay($seconds = 1, $script = '')
359
-    {
360
-        return "setTimeout( function() { $script } , " . ($seconds * 1000) . ' )';
361
-    }
362
-
363
-    /**
364
-     * @param $id
365
-     * @return string
366
-     */
367
-    public function hide($id)
368
-    {
369
-        return $this->call('Element.hide', $id);
370
-    }
371
-
372
-    /**
373
-     * @param         $position
374
-     * @param         $id
375
-     * @param  null   $options_for_render
376
-     * @return string
377
-     */
378
-    public function insert_html($position, $id, $options_for_render = null)
379
-    {
380
-        $args = array_merge([$id], (is_array($options_for_render) ? $options_for_render : [$options_for_render]));
381
-
382
-        return $this->call('new Insertion.' . ucfirst($position), $args);
383
-    }
384
-
385
-    /**
386
-     * @param $location
387
-     * @return string
388
-     */
389
-    public function redirect_to($location)
390
-    {
391
-        return $this->assign('window.location.href', $location);
392
-    }
393
-
394
-    /**
395
-     * @param $id
396
-     * @return string
397
-     */
398
-    public function remove($id)
399
-    {
400
-        if (is_array($id)) {
401
-            $arr_str = '';
402
-            foreach ($id as $obj) {
403
-                if (!empty($arg_str)) {
404
-                    $arg_str .= ', ';
405
-                }
406
-                $arg_str .= "'$arg'";
407
-            }
408
-
409
-            return "$A[$arg_str].each(Element.remove)";
410
-        } else {
411
-            return "Element.remove('$id')";
412
-        }
413
-    }
414
-
415
-    /**
416
-     * @param $id
417
-     * @param $options_for_render
418
-     * @return string
419
-     */
420
-    public function replace($id, $options_for_render)
421
-    {
422
-        $args = array_merge([$id], (is_array($options_for_render) ? $options_for_render : [$options_for_render]));
423
-
424
-        return $this->call('Element.replace', $args);
425
-    }
426
-
427
-    /**
428
-     * @param $id
429
-     * @param $options_for_render
430
-     * @return string
431
-     */
432
-    public function replace_html($id, $options_for_render)
433
-    {
434
-        $args = array_merge([$id], (is_array($options_for_render) ? $options_for_render : [$options_for_render]));
435
-
436
-        return $this->call('Element.update', $args);
437
-    }
438
-
439
-    /**
440
-     * @param         $pattern
441
-     * @param  null   $extend
442
-     * @return string
443
-     */
444
-    public function select($pattern, $extend = null)
445
-    {
446
-        return "$$('$pattern')" . (!empty($extend)) ? '.' . $extend : '';
447
-    }
448
-
449
-    /**
450
-     * @param $id
451
-     * @return string
452
-     */
453
-    public function show($id)
454
-    {
455
-        return $this->call('Element.show', $id);
456
-    }
457
-
458
-    /**
459
-     * @param $id
460
-     * @return string
461
-     */
462
-    public function toggle($id)
463
-    {
464
-        return $this->call('Element.toggle', $id);
465
-    }
18
+	public $CALLBACKS = [
19
+		'uninitialized',
20
+		'loading',
21
+		'loaded',
22
+		'interactive',
23
+		'complete',
24
+		'failure',
25
+		'success'
26
+	];
27
+
28
+	public $AJAX_OPTIONS = [
29
+		'before',
30
+		'after',
31
+		'condition',
32
+		'url',
33
+		'asynchronous',
34
+		'method',
35
+		'insertion',
36
+		'position',
37
+		'form',
38
+		'with',
39
+		'update',
40
+		'script',
41
+		'uninitialized',
42
+		'loading',
43
+		'loaded',
44
+		'interactive',
45
+		'complete',
46
+		'failure',
47
+		'success'
48
+	];
49
+
50
+	/**
51
+	 * @return string
52
+	 */
53
+	public function evaluate_remote_response()
54
+	{
55
+		return 'eval(request.responseText)';
56
+	}
57
+
58
+	/**
59
+	 * @param $options
60
+	 * @return string
61
+	 */
62
+	public function form_remote_tag($options)
63
+	{
64
+		$options['form'] = true;
65
+
66
+		return '<form action="' . $options['url'] . '" onsubmit="' . $this->remote_function($options) . '; return false;" method="' . (isset($options['method']) ? $options['method'] : 'post') . '"  >';
67
+	}
68
+
69
+	/**
70
+	 * @param         $name
71
+	 * @param  null   $options
72
+	 * @param  null   $html_options
73
+	 * @return string
74
+	 */
75
+	public function link_to_remote($name, $options = null, $html_options = null)
76
+	{
77
+		return $this->link_to_function($name, $this->remote_function($options), $html_options);
78
+	}
79
+
80
+	/**
81
+	 * @param         $field_id
82
+	 * @param  null   $options
83
+	 * @return string
84
+	 */
85
+	public function observe_field($field_id, $options = null)
86
+	{
87
+		if (isset($options['frequency']) && $options['frequency'] > 0) {
88
+			return $this->_build_observer('Form.Element.Observer', $field_id, $options);
89
+		} else {
90
+			return $this->_build_observer('Form.Element.EventObserver', $field_id, $options);
91
+		}
92
+	}
93
+
94
+	/**
95
+	 * @param         $form_id
96
+	 * @param  null   $options
97
+	 * @return string
98
+	 */
99
+	public function observe_form($form_id, $options = null)
100
+	{
101
+		if (isset($options['frequency'])) {
102
+			return $this->_build_observer('Form.Observer', $form_id, $options);
103
+		} else {
104
+			return $this->_build_observer('Form.EventObserver', $form_id, $options);
105
+		}
106
+	}
107
+
108
+	/**
109
+	 * @param  null $options
110
+	 * @return string
111
+	 */
112
+	public function periodically_call_remote($options = null)
113
+	{
114
+		$frequency = isset($options['frequency']) ? $options['frequency'] : 10;
115
+		$code      = 'new PeriodicalExecuter(function() {' . $this->remote_function($options) . '},' . $frequency . ')';
116
+
117
+		return $code;
118
+	}
119
+
120
+	/**
121
+	 * @param $options
122
+	 * @return string
123
+	 */
124
+	public function remote_function($options)
125
+	{
126
+		$javascript_options = $this->_options_for_ajax($options);
127
+
128
+		$update = '';
129
+
130
+		if (isset($options['update']) && is_array($options['update'])) {
131
+			$update = isset($options['update']['success']) ? 'success: ' . $options['update']['success'] : '';
132
+			$update .= empty($update) ? '' : ',';
133
+			$update .= isset($options['update']['failure']) ? 'failure: ' . $options['update']['failure'] : '';
134
+		} else {
135
+			$update .= isset($options['update']) ? $options['update'] : '';
136
+		}
137
+
138
+		$ajax_function = empty($update) ? 'new Ajax.Request(' : 'new Ajax.Updater(\'' . $update . '\',';
139
+
140
+		$ajax_function .= "'" . $options['url'] . "'";
141
+		$ajax_function .= ',' . $javascript_options . ')';
142
+
143
+		$ajax_function = isset($options['before']) ? $options['before'] . ';' . $ajax_function : $ajax_function;
144
+		$ajax_function = isset($options['after']) ? $ajax_function . ';' . $options['after'] : $ajax_function;
145
+		$ajax_function = isset($options['condition']) ? 'if (' . $options['condition'] . ') {' . $ajax_function . '}' : $ajax_function;
146
+		$ajax_function = isset($options['confirm']) ? 'if ( confirm(\'' . $options['confirm'] . '\' ) ) { ' . $ajax_function . ' } ' : $ajax_function;
147
+
148
+		return $ajax_function;
149
+	}
150
+
151
+	/**
152
+	 * @param $name
153
+	 * @param $value
154
+	 * @param $options
155
+	 * @return string
156
+	 */
157
+	public function submit_to_remote($name, $value, $options)
158
+	{
159
+		if (isset($options['with'])) {
160
+			$options['with'] = 'Form.serialize(this.form)';
161
+		}
162
+
163
+		return '<input type="button" onclick="' . $this->remote_function($options) . '" name="' . $name . '" value ="' . $value . '">';
164
+	}
165
+
166
+	/**
167
+	 * @param      $element_id
168
+	 * @param null $options
169
+	 * @param      $block
170
+	 */
171
+	public function update_element_function($element_id, $options = null, $block)
172
+	{
173
+		$content = isset($options['content']) ? $options['content'] : '';
174
+		$content = $this->escape($content);
175
+	}
176
+
177
+	/**
178
+	 * @param $block
179
+	 */
180
+	public function update_page($block)
181
+	{
182
+	}
183
+
184
+	/**
185
+	 * @param $block
186
+	 * @return string
187
+	 */
188
+	public function update_page_tag(& $block)
189
+	{
190
+		return $this->tag($block);
191
+	}
192
+
193
+	/////////////////////////////////////////////////////////////////////////////////////
194
+	//                             Private functions
195
+	/////////////////////////////////////////////////////////////////////////////////////
196
+
197
+	/**
198
+	 * @param $options
199
+	 * @return array
200
+	 */
201
+	public function _build_callbacks($options)
202
+	{
203
+		$callbacks = [];
204
+		foreach ($options as $callback => $code) {
205
+			if (in_array($callback, $this->CALLBACKS)) {
206
+				$name             = 'on' . ucfirst($callback);
207
+				$callbacks[$name] = 'function(request){' . $code . '}';
208
+			}
209
+		}
210
+
211
+		return $callbacks;
212
+	}
213
+
214
+	/**
215
+	 * @param         $klass
216
+	 * @param         $name
217
+	 * @param  null   $options
218
+	 * @return string
219
+	 */
220
+	public function _build_observer($klass, $name, $options = null)
221
+	{
222
+		if (isset($options['with']) && false === strpos($options['with'], '=')) {
223
+			$options['with'] = '\'' . $options['with'] . '=\' + value';
224
+		} elseif (isset($options['with']) && isset($options['update'])) {
225
+			$options['with'] = 'value';
226
+		}
227
+
228
+		$callback = $options['function'] ?: $this->remote_function($options);
229
+
230
+		$javascript = "new $klass('$name', ";
231
+		$javascript .= isset($options['frequency']) ? $options['frequency'] . ', ' : '';
232
+		$javascript .= 'function (element,value) { ';
233
+		$javascript .= $callback;
234
+		$javascript .= isset($options['on']) ? ', ' . $options['on'] : '';
235
+		$javascript .= '})';
236
+
237
+		return $javascript;
238
+	}
239
+
240
+	/**
241
+	 * @param $method
242
+	 * @return string
243
+	 */
244
+	public function _method_option_to_s($method)
245
+	{
246
+		return strstr($method, "'") ? $method : "'$method'";
247
+	}
248
+
249
+	/**
250
+	 * @param $options
251
+	 * @return string
252
+	 */
253
+	public function _options_for_ajax($options)
254
+	{
255
+		$js_options = is_array($options) ? $this->_build_callbacks($options) : [];
256
+
257
+		if (isset($options['type']) && $option['type'] === 'synchronous') {
258
+			$js_options['asynchronous'] = 'false';
259
+		}
260
+
261
+		if (isset($options['method'])) {
262
+			$js_options['method'] = $this->_method_option_to_s($options['method']);
263
+		}
264
+
265
+		if (isset($options['position'])) {
266
+			$js_options['insertion'] = 'Insertion.' . ucfirst($options['position']);
267
+		}
268
+
269
+		$js_options['evalScripts'] = isset($options['script']) ? $options['script'] : 'true';
270
+
271
+		if (isset($options['form'])) {
272
+			$js_options['parameters'] = 'Form.serialize(this)';
273
+		} elseif (isset($options['parameters'])) {
274
+			$js_options['parameters'] = 'Form.serialize(\'' . $options['submit'] . '\')';
275
+		} elseif (isset($options['with'])) {
276
+			$js_options['parameters'] = $options['with'];
277
+		}
278
+
279
+		return $this->_options_for_javascript($js_options);
280
+	}
281
+
282
+	/////////////////////////////////////////////////////////////////////////////////////
283
+	//                            Mergerd Javascript Generator helpers
284
+	/////////////////////////////////////////////////////////////////////////////////////
285
+
286
+	/**
287
+	 * @param $javascript
288
+	 */
289
+	public function dump($javascript)
290
+	{
291
+		echo $javascript;
292
+	}
293
+
294
+	/**
295
+	 * @param         $id
296
+	 * @param  null   $extend
297
+	 * @return string
298
+	 */
299
+	public function ID($id, $extend = null)
300
+	{
301
+		return "$('$id')" . (!empty($extend)) ? '.' . $extend . '()' : '';
302
+	}
303
+
304
+	/**
305
+	 * @param $message
306
+	 * @return string
307
+	 */
308
+	public function alert($message)
309
+	{
310
+		return $this->call('alert', $message);
311
+	}
312
+
313
+	/**
314
+	 * @param $variable
315
+	 * @param $value
316
+	 * @return string
317
+	 */
318
+	public function assign($variable, $value)
319
+	{
320
+		return "$variable = $value;";
321
+	}
322
+
323
+	/**
324
+	 * @param         $function
325
+	 * @param  null   $args
326
+	 * @return string
327
+	 */
328
+	public function call($function, $args = null)
329
+	{
330
+		$arg_str = '';
331
+		if (is_array($args)) {
332
+			foreach ($args as $arg) {
333
+				if (!empty($arg_str)) {
334
+					$arg_str .= ', ';
335
+				}
336
+				if (is_string($arg)) {
337
+					$arg_str .= "'$arg'";
338
+				} else {
339
+					$arg_str .= $arg;
340
+				}
341
+			}
342
+		} else {
343
+			if (is_string($args)) {
344
+				$arg_str .= "'$args'";
345
+			} else {
346
+				$arg_str .= $args;
347
+			}
348
+		}
349
+
350
+		return "$function($arg_str)";
351
+	}
352
+
353
+	/**
354
+	 * @param  int    $seconds
355
+	 * @param  string $script
356
+	 * @return string
357
+	 */
358
+	public function delay($seconds = 1, $script = '')
359
+	{
360
+		return "setTimeout( function() { $script } , " . ($seconds * 1000) . ' )';
361
+	}
362
+
363
+	/**
364
+	 * @param $id
365
+	 * @return string
366
+	 */
367
+	public function hide($id)
368
+	{
369
+		return $this->call('Element.hide', $id);
370
+	}
371
+
372
+	/**
373
+	 * @param         $position
374
+	 * @param         $id
375
+	 * @param  null   $options_for_render
376
+	 * @return string
377
+	 */
378
+	public function insert_html($position, $id, $options_for_render = null)
379
+	{
380
+		$args = array_merge([$id], (is_array($options_for_render) ? $options_for_render : [$options_for_render]));
381
+
382
+		return $this->call('new Insertion.' . ucfirst($position), $args);
383
+	}
384
+
385
+	/**
386
+	 * @param $location
387
+	 * @return string
388
+	 */
389
+	public function redirect_to($location)
390
+	{
391
+		return $this->assign('window.location.href', $location);
392
+	}
393
+
394
+	/**
395
+	 * @param $id
396
+	 * @return string
397
+	 */
398
+	public function remove($id)
399
+	{
400
+		if (is_array($id)) {
401
+			$arr_str = '';
402
+			foreach ($id as $obj) {
403
+				if (!empty($arg_str)) {
404
+					$arg_str .= ', ';
405
+				}
406
+				$arg_str .= "'$arg'";
407
+			}
408
+
409
+			return "$A[$arg_str].each(Element.remove)";
410
+		} else {
411
+			return "Element.remove('$id')";
412
+		}
413
+	}
414
+
415
+	/**
416
+	 * @param $id
417
+	 * @param $options_for_render
418
+	 * @return string
419
+	 */
420
+	public function replace($id, $options_for_render)
421
+	{
422
+		$args = array_merge([$id], (is_array($options_for_render) ? $options_for_render : [$options_for_render]));
423
+
424
+		return $this->call('Element.replace', $args);
425
+	}
426
+
427
+	/**
428
+	 * @param $id
429
+	 * @param $options_for_render
430
+	 * @return string
431
+	 */
432
+	public function replace_html($id, $options_for_render)
433
+	{
434
+		$args = array_merge([$id], (is_array($options_for_render) ? $options_for_render : [$options_for_render]));
435
+
436
+		return $this->call('Element.update', $args);
437
+	}
438
+
439
+	/**
440
+	 * @param         $pattern
441
+	 * @param  null   $extend
442
+	 * @return string
443
+	 */
444
+	public function select($pattern, $extend = null)
445
+	{
446
+		return "$$('$pattern')" . (!empty($extend)) ? '.' . $extend : '';
447
+	}
448
+
449
+	/**
450
+	 * @param $id
451
+	 * @return string
452
+	 */
453
+	public function show($id)
454
+	{
455
+		return $this->call('Element.show', $id);
456
+	}
457
+
458
+	/**
459
+	 * @param $id
460
+	 * @return string
461
+	 */
462
+	public function toggle($id)
463
+	{
464
+		return $this->call('Element.toggle', $id);
465
+	}
466 466
 }
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     {
64 64
         $options['form'] = true;
65 65
 
66
-        return '<form action="' . $options['url'] . '" onsubmit="' . $this->remote_function($options) . '; return false;" method="' . (isset($options['method']) ? $options['method'] : 'post') . '"  >';
66
+        return '<form action="'.$options['url'].'" onsubmit="'.$this->remote_function($options).'; return false;" method="'.(isset($options['method']) ? $options['method'] : 'post').'"  >';
67 67
     }
68 68
 
69 69
     /**
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     public function periodically_call_remote($options = null)
113 113
     {
114 114
         $frequency = isset($options['frequency']) ? $options['frequency'] : 10;
115
-        $code      = 'new PeriodicalExecuter(function() {' . $this->remote_function($options) . '},' . $frequency . ')';
115
+        $code      = 'new PeriodicalExecuter(function() {'.$this->remote_function($options).'},'.$frequency.')';
116 116
 
117 117
         return $code;
118 118
     }
@@ -128,22 +128,22 @@  discard block
 block discarded – undo
128 128
         $update = '';
129 129
 
130 130
         if (isset($options['update']) && is_array($options['update'])) {
131
-            $update = isset($options['update']['success']) ? 'success: ' . $options['update']['success'] : '';
131
+            $update = isset($options['update']['success']) ? 'success: '.$options['update']['success'] : '';
132 132
             $update .= empty($update) ? '' : ',';
133
-            $update .= isset($options['update']['failure']) ? 'failure: ' . $options['update']['failure'] : '';
133
+            $update .= isset($options['update']['failure']) ? 'failure: '.$options['update']['failure'] : '';
134 134
         } else {
135 135
             $update .= isset($options['update']) ? $options['update'] : '';
136 136
         }
137 137
 
138
-        $ajax_function = empty($update) ? 'new Ajax.Request(' : 'new Ajax.Updater(\'' . $update . '\',';
138
+        $ajax_function = empty($update) ? 'new Ajax.Request(' : 'new Ajax.Updater(\''.$update.'\',';
139 139
 
140
-        $ajax_function .= "'" . $options['url'] . "'";
141
-        $ajax_function .= ',' . $javascript_options . ')';
140
+        $ajax_function .= "'".$options['url']."'";
141
+        $ajax_function .= ','.$javascript_options.')';
142 142
 
143
-        $ajax_function = isset($options['before']) ? $options['before'] . ';' . $ajax_function : $ajax_function;
144
-        $ajax_function = isset($options['after']) ? $ajax_function . ';' . $options['after'] : $ajax_function;
145
-        $ajax_function = isset($options['condition']) ? 'if (' . $options['condition'] . ') {' . $ajax_function . '}' : $ajax_function;
146
-        $ajax_function = isset($options['confirm']) ? 'if ( confirm(\'' . $options['confirm'] . '\' ) ) { ' . $ajax_function . ' } ' : $ajax_function;
143
+        $ajax_function = isset($options['before']) ? $options['before'].';'.$ajax_function : $ajax_function;
144
+        $ajax_function = isset($options['after']) ? $ajax_function.';'.$options['after'] : $ajax_function;
145
+        $ajax_function = isset($options['condition']) ? 'if ('.$options['condition'].') {'.$ajax_function.'}' : $ajax_function;
146
+        $ajax_function = isset($options['confirm']) ? 'if ( confirm(\''.$options['confirm'].'\' ) ) { '.$ajax_function.' } ' : $ajax_function;
147 147
 
148 148
         return $ajax_function;
149 149
     }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
             $options['with'] = 'Form.serialize(this.form)';
161 161
         }
162 162
 
163
-        return '<input type="button" onclick="' . $this->remote_function($options) . '" name="' . $name . '" value ="' . $value . '">';
163
+        return '<input type="button" onclick="'.$this->remote_function($options).'" name="'.$name.'" value ="'.$value.'">';
164 164
     }
165 165
 
166 166
     /**
@@ -203,8 +203,8 @@  discard block
 block discarded – undo
203 203
         $callbacks = [];
204 204
         foreach ($options as $callback => $code) {
205 205
             if (in_array($callback, $this->CALLBACKS)) {
206
-                $name             = 'on' . ucfirst($callback);
207
-                $callbacks[$name] = 'function(request){' . $code . '}';
206
+                $name             = 'on'.ucfirst($callback);
207
+                $callbacks[$name] = 'function(request){'.$code.'}';
208 208
             }
209 209
         }
210 210
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     public function _build_observer($klass, $name, $options = null)
221 221
     {
222 222
         if (isset($options['with']) && false === strpos($options['with'], '=')) {
223
-            $options['with'] = '\'' . $options['with'] . '=\' + value';
223
+            $options['with'] = '\''.$options['with'].'=\' + value';
224 224
         } elseif (isset($options['with']) && isset($options['update'])) {
225 225
             $options['with'] = 'value';
226 226
         }
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
         $callback = $options['function'] ?: $this->remote_function($options);
229 229
 
230 230
         $javascript = "new $klass('$name', ";
231
-        $javascript .= isset($options['frequency']) ? $options['frequency'] . ', ' : '';
231
+        $javascript .= isset($options['frequency']) ? $options['frequency'].', ' : '';
232 232
         $javascript .= 'function (element,value) { ';
233 233
         $javascript .= $callback;
234
-        $javascript .= isset($options['on']) ? ', ' . $options['on'] : '';
234
+        $javascript .= isset($options['on']) ? ', '.$options['on'] : '';
235 235
         $javascript .= '})';
236 236
 
237 237
         return $javascript;
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
         }
264 264
 
265 265
         if (isset($options['position'])) {
266
-            $js_options['insertion'] = 'Insertion.' . ucfirst($options['position']);
266
+            $js_options['insertion'] = 'Insertion.'.ucfirst($options['position']);
267 267
         }
268 268
 
269 269
         $js_options['evalScripts'] = isset($options['script']) ? $options['script'] : 'true';
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
         if (isset($options['form'])) {
272 272
             $js_options['parameters'] = 'Form.serialize(this)';
273 273
         } elseif (isset($options['parameters'])) {
274
-            $js_options['parameters'] = 'Form.serialize(\'' . $options['submit'] . '\')';
274
+            $js_options['parameters'] = 'Form.serialize(\''.$options['submit'].'\')';
275 275
         } elseif (isset($options['with'])) {
276 276
             $js_options['parameters'] = $options['with'];
277 277
         }
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
      */
299 299
     public function ID($id, $extend = null)
300 300
     {
301
-        return "$('$id')" . (!empty($extend)) ? '.' . $extend . '()' : '';
301
+        return "$('$id')".(!empty($extend)) ? '.'.$extend.'()' : '';
302 302
     }
303 303
 
304 304
     /**
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
      */
358 358
     public function delay($seconds = 1, $script = '')
359 359
     {
360
-        return "setTimeout( function() { $script } , " . ($seconds * 1000) . ' )';
360
+        return "setTimeout( function() { $script } , ".($seconds * 1000).' )';
361 361
     }
362 362
 
363 363
     /**
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
     {
380 380
         $args = array_merge([$id], (is_array($options_for_render) ? $options_for_render : [$options_for_render]));
381 381
 
382
-        return $this->call('new Insertion.' . ucfirst($position), $args);
382
+        return $this->call('new Insertion.'.ucfirst($position), $args);
383 383
     }
384 384
 
385 385
     /**
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
      */
444 444
     public function select($pattern, $extend = null)
445 445
     {
446
-        return "$$('$pattern')" . (!empty($extend)) ? '.' . $extend : '';
446
+        return "$$('$pattern')".(!empty($extend)) ? '.'.$extend : '';
447 447
     }
448 448
 
449 449
     /**
Please login to merge, or discard this patch.
plugins/smartpartner.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,15 +9,15 @@
 block discarded – undo
9 9
 
10 10
 function smartobject_plugin_smartpartner()
11 11
 {
12
-    $pluginInfo = [];
12
+	$pluginInfo = [];
13 13
 
14
-    $pluginInfo['items']['partner']['caption'] = 'Partner';
15
-    $pluginInfo['items']['partner']['url']     = 'partner.php?partnerid=%u';
16
-    $pluginInfo['items']['partner']['request'] = 'partnerid';
14
+	$pluginInfo['items']['partner']['caption'] = 'Partner';
15
+	$pluginInfo['items']['partner']['url']     = 'partner.php?partnerid=%u';
16
+	$pluginInfo['items']['partner']['request'] = 'partnerid';
17 17
 
18
-    $pluginInfo['items']['category']['caption'] = 'Category';
19
-    $pluginInfo['items']['category']['url']     = 'index.php?view_category_id=%u';
20
-    $pluginInfo['items']['category']['request'] = 'view_category_id';
18
+	$pluginInfo['items']['category']['caption'] = 'Category';
19
+	$pluginInfo['items']['category']['url']     = 'index.php?view_category_id=%u';
20
+	$pluginInfo['items']['category']['request'] = 'view_category_id';
21 21
 
22
-    return $pluginInfo;
22
+	return $pluginInfo;
23 23
 }
Please login to merge, or discard this patch.
plugins/smartshop.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,15 +9,15 @@
 block discarded – undo
9 9
 
10 10
 function smartobject_plugin_smartshop()
11 11
 {
12
-    $pluginInfo = [];
12
+	$pluginInfo = [];
13 13
 
14
-    $pluginInfo['items']['item']['caption'] = 'Item';
15
-    $pluginInfo['items']['item']['url']     = 'item.php?itemid=%u';
16
-    $pluginInfo['items']['item']['request'] = 'itemid';
14
+	$pluginInfo['items']['item']['caption'] = 'Item';
15
+	$pluginInfo['items']['item']['url']     = 'item.php?itemid=%u';
16
+	$pluginInfo['items']['item']['request'] = 'itemid';
17 17
 
18
-    $pluginInfo['items']['category']['caption'] = 'Category';
19
-    $pluginInfo['items']['category']['url']     = 'category.php?categoryid=%u';
20
-    $pluginInfo['items']['category']['request'] = 'categoryid';
18
+	$pluginInfo['items']['category']['caption'] = 'Category';
19
+	$pluginInfo['items']['category']['url']     = 'category.php?categoryid=%u';
20
+	$pluginInfo['items']['category']['request'] = 'categoryid';
21 21
 
22
-    return $pluginInfo;
22
+	return $pluginInfo;
23 23
 }
Please login to merge, or discard this patch.
plugins/smartband.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -9,17 +9,17 @@
 block discarded – undo
9 9
 
10 10
 function smartobject_plugin_smartband()
11 11
 {
12
-    global $xoopsConfig;
13
-    require_once XOOPS_ROOT_PATH . '/modules/smartband/language/' . $xoopsConfig['language'] . '/main.php';
12
+	global $xoopsConfig;
13
+	require_once XOOPS_ROOT_PATH . '/modules/smartband/language/' . $xoopsConfig['language'] . '/main.php';
14 14
 
15
-    $pluginInfo                             = [];
16
-    $pluginInfo['items']['item']['caption'] = _MD_ARTALBUM_ITEM_CAP;
17
-    $pluginInfo['items']['item']['url']     = 'item.php?itemid=%u';
18
-    $pluginInfo['items']['item']['request'] = 'itemid';
15
+	$pluginInfo                             = [];
16
+	$pluginInfo['items']['item']['caption'] = _MD_ARTALBUM_ITEM_CAP;
17
+	$pluginInfo['items']['item']['url']     = 'item.php?itemid=%u';
18
+	$pluginInfo['items']['item']['request'] = 'itemid';
19 19
 
20
-    $pluginInfo['items']['category']['caption'] = _MD_ARTALBUM_CATEGORY;
21
-    $pluginInfo['items']['category']['url']     = 'category.php?categoryid=%u';
22
-    $pluginInfo['items']['category']['request'] = 'categoryid';
20
+	$pluginInfo['items']['category']['caption'] = _MD_ARTALBUM_CATEGORY;
21
+	$pluginInfo['items']['category']['url']     = 'category.php?categoryid=%u';
22
+	$pluginInfo['items']['category']['request'] = 'categoryid';
23 23
 
24
-    return $pluginInfo;
24
+	return $pluginInfo;
25 25
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 function smartobject_plugin_smartband()
11 11
 {
12 12
     global $xoopsConfig;
13
-    require_once XOOPS_ROOT_PATH . '/modules/smartband/language/' . $xoopsConfig['language'] . '/main.php';
13
+    require_once XOOPS_ROOT_PATH.'/modules/smartband/language/'.$xoopsConfig['language'].'/main.php';
14 14
 
15 15
     $pluginInfo                             = [];
16 16
     $pluginInfo['items']['item']['caption'] = _MD_ARTALBUM_ITEM_CAP;
Please login to merge, or discard this patch.
plugins/xcgal.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,12 +9,12 @@
 block discarded – undo
9 9
 
10 10
 function smartobject_plugin_xcgal()
11 11
 {
12
-    global $xoopsConfig;
12
+	global $xoopsConfig;
13 13
 
14
-    $pluginInfo                              = [];
15
-    $pluginInfo['items']['album']['caption'] = 'Album';
16
-    $pluginInfo['items']['item']['url']      = 'thumbnails.php?album=%u';
17
-    $pluginInfo['items']['item']['request']  = 'album';
14
+	$pluginInfo                              = [];
15
+	$pluginInfo['items']['album']['caption'] = 'Album';
16
+	$pluginInfo['items']['item']['url']      = 'thumbnails.php?album=%u';
17
+	$pluginInfo['items']['item']['request']  = 'album';
18 18
 
19
-    return $pluginInfo;
19
+	return $pluginInfo;
20 20
 }
Please login to merge, or discard this patch.
plugins/smartsection.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,15 +9,15 @@
 block discarded – undo
9 9
 
10 10
 function smartobject_plugin_smartsection()
11 11
 {
12
-    $pluginInfo = [];
12
+	$pluginInfo = [];
13 13
 
14
-    $pluginInfo['items']['item']['caption'] = 'Article';
15
-    $pluginInfo['items']['item']['url']     = 'item.php?itemid=%u';
16
-    $pluginInfo['items']['item']['request'] = 'itemid';
14
+	$pluginInfo['items']['item']['caption'] = 'Article';
15
+	$pluginInfo['items']['item']['url']     = 'item.php?itemid=%u';
16
+	$pluginInfo['items']['item']['request'] = 'itemid';
17 17
 
18
-    $pluginInfo['items']['category']['caption'] = 'Category';
19
-    $pluginInfo['items']['category']['url']     = 'category.php?categoryid=%u';
20
-    $pluginInfo['items']['category']['request'] = 'categoryid';
18
+	$pluginInfo['items']['category']['caption'] = 'Category';
19
+	$pluginInfo['items']['category']['url']     = 'category.php?categoryid=%u';
20
+	$pluginInfo['items']['category']['request'] = 'categoryid';
21 21
 
22
-    return $pluginInfo;
22
+	return $pluginInfo;
23 23
 }
Please login to merge, or discard this patch.
admin/tag.php 2 patches
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -12,45 +12,45 @@  discard block
 block discarded – undo
12 12
 
13 13
 function edittag($tagid = 0, $language = false, $fct = false)
14 14
 {
15
-    global $smartobjectTagHandler;
16
-
17
-    $tagObj = $smartobjectTagHandler->get($tagid);
18
-
19
-    if ($tagObj->isNew()) {
20
-        $breadcrumb            = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_CREATE;
21
-        $title                 = _AM_SOBJECT_TAG_CREATE;
22
-        $info                  = _AM_SOBJECT_TAG_CREATE_INFO;
23
-        $collaps_name          = 'tagcreate';
24
-        $form_name             = _AM_SOBJECT_TAG_CREATE;
25
-        $submit_button_caption = null;
26
-        //$tagObj->stripMultilanguageFields();
27
-    } else {
28
-        if ($language) {
29
-            $breadcrumb            = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_EDITING_LANGUAGE;
30
-            $title                 = _AM_SOBJECT_TAG_EDIT_LANGUAGE;
31
-            $info                  = _AM_SOBJECT_TAG_EDIT_LANGUAGE_INFO;
32
-            $collaps_name          = 'tageditlanguage';
33
-            $form_name             = _AM_SOBJECT_TAG_EDIT_LANGUAGE;
34
-            $submit_button_caption = null;
35
-            $tagObj->makeNonMLFieldReadOnly();
36
-        } else {
37
-            $breadcrumb            = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_EDITING;
38
-            $title                 = _AM_SOBJECT_TAG_EDIT;
39
-            $info                  = _AM_SOBJECT_TAG_EDIT_INFO;
40
-            $collaps_name          = 'tagedit';
41
-            $form_name             = _AM_SOBJECT_TAG_EDIT;
42
-            $submit_button_caption = null;
43
-            $tagObj->stripMultilanguageFields();
44
-        }
45
-    }
46
-
47
-    //smart_adminMenu(2, $breadcrumb);
48
-
49
-    smart_collapsableBar($collaps_name, $title, $info);
50
-
51
-    $sform = $tagObj->getForm($form_name, 'addtag', false, $submit_button_caption);
52
-    $sform->display();
53
-    smart_close_collapsable($collaps_name);
15
+	global $smartobjectTagHandler;
16
+
17
+	$tagObj = $smartobjectTagHandler->get($tagid);
18
+
19
+	if ($tagObj->isNew()) {
20
+		$breadcrumb            = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_CREATE;
21
+		$title                 = _AM_SOBJECT_TAG_CREATE;
22
+		$info                  = _AM_SOBJECT_TAG_CREATE_INFO;
23
+		$collaps_name          = 'tagcreate';
24
+		$form_name             = _AM_SOBJECT_TAG_CREATE;
25
+		$submit_button_caption = null;
26
+		//$tagObj->stripMultilanguageFields();
27
+	} else {
28
+		if ($language) {
29
+			$breadcrumb            = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_EDITING_LANGUAGE;
30
+			$title                 = _AM_SOBJECT_TAG_EDIT_LANGUAGE;
31
+			$info                  = _AM_SOBJECT_TAG_EDIT_LANGUAGE_INFO;
32
+			$collaps_name          = 'tageditlanguage';
33
+			$form_name             = _AM_SOBJECT_TAG_EDIT_LANGUAGE;
34
+			$submit_button_caption = null;
35
+			$tagObj->makeNonMLFieldReadOnly();
36
+		} else {
37
+			$breadcrumb            = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_EDITING;
38
+			$title                 = _AM_SOBJECT_TAG_EDIT;
39
+			$info                  = _AM_SOBJECT_TAG_EDIT_INFO;
40
+			$collaps_name          = 'tagedit';
41
+			$form_name             = _AM_SOBJECT_TAG_EDIT;
42
+			$submit_button_caption = null;
43
+			$tagObj->stripMultilanguageFields();
44
+		}
45
+	}
46
+
47
+	//smart_adminMenu(2, $breadcrumb);
48
+
49
+	smart_collapsableBar($collaps_name, $title, $info);
50
+
51
+	$sform = $tagObj->getForm($form_name, 'addtag', false, $submit_button_caption);
52
+	$sform->display();
53
+	smart_close_collapsable($collaps_name);
54 54
 }
55 55
 
56 56
 require_once __DIR__ . '/admin_header.php';
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
 $op = '';
63 63
 
64 64
 if (isset($_GET['op'])) {
65
-    $op = $_GET['op'];
65
+	$op = $_GET['op'];
66 66
 }
67 67
 if (isset($_POST['op'])) {
68
-    $op = $_POST['op'];
68
+	$op = $_POST['op'];
69 69
 }
70 70
 
71 71
 $tagid    = isset($_GET['tagid']) ? $_GET['tagid'] : 0;
@@ -74,65 +74,65 @@  discard block
 block discarded – undo
74 74
 
75 75
 switch ($op) {
76 76
 
77
-    case 'del':
78
-        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
79
-        $controller = new SmartObjectController($smartobjectTagHandler);
80
-        $controller->handleObjectDeletion(_AM_SOBJECT_TAG_DELETE_CONFIRM);
77
+	case 'del':
78
+		require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
79
+		$controller = new SmartObjectController($smartobjectTagHandler);
80
+		$controller->handleObjectDeletion(_AM_SOBJECT_TAG_DELETE_CONFIRM);
81 81
 
82
-        break;
82
+		break;
83 83
 
84
-    case 'addtag':
85
-        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
86
-        $controller = new SmartObjectController($smartobjectTagHandler);
87
-        $tagObj     = $controller->storeSmartObject();
88
-        if ($tagObj->hasError()) {
89
-            redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors());
90
-        }
84
+	case 'addtag':
85
+		require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
86
+		$controller = new SmartObjectController($smartobjectTagHandler);
87
+		$tagObj     = $controller->storeSmartObject();
88
+		if ($tagObj->hasError()) {
89
+			redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors());
90
+		}
91 91
 
92
-        if ($tagObj->hasError()) {
93
-            redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors());
94
-        } else {
95
-            redirect_header(smart_get_page_before_form(), 3, _CO_SOBJECT_SAVE_SUCCESS);
96
-        }
97
-        exit;
98
-        break;
92
+		if ($tagObj->hasError()) {
93
+			redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors());
94
+		} else {
95
+			redirect_header(smart_get_page_before_form(), 3, _CO_SOBJECT_SAVE_SUCCESS);
96
+		}
97
+		exit;
98
+		break;
99 99
 
100
-    case 'mod':
101
-        smart_xoops_cp_header();
102
-        edittag($tagid, $language, $fct);
103
-        break;
100
+	case 'mod':
101
+		smart_xoops_cp_header();
102
+		edittag($tagid, $language, $fct);
103
+		break;
104 104
 
105
-    default:
105
+	default:
106 106
 
107
-        smart_xoops_cp_header();
107
+		smart_xoops_cp_header();
108 108
 
109
-        //smart_adminMenu(2, _AM_SOBJECT_TAGS);
109
+		//smart_adminMenu(2, _AM_SOBJECT_TAGS);
110 110
 
111
-        smart_collapsableBar('tags', _AM_SOBJECT_TAGS, _AM_SOBJECT_TAGS_INFO);
111
+		smart_collapsableBar('tags', _AM_SOBJECT_TAGS, _AM_SOBJECT_TAGS_INFO);
112 112
 
113
-        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
114
-        $objectTable = new SmartObjectTable($smartobjectTagHandler, false, ['delete']);
115
-        $objectTable->addColumn(new SmartObjectColumn('name'));
116
-        $objectTable->addColumn(new SmartObjectColumn('language'));
117
-        $objectTable->addColumn(new SmartObjectColumn('value'));
118
-        //      $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_TAGS_FROM, $align='left', $width=false, 'getFromInfo'));
113
+		require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
114
+		$objectTable = new SmartObjectTable($smartobjectTagHandler, false, ['delete']);
115
+		$objectTable->addColumn(new SmartObjectColumn('name'));
116
+		$objectTable->addColumn(new SmartObjectColumn('language'));
117
+		$objectTable->addColumn(new SmartObjectColumn('value'));
118
+		//      $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_TAGS_FROM, $align='left', $width=false, 'getFromInfo'));
119 119
 
120
-        $objectTable->addFilter('language', 'getLanguages');
120
+		$objectTable->addFilter('language', 'getLanguages');
121 121
 
122
-        $objectTable->addCustomAction('getEditLanguageLink');
123
-        $objectTable->addCustomAction('getEditItemLink');
122
+		$objectTable->addCustomAction('getEditLanguageLink');
123
+		$objectTable->addCustomAction('getEditItemLink');
124 124
 
125
-        $objectTable->setDefaultSort('tagid');
125
+		$objectTable->setDefaultSort('tagid');
126 126
 
127
-        $objectTable->addIntroButton('addtag', 'tag.php?op=mod', _AM_SOBJECT_TAG_CREATE);
127
+		$objectTable->addIntroButton('addtag', 'tag.php?op=mod', _AM_SOBJECT_TAG_CREATE);
128 128
 
129
-        $objectTable->render();
129
+		$objectTable->render();
130 130
 
131
-        echo '<br>';
132
-        smart_close_collapsable('tags');
133
-        echo '<br>';
131
+		echo '<br>';
132
+		smart_close_collapsable('tags');
133
+		echo '<br>';
134 134
 
135
-        break;
135
+		break;
136 136
 }
137 137
 
138 138
 //smart_modFooter();
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     $tagObj = $smartobjectTagHandler->get($tagid);
18 18
 
19 19
     if ($tagObj->isNew()) {
20
-        $breadcrumb            = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_CREATE;
20
+        $breadcrumb            = _AM_SOBJECT_TAGS.' > '._AM_SOBJECT_TAG_CREATE;
21 21
         $title                 = _AM_SOBJECT_TAG_CREATE;
22 22
         $info                  = _AM_SOBJECT_TAG_CREATE_INFO;
23 23
         $collaps_name          = 'tagcreate';
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         //$tagObj->stripMultilanguageFields();
27 27
     } else {
28 28
         if ($language) {
29
-            $breadcrumb            = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_EDITING_LANGUAGE;
29
+            $breadcrumb            = _AM_SOBJECT_TAGS.' > '._AM_SOBJECT_TAG_EDITING_LANGUAGE;
30 30
             $title                 = _AM_SOBJECT_TAG_EDIT_LANGUAGE;
31 31
             $info                  = _AM_SOBJECT_TAG_EDIT_LANGUAGE_INFO;
32 32
             $collaps_name          = 'tageditlanguage';
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
             $submit_button_caption = null;
35 35
             $tagObj->makeNonMLFieldReadOnly();
36 36
         } else {
37
-            $breadcrumb            = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_EDITING;
37
+            $breadcrumb            = _AM_SOBJECT_TAGS.' > '._AM_SOBJECT_EDITING;
38 38
             $title                 = _AM_SOBJECT_TAG_EDIT;
39 39
             $info                  = _AM_SOBJECT_TAG_EDIT_INFO;
40 40
             $collaps_name          = 'tagedit';
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
     smart_close_collapsable($collaps_name);
54 54
 }
55 55
 
56
-require_once __DIR__ . '/admin_header.php';
57
-require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
58
-require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttag.php';
56
+require_once __DIR__.'/admin_header.php';
57
+require_once SMARTOBJECT_ROOT_PATH.'class/smartobjecttable.php';
58
+require_once SMARTOBJECT_ROOT_PATH.'class/smartobjecttag.php';
59 59
 
60 60
 $smartobjectTagHandler = xoops_getModuleHandler('tag');
61 61
 
@@ -75,22 +75,22 @@  discard block
 block discarded – undo
75 75
 switch ($op) {
76 76
 
77 77
     case 'del':
78
-        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
78
+        require_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartobjectcontroller.php';
79 79
         $controller = new SmartObjectController($smartobjectTagHandler);
80 80
         $controller->handleObjectDeletion(_AM_SOBJECT_TAG_DELETE_CONFIRM);
81 81
 
82 82
         break;
83 83
 
84 84
     case 'addtag':
85
-        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
85
+        require_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartobjectcontroller.php';
86 86
         $controller = new SmartObjectController($smartobjectTagHandler);
87 87
         $tagObj     = $controller->storeSmartObject();
88 88
         if ($tagObj->hasError()) {
89
-            redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors());
89
+            redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR.$tagObj->getHtmlErrors());
90 90
         }
91 91
 
92 92
         if ($tagObj->hasError()) {
93
-            redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors());
93
+            redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR.$tagObj->getHtmlErrors());
94 94
         } else {
95 95
             redirect_header(smart_get_page_before_form(), 3, _CO_SOBJECT_SAVE_SUCCESS);
96 96
         }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
         smart_collapsableBar('tags', _AM_SOBJECT_TAGS, _AM_SOBJECT_TAGS_INFO);
112 112
 
113
-        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
113
+        require_once SMARTOBJECT_ROOT_PATH.'class/smartobjecttable.php';
114 114
         $objectTable = new SmartObjectTable($smartobjectTagHandler, false, ['delete']);
115 115
         $objectTable->addColumn(new SmartObjectColumn('name'));
116 116
         $objectTable->addColumn(new SmartObjectColumn('language'));
@@ -137,4 +137,4 @@  discard block
 block discarded – undo
137 137
 
138 138
 //smart_modFooter();
139 139
 //xoops_cp_footer();
140
-require_once __DIR__ . '/admin_footer.php';
140
+require_once __DIR__.'/admin_footer.php';
Please login to merge, or discard this patch.
admin/link.php 3 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -21,81 +21,81 @@
 block discarded – undo
21 21
 $op = '';
22 22
 
23 23
 if (isset($_GET['op'])) {
24
-    $op = $_GET['op'];
24
+	$op = $_GET['op'];
25 25
 }
26 26
 if (isset($_POST['op'])) {
27
-    $op = $_POST['op'];
27
+	$op = $_POST['op'];
28 28
 }
29 29
 
30 30
 switch ($op) {
31 31
 
32
-    case 'del':
33
-        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
34
-        $controller = new SmartObjectController($smartobjectLinkHandler);
35
-        $controller->handleObjectDeletion(_AM_SOBJECT_SENT_LINK_DELETE_CONFIRM);
32
+	case 'del':
33
+		require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
34
+		$controller = new SmartObjectController($smartobjectLinkHandler);
35
+		$controller->handleObjectDeletion(_AM_SOBJECT_SENT_LINK_DELETE_CONFIRM);
36 36
 
37
-        break;
37
+		break;
38 38
 
39
-    case 'view':
40
-        $linkid  = isset($_GET['linkid']) ? $_GET['linkid'] : 0;
41
-        $linkObj = $smartobjectLinkHandler->get($linkid);
39
+	case 'view':
40
+		$linkid  = isset($_GET['linkid']) ? $_GET['linkid'] : 0;
41
+		$linkObj = $smartobjectLinkHandler->get($linkid);
42 42
 
43
-        if ($linkObj->isNew()) {
44
-            redirect_header(SMARTOBJECT_URL . 'admin/link.php', 3, _AM_SOBJECT_LINK_NOT_FOUND);
45
-        }
43
+		if ($linkObj->isNew()) {
44
+			redirect_header(SMARTOBJECT_URL . 'admin/link.php', 3, _AM_SOBJECT_LINK_NOT_FOUND);
45
+		}
46 46
 
47
-        smart_xoops_cp_header();
47
+		smart_xoops_cp_header();
48 48
 
49
-        //smart_adminMenu(1, _AM_SOBJECT_SENT_LINK_DISPLAY);
49
+		//smart_adminMenu(1, _AM_SOBJECT_SENT_LINK_DISPLAY);
50 50
 
51
-        smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINK_DISPLAY, _AM_SOBJECT_SENT_LINK_DISPLAY_INFO);
51
+		smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINK_DISPLAY, _AM_SOBJECT_SENT_LINK_DISPLAY_INFO);
52 52
 
53
-        require_once XOOPS_ROOT_PATH . '/class/template.php';
53
+		require_once XOOPS_ROOT_PATH . '/class/template.php';
54 54
 
55
-        // ---
56
-        // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated.
57
-        //      $xoopsTpl = new XoopsTpl();
58
-        $xoopsTpl = new XoopsTpl();
59
-        //---
55
+		// ---
56
+		// 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated.
57
+		//      $xoopsTpl = new XoopsTpl();
58
+		$xoopsTpl = new XoopsTpl();
59
+		//---
60 60
 
61
-        $xoopsTpl->assign('link', $linkObj->toArray());
62
-        $xoopsTpl->display('db:smartobject_sentlink_display.tpl');
61
+		$xoopsTpl->assign('link', $linkObj->toArray());
62
+		$xoopsTpl->display('db:smartobject_sentlink_display.tpl');
63 63
 
64
-        echo '<br>';
65
-        smart_close_collapsable('sentlinks');
66
-        echo '<br>';
64
+		echo '<br>';
65
+		smart_close_collapsable('sentlinks');
66
+		echo '<br>';
67 67
 
68
-        break;
68
+		break;
69 69
 
70
-    default:
70
+	default:
71 71
 
72
-        smart_xoops_cp_header();
72
+		smart_xoops_cp_header();
73 73
 
74
-        $adminObject->displayNavigation(basename(__FILE__));
74
+		$adminObject->displayNavigation(basename(__FILE__));
75 75
 
76
-        //smart_adminMenu(1, _AM_SOBJECT_SENT_LINKS);
76
+		//smart_adminMenu(1, _AM_SOBJECT_SENT_LINKS);
77 77
 
78
-        smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINKS, _AM_SOBJECT_SENT_LINKS_INFO);
78
+		smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINKS, _AM_SOBJECT_SENT_LINKS_INFO);
79 79
 
80
-        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
81
-        $objectTable = new SmartObjectTable($smartobjectLinkHandler, null, ['delete']);
82
-        $objectTable->addColumn(new SmartObjectColumn('date'));
83
-        $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_LINKS_FROM, $align = 'left', $width = false, 'getFromInfo'));
84
-        $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_LINKS_TO, $align = 'left', $width = false, 'getToInfo'));
85
-        $objectTable->addColumn(new SmartObjectColumn('link'));
80
+		require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
81
+		$objectTable = new SmartObjectTable($smartobjectLinkHandler, null, ['delete']);
82
+		$objectTable->addColumn(new SmartObjectColumn('date'));
83
+		$objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_LINKS_FROM, $align = 'left', $width = false, 'getFromInfo'));
84
+		$objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_LINKS_TO, $align = 'left', $width = false, 'getToInfo'));
85
+		$objectTable->addColumn(new SmartObjectColumn('link'));
86 86
 
87
-        $objectTable->addCustomAction('getViewItemLink');
87
+		$objectTable->addCustomAction('getViewItemLink');
88 88
 
89
-        $objectTable->setDefaultSort('date');
90
-        $objectTable->setDefaultOrder('DESC');
89
+		$objectTable->setDefaultSort('date');
90
+		$objectTable->setDefaultOrder('DESC');
91 91
 
92
-        $objectTable->render();
92
+		$objectTable->render();
93 93
 
94
-        echo '<br>';
95
-        smart_close_collapsable('sentlinks');
96
-        echo '<br>';
94
+		echo '<br>';
95
+		smart_close_collapsable('sentlinks');
96
+		echo '<br>';
97 97
 
98
-        break;
98
+		break;
99 99
 }
100 100
 
101 101
 //smart_modFooter();
Please login to merge, or discard this patch.
Switch Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -29,73 +29,73 @@
 block discarded – undo
29 29
 
30 30
 switch ($op) {
31 31
 
32
-    case 'del':
33
-        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
34
-        $controller = new SmartObjectController($smartobjectLinkHandler);
35
-        $controller->handleObjectDeletion(_AM_SOBJECT_SENT_LINK_DELETE_CONFIRM);
32
+    	case 'del':
33
+        	require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
34
+        	$controller = new SmartObjectController($smartobjectLinkHandler);
35
+        	$controller->handleObjectDeletion(_AM_SOBJECT_SENT_LINK_DELETE_CONFIRM);
36 36
 
37
-        break;
37
+        	break;
38 38
 
39
-    case 'view':
40
-        $linkid  = isset($_GET['linkid']) ? $_GET['linkid'] : 0;
41
-        $linkObj = $smartobjectLinkHandler->get($linkid);
39
+    	case 'view':
40
+        	$linkid  = isset($_GET['linkid']) ? $_GET['linkid'] : 0;
41
+        	$linkObj = $smartobjectLinkHandler->get($linkid);
42 42
 
43
-        if ($linkObj->isNew()) {
44
-            redirect_header(SMARTOBJECT_URL . 'admin/link.php', 3, _AM_SOBJECT_LINK_NOT_FOUND);
45
-        }
43
+        	if ($linkObj->isNew()) {
44
+            	redirect_header(SMARTOBJECT_URL . 'admin/link.php', 3, _AM_SOBJECT_LINK_NOT_FOUND);
45
+        	}
46 46
 
47
-        smart_xoops_cp_header();
47
+        	smart_xoops_cp_header();
48 48
 
49
-        //smart_adminMenu(1, _AM_SOBJECT_SENT_LINK_DISPLAY);
49
+        	//smart_adminMenu(1, _AM_SOBJECT_SENT_LINK_DISPLAY);
50 50
 
51
-        smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINK_DISPLAY, _AM_SOBJECT_SENT_LINK_DISPLAY_INFO);
51
+        	smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINK_DISPLAY, _AM_SOBJECT_SENT_LINK_DISPLAY_INFO);
52 52
 
53
-        require_once XOOPS_ROOT_PATH . '/class/template.php';
53
+        	require_once XOOPS_ROOT_PATH . '/class/template.php';
54 54
 
55
-        // ---
56
-        // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated.
57
-        //      $xoopsTpl = new XoopsTpl();
58
-        $xoopsTpl = new XoopsTpl();
59
-        //---
55
+        	// ---
56
+        	// 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated.
57
+        	//      $xoopsTpl = new XoopsTpl();
58
+        	$xoopsTpl = new XoopsTpl();
59
+        	//---
60 60
 
61
-        $xoopsTpl->assign('link', $linkObj->toArray());
62
-        $xoopsTpl->display('db:smartobject_sentlink_display.tpl');
61
+        	$xoopsTpl->assign('link', $linkObj->toArray());
62
+        	$xoopsTpl->display('db:smartobject_sentlink_display.tpl');
63 63
 
64
-        echo '<br>';
65
-        smart_close_collapsable('sentlinks');
66
-        echo '<br>';
64
+        	echo '<br>';
65
+        	smart_close_collapsable('sentlinks');
66
+        	echo '<br>';
67 67
 
68
-        break;
68
+        	break;
69 69
 
70
-    default:
70
+    	default:
71 71
 
72
-        smart_xoops_cp_header();
72
+        	smart_xoops_cp_header();
73 73
 
74
-        $adminObject->displayNavigation(basename(__FILE__));
74
+        	$adminObject->displayNavigation(basename(__FILE__));
75 75
 
76
-        //smart_adminMenu(1, _AM_SOBJECT_SENT_LINKS);
76
+        	//smart_adminMenu(1, _AM_SOBJECT_SENT_LINKS);
77 77
 
78
-        smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINKS, _AM_SOBJECT_SENT_LINKS_INFO);
78
+        	smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINKS, _AM_SOBJECT_SENT_LINKS_INFO);
79 79
 
80
-        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
81
-        $objectTable = new SmartObjectTable($smartobjectLinkHandler, null, ['delete']);
82
-        $objectTable->addColumn(new SmartObjectColumn('date'));
83
-        $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_LINKS_FROM, $align = 'left', $width = false, 'getFromInfo'));
84
-        $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_LINKS_TO, $align = 'left', $width = false, 'getToInfo'));
85
-        $objectTable->addColumn(new SmartObjectColumn('link'));
80
+        	require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
81
+        	$objectTable = new SmartObjectTable($smartobjectLinkHandler, null, ['delete']);
82
+        	$objectTable->addColumn(new SmartObjectColumn('date'));
83
+        	$objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_LINKS_FROM, $align = 'left', $width = false, 'getFromInfo'));
84
+        	$objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_LINKS_TO, $align = 'left', $width = false, 'getToInfo'));
85
+        	$objectTable->addColumn(new SmartObjectColumn('link'));
86 86
 
87
-        $objectTable->addCustomAction('getViewItemLink');
87
+        	$objectTable->addCustomAction('getViewItemLink');
88 88
 
89
-        $objectTable->setDefaultSort('date');
90
-        $objectTable->setDefaultOrder('DESC');
89
+        	$objectTable->setDefaultSort('date');
90
+        	$objectTable->setDefaultOrder('DESC');
91 91
 
92
-        $objectTable->render();
92
+        	$objectTable->render();
93 93
 
94
-        echo '<br>';
95
-        smart_close_collapsable('sentlinks');
96
-        echo '<br>';
94
+        	echo '<br>';
95
+        	smart_close_collapsable('sentlinks');
96
+        	echo '<br>';
97 97
 
98
-        break;
98
+        	break;
99 99
 }
100 100
 
101 101
 //smart_modFooter();
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
  * Licence: GNU
12 12
  */
13 13
 
14
-require_once __DIR__ . '/admin_header.php';
15
-require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
16
-require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectlink.php';
14
+require_once __DIR__.'/admin_header.php';
15
+require_once SMARTOBJECT_ROOT_PATH.'class/smartobjecttable.php';
16
+require_once SMARTOBJECT_ROOT_PATH.'class/smartobjectlink.php';
17 17
 $adminObject = \Xmf\Module\Admin::getInstance();
18 18
 
19 19
 $smartobjectLinkHandler = xoops_getModuleHandler('link');
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 switch ($op) {
31 31
 
32 32
     case 'del':
33
-        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
33
+        require_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartobjectcontroller.php';
34 34
         $controller = new SmartObjectController($smartobjectLinkHandler);
35 35
         $controller->handleObjectDeletion(_AM_SOBJECT_SENT_LINK_DELETE_CONFIRM);
36 36
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         $linkObj = $smartobjectLinkHandler->get($linkid);
42 42
 
43 43
         if ($linkObj->isNew()) {
44
-            redirect_header(SMARTOBJECT_URL . 'admin/link.php', 3, _AM_SOBJECT_LINK_NOT_FOUND);
44
+            redirect_header(SMARTOBJECT_URL.'admin/link.php', 3, _AM_SOBJECT_LINK_NOT_FOUND);
45 45
         }
46 46
 
47 47
         smart_xoops_cp_header();
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
         smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINK_DISPLAY, _AM_SOBJECT_SENT_LINK_DISPLAY_INFO);
52 52
 
53
-        require_once XOOPS_ROOT_PATH . '/class/template.php';
53
+        require_once XOOPS_ROOT_PATH.'/class/template.php';
54 54
 
55 55
         // ---
56 56
         // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated.
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
         smart_collapsableBar('sentlinks', _AM_SOBJECT_SENT_LINKS, _AM_SOBJECT_SENT_LINKS_INFO);
79 79
 
80
-        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
80
+        require_once SMARTOBJECT_ROOT_PATH.'class/smartobjecttable.php';
81 81
         $objectTable = new SmartObjectTable($smartobjectLinkHandler, null, ['delete']);
82 82
         $objectTable->addColumn(new SmartObjectColumn('date'));
83 83
         $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_LINKS_FROM, $align = 'left', $width = false, 'getFromInfo'));
@@ -100,4 +100,4 @@  discard block
 block discarded – undo
100 100
 
101 101
 //smart_modFooter();
102 102
 //xoops_cp_footer();
103
-require_once __DIR__ . '/admin_footer.php';
103
+require_once __DIR__.'/admin_footer.php';
Please login to merge, or discard this patch.
admin/update.php 2 patches
Indentation   +273 added lines, -273 removed lines patch added patch discarded remove patch
@@ -18,180 +18,180 @@  discard block
 block discarded – undo
18 18
 // =========================================================================================
19 19
 function update_tables_to_300()
20 20
 {
21
-    $dbupdater = new WfdownloadsDbupdater();
21
+	$dbupdater = new WfdownloadsDbupdater();
22 22
 
23
-    if (!wfdownloads_TableExists('wfdownloads_meta')) {
24
-        // Create table wfdownloads_meta
25
-        $table = new WfdownloadsTable('wfdownloads_meta');
26
-        $table->setStructure("CREATE TABLE %s (
23
+	if (!wfdownloads_TableExists('wfdownloads_meta')) {
24
+		// Create table wfdownloads_meta
25
+		$table = new WfdownloadsTable('wfdownloads_meta');
26
+		$table->setStructure("CREATE TABLE %s (
27 27
                                 metakey varchar(50) NOT NULL default '',
28 28
                                 metavalue varchar(255) NOT NULL default '',
29 29
                                 PRIMARY KEY (metakey))
30 30
                                 ENGINE=MyISAM;");
31 31
 
32
-        $table->setData(sprintf("'version', %s", round($GLOBALS['xoopsModule']->getVar('version') / 100, 2)));
33
-        if ($dbupdater->updateTable($table)) {
34
-            echo 'wfdownloads_meta table created<br>';
35
-        }
36
-    }
32
+		$table->setData(sprintf("'version', %s", round($GLOBALS['xoopsModule']->getVar('version') / 100, 2)));
33
+		if ($dbupdater->updateTable($table)) {
34
+			echo 'wfdownloads_meta table created<br>';
35
+		}
36
+	}
37 37
 
38
-    $download_fields = [
39
-        'lid'           => ['Type' => 'int(11) unsigned NOT NULL auto_increment', 'Default' => false],
40
-        'cid'           => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true],
41
-        'title'         => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
42
-        'url'           => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
43
-        'filename'      => ['Type' => "varchar(150) NOT NULL default ''", 'Default' => true],
44
-        'filetype'      => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
45
-        'homepage'      => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
46
-        'version'       => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true],
47
-        'size'          => ['Type' => "int(8) NOT NULL default '0'", 'Default' => true],
48
-        'platform'      => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true],
49
-        'screenshot'    => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
50
-        'submitter'     => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
51
-        'publisher'     => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
52
-        'status'        => ['Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true],
53
-        'date'          => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
54
-        'hits'          => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
55
-        'rating'        => ['Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true],
56
-        'votes'         => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
57
-        'comments'      => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
58
-        'license'       => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
59
-        'mirror'        => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
60
-        'price'         => ['Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true],
61
-        'paypalemail'   => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
62
-        'features'      => ['Type' => 'text NOT NULL', 'Default' => false],
63
-        'requirements'  => ['Type' => 'text NOT NULL', 'Default' => false],
64
-        'homepagetitle' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
65
-        'forumid'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
66
-        'limitations'   => ['Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true],
67
-        'dhistory'      => ['Type' => 'text NOT NULL', 'Default' => false],
68
-        'published'     => ['Type' => "int(11) NOT NULL default '1089662528'", 'Default' => true],
69
-        'expired'       => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
70
-        'updated'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
71
-        'offline'       => ['Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true],
72
-        'description'   => ['Type' => 'text NOT NULL', 'Default' => false],
73
-        'ipaddress'     => ['Type' => "varchar(120) NOT NULL default '0'", 'Default' => true],
74
-        'notifypub'     => ['Type' => "int(1) NOT NULL default '0'", 'Default' => true],
75
-        'summary'       => ['Type' => 'text NOT NULL', 'Default' => false]
76
-    ];
38
+	$download_fields = [
39
+		'lid'           => ['Type' => 'int(11) unsigned NOT NULL auto_increment', 'Default' => false],
40
+		'cid'           => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true],
41
+		'title'         => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
42
+		'url'           => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
43
+		'filename'      => ['Type' => "varchar(150) NOT NULL default ''", 'Default' => true],
44
+		'filetype'      => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
45
+		'homepage'      => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
46
+		'version'       => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true],
47
+		'size'          => ['Type' => "int(8) NOT NULL default '0'", 'Default' => true],
48
+		'platform'      => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true],
49
+		'screenshot'    => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
50
+		'submitter'     => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
51
+		'publisher'     => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
52
+		'status'        => ['Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true],
53
+		'date'          => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
54
+		'hits'          => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
55
+		'rating'        => ['Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true],
56
+		'votes'         => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
57
+		'comments'      => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
58
+		'license'       => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
59
+		'mirror'        => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
60
+		'price'         => ['Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true],
61
+		'paypalemail'   => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
62
+		'features'      => ['Type' => 'text NOT NULL', 'Default' => false],
63
+		'requirements'  => ['Type' => 'text NOT NULL', 'Default' => false],
64
+		'homepagetitle' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
65
+		'forumid'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
66
+		'limitations'   => ['Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true],
67
+		'dhistory'      => ['Type' => 'text NOT NULL', 'Default' => false],
68
+		'published'     => ['Type' => "int(11) NOT NULL default '1089662528'", 'Default' => true],
69
+		'expired'       => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
70
+		'updated'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
71
+		'offline'       => ['Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true],
72
+		'description'   => ['Type' => 'text NOT NULL', 'Default' => false],
73
+		'ipaddress'     => ['Type' => "varchar(120) NOT NULL default '0'", 'Default' => true],
74
+		'notifypub'     => ['Type' => "int(1) NOT NULL default '0'", 'Default' => true],
75
+		'summary'       => ['Type' => 'text NOT NULL', 'Default' => false]
76
+	];
77 77
 
78
-    $renamed_fields = [
79
-        'logourl' => 'screenshot'
80
-    ];
78
+	$renamed_fields = [
79
+		'logourl' => 'screenshot'
80
+	];
81 81
 
82
-    echo '<br><b>Checking Download table</b><br>';
83
-    $downloadHandler = xoops_getModuleHandler('download', 'wfdownloads');
84
-    $download_table  = new WfdownloadsTable('wfdownloads_downloads');
85
-    $fields          = get_table_info($downloadHandler->table, $download_fields);
86
-    // Check for renamed fields
87
-    rename_fields($download_table, $renamed_fields, $fields, $download_fields);
88
-    update_table($download_fields, $fields, $download_table);
89
-    if ($dbupdater->updateTable($download_table)) {
90
-        echo 'Downloads table updated<br>';
91
-    }
92
-    unset($fields);
82
+	echo '<br><b>Checking Download table</b><br>';
83
+	$downloadHandler = xoops_getModuleHandler('download', 'wfdownloads');
84
+	$download_table  = new WfdownloadsTable('wfdownloads_downloads');
85
+	$fields          = get_table_info($downloadHandler->table, $download_fields);
86
+	// Check for renamed fields
87
+	rename_fields($download_table, $renamed_fields, $fields, $download_fields);
88
+	update_table($download_fields, $fields, $download_table);
89
+	if ($dbupdater->updateTable($download_table)) {
90
+		echo 'Downloads table updated<br>';
91
+	}
92
+	unset($fields);
93 93
 
94
-    $mod_fields = [
95
-        'requestid'       => ['Type' => 'int(11) NOT NULL auto_increment', 'Default' => false],
96
-        'lid'             => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
97
-        'cid'             => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true],
98
-        'title'           => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
99
-        'url'             => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
100
-        'filename'        => ['Type' => "varchar(150) NOT NULL default ''", 'Default' => true],
101
-        'filetype'        => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
102
-        'homepage'        => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
103
-        'version'         => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true],
104
-        'size'            => ['Type' => "int(8) NOT NULL default '0'", 'Default' => true],
105
-        'platform'        => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true],
106
-        'screenshot'      => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
107
-        'submitter'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
108
-        'publisher'       => ['Type' => 'text NOT NULL', 'Default' => false],
109
-        'status'          => ['Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true],
110
-        'date'            => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
111
-        'hits'            => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
112
-        'rating'          => ['Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true],
113
-        'votes'           => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
114
-        'comments'        => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
115
-        'license'         => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
116
-        'mirror'          => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
117
-        'price'           => ['Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true],
118
-        'paypalemail'     => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
119
-        'features'        => ['Type' => 'text NOT NULL', 'Default' => false],
120
-        'requirements'    => ['Type' => 'text NOT NULL', 'Default' => false],
121
-        'homepagetitle'   => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
122
-        'forumid'         => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
123
-        'limitations'     => ['Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true],
124
-        'dhistory'        => ['Type' => 'text NOT NULL', 'Default' => false],
125
-        'published'       => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
126
-        'expired'         => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
127
-        'updated'         => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
128
-        'offline'         => ['Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true],
129
-        'summary'         => ['Type' => 'text NOT NULL', 'Default' => false],
130
-        'description'     => ['Type' => 'text NOT NULL', 'Default' => false],
131
-        'modifysubmitter' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
132
-        'requestdate'     => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true]
133
-    ];
94
+	$mod_fields = [
95
+		'requestid'       => ['Type' => 'int(11) NOT NULL auto_increment', 'Default' => false],
96
+		'lid'             => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
97
+		'cid'             => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true],
98
+		'title'           => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
99
+		'url'             => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
100
+		'filename'        => ['Type' => "varchar(150) NOT NULL default ''", 'Default' => true],
101
+		'filetype'        => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
102
+		'homepage'        => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
103
+		'version'         => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true],
104
+		'size'            => ['Type' => "int(8) NOT NULL default '0'", 'Default' => true],
105
+		'platform'        => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true],
106
+		'screenshot'      => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
107
+		'submitter'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
108
+		'publisher'       => ['Type' => 'text NOT NULL', 'Default' => false],
109
+		'status'          => ['Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true],
110
+		'date'            => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
111
+		'hits'            => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
112
+		'rating'          => ['Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true],
113
+		'votes'           => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
114
+		'comments'        => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
115
+		'license'         => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
116
+		'mirror'          => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
117
+		'price'           => ['Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true],
118
+		'paypalemail'     => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
119
+		'features'        => ['Type' => 'text NOT NULL', 'Default' => false],
120
+		'requirements'    => ['Type' => 'text NOT NULL', 'Default' => false],
121
+		'homepagetitle'   => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
122
+		'forumid'         => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
123
+		'limitations'     => ['Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true],
124
+		'dhistory'        => ['Type' => 'text NOT NULL', 'Default' => false],
125
+		'published'       => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
126
+		'expired'         => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
127
+		'updated'         => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
128
+		'offline'         => ['Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true],
129
+		'summary'         => ['Type' => 'text NOT NULL', 'Default' => false],
130
+		'description'     => ['Type' => 'text NOT NULL', 'Default' => false],
131
+		'modifysubmitter' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
132
+		'requestdate'     => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true]
133
+	];
134 134
 
135
-    $renamed_fields = [
136
-        'logourl' => 'screenshot'
137
-    ];
135
+	$renamed_fields = [
136
+		'logourl' => 'screenshot'
137
+	];
138 138
 
139
-    echo '<br><b>Checking Modified Downloads table</b><br>';
140
-    $moduleHandler = xoops_getModuleHandler('modification', 'wfdownloads');
141
-    $mod_table     = new WfdownloadsTable('wfdownloads_mod');
142
-    $fields        = get_table_info($moduleHandler->table, $mod_fields);
143
-    rename_fields($mod_table, $renamed_fields, $fields, $mod_fields);
144
-    update_table($mod_fields, $fields, $mod_table);
145
-    if ($dbupdater->updateTable($mod_table)) {
146
-        echo 'Modified Downloads table updated <br>';
147
-    }
148
-    unset($fields);
139
+	echo '<br><b>Checking Modified Downloads table</b><br>';
140
+	$moduleHandler = xoops_getModuleHandler('modification', 'wfdownloads');
141
+	$mod_table     = new WfdownloadsTable('wfdownloads_mod');
142
+	$fields        = get_table_info($moduleHandler->table, $mod_fields);
143
+	rename_fields($mod_table, $renamed_fields, $fields, $mod_fields);
144
+	update_table($mod_fields, $fields, $mod_table);
145
+	if ($dbupdater->updateTable($mod_table)) {
146
+		echo 'Modified Downloads table updated <br>';
147
+	}
148
+	unset($fields);
149 149
 
150
-    $cat_fields = [
151
-        'cid'          => ['Type' => 'int(5) unsigned NOT NULL auto_increment', 'Default' => false],
152
-        'pid'          => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true],
153
-        'title'        => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true],
154
-        'imgurl'       => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
155
-        'description'  => ['Type' => "text NULL", 'Default' => true],
156
-        'total'        => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
157
-        'summary'      => ['Type' => 'text NOT NULL', 'Default' => false],
158
-        'spotlighttop' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
159
-        'spotlighthis' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
160
-        'dohtml'       => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
161
-        'dosmiley'     => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
162
-        'doxcode'      => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
163
-        'doimage'      => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
164
-        'dobr'         => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
165
-        'weight'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true]
166
-    ];
167
-    echo '<br><b>Checking Category table</b><br>';
168
-    $catHandler = xoops_getModuleHandler('category', 'wfdownloads');
169
-    $cat_table  = new WfdownloadsTable('wfdownloads_cat');
170
-    $fields     = get_table_info($catHandler->table, $cat_fields);
171
-    update_table($cat_fields, $fields, $cat_table);
172
-    if ($dbupdater->updateTable($cat_table)) {
173
-        echo 'Category table updated<br>';
174
-    }
175
-    unset($fields);
150
+	$cat_fields = [
151
+		'cid'          => ['Type' => 'int(5) unsigned NOT NULL auto_increment', 'Default' => false],
152
+		'pid'          => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true],
153
+		'title'        => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true],
154
+		'imgurl'       => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
155
+		'description'  => ['Type' => "text NULL", 'Default' => true],
156
+		'total'        => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
157
+		'summary'      => ['Type' => 'text NOT NULL', 'Default' => false],
158
+		'spotlighttop' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
159
+		'spotlighthis' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
160
+		'dohtml'       => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
161
+		'dosmiley'     => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
162
+		'doxcode'      => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
163
+		'doimage'      => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
164
+		'dobr'         => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
165
+		'weight'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true]
166
+	];
167
+	echo '<br><b>Checking Category table</b><br>';
168
+	$catHandler = xoops_getModuleHandler('category', 'wfdownloads');
169
+	$cat_table  = new WfdownloadsTable('wfdownloads_cat');
170
+	$fields     = get_table_info($catHandler->table, $cat_fields);
171
+	update_table($cat_fields, $fields, $cat_table);
172
+	if ($dbupdater->updateTable($cat_table)) {
173
+		echo 'Category table updated<br>';
174
+	}
175
+	unset($fields);
176 176
 
177
-    $broken_fields = [
178
-        'reportid'     => ['Type' => 'int(5) NOT NULL auto_increment', 'Default' => false],
179
-        'lid'          => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
180
-        'sender'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
181
-        'ip'           => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true],
182
-        'date'         => ['Type' => "varchar(11) NOT NULL default '0'", 'Default' => true],
183
-        'confirmed'    => ['Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true],
184
-        'acknowledged' => ['Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true]
185
-    ];
186
-    echo '<br><b>Checking Broken Report table</b><br>';
187
-    $brokenHandler = xoops_getModuleHandler('report', 'wfdownloads');
188
-    $broken_table  = new WfdownloadsTable('wfdownloads_broken');
189
-    $fields        = get_table_info($brokenHandler->table, $broken_fields);
190
-    update_table($broken_fields, $fields, $broken_table);
191
-    if ($dbupdater->updateTable($broken_table)) {
192
-        echo 'Broken Reports table updated<br>';
193
-    }
194
-    unset($fields);
177
+	$broken_fields = [
178
+		'reportid'     => ['Type' => 'int(5) NOT NULL auto_increment', 'Default' => false],
179
+		'lid'          => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
180
+		'sender'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
181
+		'ip'           => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true],
182
+		'date'         => ['Type' => "varchar(11) NOT NULL default '0'", 'Default' => true],
183
+		'confirmed'    => ['Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true],
184
+		'acknowledged' => ['Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true]
185
+	];
186
+	echo '<br><b>Checking Broken Report table</b><br>';
187
+	$brokenHandler = xoops_getModuleHandler('report', 'wfdownloads');
188
+	$broken_table  = new WfdownloadsTable('wfdownloads_broken');
189
+	$fields        = get_table_info($brokenHandler->table, $broken_fields);
190
+	update_table($broken_fields, $fields, $broken_table);
191
+	if ($dbupdater->updateTable($broken_table)) {
192
+		echo 'Broken Reports table updated<br>';
193
+	}
194
+	unset($fields);
195 195
 }
196 196
 
197 197
 // =========================================================================================
@@ -204,48 +204,48 @@  discard block
 block discarded – undo
204 204
  */
205 205
 function invert_nohtm_dohtml_values()
206 206
 {
207
-    $ret = [];
208
-    global $xoopsDB;
209
-    $catHandler = xoops_getModuleHandler('category', 'wfdownloads');
210
-    $result     = $xoopsDB->query('SHOW COLUMNS FROM ' . $catHandler->table);
211
-    while ($existing_field = $xoopsDB->fetchArray($result)) {
212
-        $fields[$existing_field['field']] = $existing_field['type'];
213
-    }
214
-    if (in_array('nohtml', array_keys($fields))) {
215
-        $dbupdater = new WfdownloadsDbupdater();
216
-        //Invert column values
217
-        // alter options in wfdownloads_cat
218
-        $table = new WfdownloadsTable('wfdownloads_cat');
219
-        $table->addAlteredField('nohtml', "dohtml tinyint(1) NOT NULL DEFAULT '1'");
220
-        $table->addAlteredField('nosmiley', "dosmiley tinyint(1) NOT NULL DEFAULT '1'");
221
-        $table->addAlteredField('noxcodes', "doxcode tinyint(1) NOT NULL DEFAULT '1'");
222
-        $table->addAlteredField('noimages', "doimage tinyint(1) NOT NULL DEFAULT '1'");
223
-        $table->addAlteredField('nobreak', "dobr tinyint(1) NOT NULL DEFAULT '1'");
207
+	$ret = [];
208
+	global $xoopsDB;
209
+	$catHandler = xoops_getModuleHandler('category', 'wfdownloads');
210
+	$result     = $xoopsDB->query('SHOW COLUMNS FROM ' . $catHandler->table);
211
+	while ($existing_field = $xoopsDB->fetchArray($result)) {
212
+		$fields[$existing_field['field']] = $existing_field['type'];
213
+	}
214
+	if (in_array('nohtml', array_keys($fields))) {
215
+		$dbupdater = new WfdownloadsDbupdater();
216
+		//Invert column values
217
+		// alter options in wfdownloads_cat
218
+		$table = new WfdownloadsTable('wfdownloads_cat');
219
+		$table->addAlteredField('nohtml', "dohtml tinyint(1) NOT NULL DEFAULT '1'");
220
+		$table->addAlteredField('nosmiley', "dosmiley tinyint(1) NOT NULL DEFAULT '1'");
221
+		$table->addAlteredField('noxcodes', "doxcode tinyint(1) NOT NULL DEFAULT '1'");
222
+		$table->addAlteredField('noimages', "doimage tinyint(1) NOT NULL DEFAULT '1'");
223
+		$table->addAlteredField('nobreak', "dobr tinyint(1) NOT NULL DEFAULT '1'");
224 224
 
225
-        //inverting values no=1 <=> do=0
226
-        // have to store teporarly as value = 2 to
227
-        // avoid putting everithing to same value
228
-        // if you change 1 to 0, then 0 to one,
229
-        // every value will be 1, follow me?
230
-        $table->addUpdatedWhere('dohtml', 2, '=1');
231
-        $table->addUpdatedWhere('dohtml', 1, '=0');
232
-        $table->addUpdatedWhere('dohtml', 0, '=2');
225
+		//inverting values no=1 <=> do=0
226
+		// have to store teporarly as value = 2 to
227
+		// avoid putting everithing to same value
228
+		// if you change 1 to 0, then 0 to one,
229
+		// every value will be 1, follow me?
230
+		$table->addUpdatedWhere('dohtml', 2, '=1');
231
+		$table->addUpdatedWhere('dohtml', 1, '=0');
232
+		$table->addUpdatedWhere('dohtml', 0, '=2');
233 233
 
234
-        $table->addUpdatedWhere('dosmiley', 2, '=1');
235
-        $table->addUpdatedWhere('dosmiley', 1, '=0');
236
-        $table->addUpdatedWhere('dosmiley', 0, '=2');
234
+		$table->addUpdatedWhere('dosmiley', 2, '=1');
235
+		$table->addUpdatedWhere('dosmiley', 1, '=0');
236
+		$table->addUpdatedWhere('dosmiley', 0, '=2');
237 237
 
238
-        $table->addUpdatedWhere('doxcode', 2, '=1');
239
-        $table->addUpdatedWhere('doxcode', 1, '=0');
240
-        $table->addUpdatedWhere('doxcode', 0, '=2');
238
+		$table->addUpdatedWhere('doxcode', 2, '=1');
239
+		$table->addUpdatedWhere('doxcode', 1, '=0');
240
+		$table->addUpdatedWhere('doxcode', 0, '=2');
241 241
 
242
-        $table->addUpdatedWhere('doimage', 2, '=1');
243
-        $table->addUpdatedWhere('doimage', 1, '=0');
244
-        $table->addUpdatedWhere('doimage', 0, '=2');
245
-        $ret = $dbupdater->updateTable($table);
246
-    }
242
+		$table->addUpdatedWhere('doimage', 2, '=1');
243
+		$table->addUpdatedWhere('doimage', 1, '=0');
244
+		$table->addUpdatedWhere('doimage', 0, '=2');
245
+		$ret = $dbupdater->updateTable($table);
246
+	}
247 247
 
248
-    return $ret;
248
+	return $ret;
249 249
 }
250 250
 
251 251
 /**
@@ -258,22 +258,22 @@  discard block
 block discarded – undo
258 258
  */
259 259
 function update_table($new_fields, $existing_fields, &$table)
260 260
 {
261
-    foreach ($new_fields as $field => $fieldinfo) {
262
-        $type = $fieldinfo['Type'];
263
-        if (!in_array($field, array_keys($existing_fields))) {
264
-            //Add field as it is missing
265
-            $table->addNewField($field, $type);
266
-            //$xoopsDB->query("ALTER TABLE ".$table." ADD ".$field." ".$type);
267
-            //echo $field."(".$type.") <FONT COLOR='##22DD51'>Added</FONT><br>";
268
-        } elseif ($existing_fields[$field] != $type) {
269
-            $table->addAlteredField($field, $field . ' ' . $type);
270
-            // check $fields[$field]['type'] for things like "int(10) unsigned"
271
-            //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$field." ".$type);
272
-            //echo $field." <FONT COLOR='#FF6600'>Changed to</FONT> ".$type."<br>";
273
-        } else {
274
-            //echo $field." <FONT COLOR='#0033FF'>Uptodate</FONT><br>";
275
-        }
276
-    }
261
+	foreach ($new_fields as $field => $fieldinfo) {
262
+		$type = $fieldinfo['Type'];
263
+		if (!in_array($field, array_keys($existing_fields))) {
264
+			//Add field as it is missing
265
+			$table->addNewField($field, $type);
266
+			//$xoopsDB->query("ALTER TABLE ".$table." ADD ".$field." ".$type);
267
+			//echo $field."(".$type.") <FONT COLOR='##22DD51'>Added</FONT><br>";
268
+		} elseif ($existing_fields[$field] != $type) {
269
+			$table->addAlteredField($field, $field . ' ' . $type);
270
+			// check $fields[$field]['type'] for things like "int(10) unsigned"
271
+			//$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$field." ".$type);
272
+			//echo $field." <FONT COLOR='#FF6600'>Changed to</FONT> ".$type."<br>";
273
+		} else {
274
+			//echo $field." <FONT COLOR='#0033FF'>Uptodate</FONT><br>";
275
+		}
276
+	}
277 277
 }
278 278
 
279 279
 /**
@@ -286,22 +286,22 @@  discard block
 block discarded – undo
286 286
  */
287 287
 function get_table_info($table, $default_fields)
288 288
 {
289
-    global $xoopsDB;
290
-    $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $table);
291
-    while ($existing_field = $xoopsDB->fetchArray($result)) {
292
-        $fields[$existing_field['Field']] = $existing_field['Type'];
293
-        if ($existing_field['Null'] !== 'YES') {
294
-            $fields[$existing_field['Field']] .= ' NOT NULL';
295
-        }
296
-        if ($existing_field['Extra']) {
297
-            $fields[$existing_field['Field']] .= ' ' . $existing_field['Extra'];
298
-        }
299
-        if ($default_fields[$existing_field['Field']]['Default']) {
300
-            $fields[$existing_field['Field']] .= " default '" . $existing_field['Default'] . "'";
301
-        }
302
-    }
289
+	global $xoopsDB;
290
+	$result = $xoopsDB->query('SHOW COLUMNS FROM ' . $table);
291
+	while ($existing_field = $xoopsDB->fetchArray($result)) {
292
+		$fields[$existing_field['Field']] = $existing_field['Type'];
293
+		if ($existing_field['Null'] !== 'YES') {
294
+			$fields[$existing_field['Field']] .= ' NOT NULL';
295
+		}
296
+		if ($existing_field['Extra']) {
297
+			$fields[$existing_field['Field']] .= ' ' . $existing_field['Extra'];
298
+		}
299
+		if ($default_fields[$existing_field['Field']]['Default']) {
300
+			$fields[$existing_field['Field']] .= " default '" . $existing_field['Default'] . "'";
301
+		}
302
+	}
303 303
 
304
-    return $fields;
304
+	return $fields;
305 305
 }
306 306
 
307 307
 /**
@@ -315,60 +315,60 @@  discard block
 block discarded – undo
315 315
  */
316 316
 function rename_fields(&$table, $renamed_fields, &$fields, $new_fields)
317 317
 {
318
-    foreach (array_keys($fields) as $field) {
319
-        if (in_array($field, array_keys($renamed_fields))) {
320
-            $new_field_name = $renamed_fields[$field];
321
-            $new_field_type = $new_fields[$new_field_name]['Type'];
322
-            $table->addAltered($field, $new_field_name . ' ' . $new_field_type);
323
-            //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$new_field_name." ".$new_field_type);
324
-            //echo $field." Renamed to ".$new_field_name."<br>";
325
-            $fields[$new_field_name] = $new_field_type;
326
-        }
327
-    }
328
-    //return $fields;
318
+	foreach (array_keys($fields) as $field) {
319
+		if (in_array($field, array_keys($renamed_fields))) {
320
+			$new_field_name = $renamed_fields[$field];
321
+			$new_field_type = $new_fields[$new_field_name]['Type'];
322
+			$table->addAltered($field, $new_field_name . ' ' . $new_field_type);
323
+			//$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$new_field_name." ".$new_field_type);
324
+			//echo $field." Renamed to ".$new_field_name."<br>";
325
+			$fields[$new_field_name] = $new_field_type;
326
+		}
327
+	}
328
+	//return $fields;
329 329
 }
330 330
 
331 331
 $op = isset($_REQUEST['op']) ? (int)$_REQUEST['op'] : 0;
332 332
 switch ($op) {
333
-    case 1:
334
-        // Make sure that nohtml is properly changed to dohtml
335
-        invert_nohtm_dohtml_values();
336
-        // Ensure that the proper tables are present
337
-        update_tables_to_300();
338
-        // Import data from MyDownloads
339
-        import_mydownloads_to_wfdownloads();
340
-        break;
333
+	case 1:
334
+		// Make sure that nohtml is properly changed to dohtml
335
+		invert_nohtm_dohtml_values();
336
+		// Ensure that the proper tables are present
337
+		update_tables_to_300();
338
+		// Import data from MyDownloads
339
+		import_mydownloads_to_wfdownloads();
340
+		break;
341 341
 
342
-    case 2:
343
-        // Update WF-Downloads
344
-        $log = invert_nohtm_dohtml_values();
345
-        update_tables_to_300();
346
-        break;
342
+	case 2:
343
+		// Update WF-Downloads
344
+		$log = invert_nohtm_dohtml_values();
345
+		update_tables_to_300();
346
+		break;
347 347
 
348
-    default:
349
-        //ask what to do
350
-        include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
351
-        $form = new XoopsThemeForm('Upgrade WF-Downloads', 'form', $_SERVER['REQUEST_URI']);
348
+	default:
349
+		//ask what to do
350
+		include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
351
+		$form = new XoopsThemeForm('Upgrade WF-Downloads', 'form', $_SERVER['REQUEST_URI']);
352 352
 
353
-        //Is MyDownloads installed?
354
-        /** @var XoopsModuleHandler $moduleHandler */
355
-        $moduleHandler     = xoops_getHandler('module');
356
-        $mydownloadsModule = $moduleHandler->getByDirname('mydownloads');
357
-        if (is_object($mydownloadsModule)) {
358
-            $mydownloadsButton = new XoopsFormButton('Import data from MyDownloads', 'myd_button', 'Import', 'submit');
359
-            $mydownloadsButton->setExtra("onclick='document.forms.form.op.value=\"1\"'");
360
-            $form->addElement($mydownloadsButton);
361
-        }
353
+		//Is MyDownloads installed?
354
+		/** @var XoopsModuleHandler $moduleHandler */
355
+		$moduleHandler     = xoops_getHandler('module');
356
+		$mydownloadsModule = $moduleHandler->getByDirname('mydownloads');
357
+		if (is_object($mydownloadsModule)) {
358
+			$mydownloadsButton = new XoopsFormButton('Import data from MyDownloads', 'myd_button', 'Import', 'submit');
359
+			$mydownloadsButton->setExtra("onclick='document.forms.form.op.value=\"1\"'");
360
+			$form->addElement($mydownloadsButton);
361
+		}
362 362
 
363
-        if (!wfdownloads_TableExists('wfdownloads_meta')) {
364
-            $updateButton = new XoopsFormButton('Update WF-Downloads', 'upd_button', 'Update', 'submit');
365
-            $updateButton->setExtra("onclick='document.forms.form.op.value=\"2\"'");
366
-            $form->addElement($updateButton);
367
-        }
363
+		if (!wfdownloads_TableExists('wfdownloads_meta')) {
364
+			$updateButton = new XoopsFormButton('Update WF-Downloads', 'upd_button', 'Update', 'submit');
365
+			$updateButton->setExtra("onclick='document.forms.form.op.value=\"2\"'");
366
+			$form->addElement($updateButton);
367
+		}
368 368
 
369
-        $form->addElement(new XoopsFormHidden('op', 0));
370
-        $form->display();
371
-        break;
369
+		$form->addElement(new XoopsFormHidden('op', 0));
370
+		$form->display();
371
+		break;
372 372
 }
373 373
 //wfdownloads_modFooter();
374 374
 //xoops_cp_footer();
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
  * Licence: GNU
8 8
  */
9 9
 
10
-require_once __DIR__ . '/admin_header.php';
11
-require_once SMARTCONTENT_ROOT_PATH . 'class/dbupdater.php';
10
+require_once __DIR__.'/admin_header.php';
11
+require_once SMARTCONTENT_ROOT_PATH.'class/dbupdater.php';
12 12
 
13 13
 smartcontent_xoops_cp_header();
14 14
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
     $ret = [];
208 208
     global $xoopsDB;
209 209
     $catHandler = xoops_getModuleHandler('category', 'wfdownloads');
210
-    $result     = $xoopsDB->query('SHOW COLUMNS FROM ' . $catHandler->table);
210
+    $result     = $xoopsDB->query('SHOW COLUMNS FROM '.$catHandler->table);
211 211
     while ($existing_field = $xoopsDB->fetchArray($result)) {
212 212
         $fields[$existing_field['field']] = $existing_field['type'];
213 213
     }
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
             //$xoopsDB->query("ALTER TABLE ".$table." ADD ".$field." ".$type);
267 267
             //echo $field."(".$type.") <FONT COLOR='##22DD51'>Added</FONT><br>";
268 268
         } elseif ($existing_fields[$field] != $type) {
269
-            $table->addAlteredField($field, $field . ' ' . $type);
269
+            $table->addAlteredField($field, $field.' '.$type);
270 270
             // check $fields[$field]['type'] for things like "int(10) unsigned"
271 271
             //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$field." ".$type);
272 272
             //echo $field." <FONT COLOR='#FF6600'>Changed to</FONT> ".$type."<br>";
@@ -287,17 +287,17 @@  discard block
 block discarded – undo
287 287
 function get_table_info($table, $default_fields)
288 288
 {
289 289
     global $xoopsDB;
290
-    $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $table);
290
+    $result = $xoopsDB->query('SHOW COLUMNS FROM '.$table);
291 291
     while ($existing_field = $xoopsDB->fetchArray($result)) {
292 292
         $fields[$existing_field['Field']] = $existing_field['Type'];
293 293
         if ($existing_field['Null'] !== 'YES') {
294 294
             $fields[$existing_field['Field']] .= ' NOT NULL';
295 295
         }
296 296
         if ($existing_field['Extra']) {
297
-            $fields[$existing_field['Field']] .= ' ' . $existing_field['Extra'];
297
+            $fields[$existing_field['Field']] .= ' '.$existing_field['Extra'];
298 298
         }
299 299
         if ($default_fields[$existing_field['Field']]['Default']) {
300
-            $fields[$existing_field['Field']] .= " default '" . $existing_field['Default'] . "'";
300
+            $fields[$existing_field['Field']] .= " default '".$existing_field['Default']."'";
301 301
         }
302 302
     }
303 303
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
         if (in_array($field, array_keys($renamed_fields))) {
320 320
             $new_field_name = $renamed_fields[$field];
321 321
             $new_field_type = $new_fields[$new_field_name]['Type'];
322
-            $table->addAltered($field, $new_field_name . ' ' . $new_field_type);
322
+            $table->addAltered($field, $new_field_name.' '.$new_field_type);
323 323
             //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$new_field_name." ".$new_field_type);
324 324
             //echo $field." Renamed to ".$new_field_name."<br>";
325 325
             $fields[$new_field_name] = $new_field_type;
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
     //return $fields;
329 329
 }
330 330
 
331
-$op = isset($_REQUEST['op']) ? (int)$_REQUEST['op'] : 0;
331
+$op = isset($_REQUEST['op']) ? (int) $_REQUEST['op'] : 0;
332 332
 switch ($op) {
333 333
     case 1:
334 334
         // Make sure that nohtml is properly changed to dohtml
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 
348 348
     default:
349 349
         //ask what to do
350
-        include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
350
+        include XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
351 351
         $form = new XoopsThemeForm('Upgrade WF-Downloads', 'form', $_SERVER['REQUEST_URI']);
352 352
 
353 353
         //Is MyDownloads installed?
@@ -372,4 +372,4 @@  discard block
 block discarded – undo
372 372
 }
373 373
 //wfdownloads_modFooter();
374 374
 //xoops_cp_footer();
375
-require_once __DIR__ . '/admin_footer.php';
375
+require_once __DIR__.'/admin_footer.php';
Please login to merge, or discard this patch.