Completed
Push — development ( a150a5...f82eb6 )
by Andrij
17:01
created

Components::modules_table()   C

Complexity

Conditions 7
Paths 24

Size

Total Lines 81
Code Lines 58

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 7
eloc 58
c 2
b 1
f 0
nc 24
nop 0
dl 0
loc 81
rs 6.5544

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
use CMSFactory\Events;
4
5
if (!defined('BASEPATH')) {
6
    exit('No direct script access allowed');
7
}
8
9
/**
10
 * Image CMS
11
 * Components Class
12
 * @property Cms_hooks $cms_hooks
13
 * @property Lib_admin $lib_admin
14
 */
15
class Components extends BaseAdminController
16
{
0 ignored issues
show
introduced by
Opening brace of a class must be on the same line as the definition
Loading history...
17
18
    /**
19
     * array of installed modules
20
     * @var array
21
     */
22
    private $installed = [];
23
24
    private $permited = [];
25
26 View Code Duplication
    public function __construct() {
27
        parent::__construct();
28
29
        $this->load->library('DX_Auth');
30
31
        admin_or_redirect();
32
33
        $this->load->library('lib_admin');
34
        $this->lib_admin->init_settings();
35
        $this->setInstalled();
36
        $this->setPermited();
37
    }
38
39
    public function index() {
40
        $this->modules_table();
41
    }
42
43
    public function modules_table() {
44
        $not_installed = [];
45
46
        $fs_modules = $this->find_components();
47
        $db_modules = $this->db->order_by('position', 'asc')->not_like('identif', 'payment_method_')->get('components')->result_array();
48
49
        // Find not installed modules
50
        $count = count($fs_modules);
51
        for ($i = 0; $i < $count; $i++) {
52
            if ($this->is_installed($fs_modules[$i]['com_name']) == 0) {
53
                $info = $this->get_module_info($fs_modules[$i]['com_name']);
54
55
                $fs_modules[$i]['name'] = $info['menu_name'];
56
                $fs_modules[$i]['version'] = $info['version'];
57
                $fs_modules[$i]['description'] = $info['description'];
58
                $fs_modules[$i]['icon_class'] = $info['icon_class'];
59
60
                array_push($not_installed, $fs_modules[$i]);
61
            }
62
        }
63
64
        // process modules info
65
        $count = count($db_modules);
66
        for ($i = 0; $i < $count; $i++) {
67
            $module_name = $db_modules[$i]['name'];
68
            if ($this->module_exists($module_name)) {
69
70
                $info = $this->get_module_info($module_name);
71
                $db_modules[$i]['menu_name'] = $info['menu_name'];
72
                $db_modules[$i]['version'] = $info['version'];
73
                $db_modules[$i]['description'] = $info['description'];
74
                $db_modules[$i]['icon_class'] = $info['icon_class'];
75
                $db_modules[$i]['identif'] = $db_modules[$i]['identif'];
76
                $modulePath = getModulePath($module_name);
77
                if (file_exists($modulePath . 'admin.php')) {
78
                    $db_modules[$i]['admin_file'] = 1;
79
                } else {
80
                    $db_modules[$i]['admin_file'] = 0;
81
                }
82
            } else {
83
                unset($db_modules[$i]);
84
            }
85
        }
86
87
        if (MAINSITE != '') {
88
            list($db_modules, $not_installed) = $this->isPermitedModules($db_modules, $not_installed);
89
        }
90
91
        Events::create()->registerEvent(
92
            [
93
             'installed'     => $db_modules,
94
             'not_installed' => $not_installed,
95
            ],
96
            'Components:modules_table'
97
        )->runFactory();
98
99
        $frozen_autoload = [
100
                            'template_manager',
101
                            'admin_menu',
102
                            'xbanners',
103
                            'menu',
104
                            'cmsemail',
105
                            'shop',
106
                           ];
107
        $frozen_delete = [
108
                          'template_manager',
109
                          'admin_menu',
110
                          'xbanners',
111
                          'menu',
112
                          'cmsemail',
113
                          'shop',
114
                          'mod_discount',
115
                          'auth',
116
                         ];
117
118
        $this->template->assign('frozen_autoload', $frozen_autoload);
119
        $this->template->assign('frozen_delete', $frozen_delete);
120
        $this->template->assign('installed', $db_modules);
121
        $this->template->assign('not_installed', $not_installed);
122
        $this->template->show('module_table', FALSE);
123
    }
124
125
    private function isNotPermited($moduleName) {
126
        if (MAINSITE != '') {
127
            return !in_array($moduleName, $this->permited);
128
        } else {
129
            return FALSE;
130
        }
131
    }
132
133
    private function isPermitedModules($db_modules, $not_installed) {
134
        foreach ($db_modules as $key => $db_module) {
135
            if ($this->isNotPermited($db_module['name'])) {
136
                unset($db_modules[$key]);
137
            }
138
        }
139
        foreach ($not_installed as $key => $db_module) {
140
            if ($this->isNotPermited($db_module['com_name'])) {
141
                unset($not_installed[$key]);
142
            }
143
        }
144
        return [
145
                $db_modules,
146
                $not_installed,
147
               ];
148
    }
149
150
    private function setInstalled() {
151
        $installed = $this->db->select('name')->get('components')->result_array();
152
        $this->installed = array_column($installed, 'name');
153
    }
154
155
    private function setPermited() {
156
        if (MAINSITE != '' and $this->load->module('mainsaas')) {
157
            $this->permited = $this->load->module('mainsaas')->getNotPermited();
158
            $this->permited = array_map('trim', $this->permited);
159
        }
160
    }
161
162
    public function is_installed($mod_name) {
163
        return in_array($mod_name, $this->installed);
164
    }
165
166
    public function install($module = '') {
167
        //cp_check_perm('module_install');
168
169
        $module = strtolower($module);
170
171
        ($hook = get_hook('admin_install_module')) ? eval($hook) : NULL;
0 ignored issues
show
Unused Code introduced by
The call to get_hook() has too many arguments starting with 'admin_install_module'.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
Coding Style introduced by
It is generally not recommended to use eval unless absolutely required.

On one hand, eval might be exploited by malicious users if they somehow manage to inject dynamic content. On the other hand, with the emergence of faster PHP runtimes like the HHVM, eval prevents some optimization that they perform.

Loading history...
172
173
        $modulePath = getModulePath($module);
174
175
        if (file_exists($modulePath . $module . '.php') AND $this->is_installed($module) == 0) {
176
            // Make module install
177
            $data = [
178
                     'name'    => $module,
179
                     'identif' => $module,
180
                    ];
181
182
            $this->db->insert('components', $data);
183
            $this->load->module($module);
184
185
            if (method_exists($module, '_install') === TRUE) {
186
                $this->$module->_install();
187
            }
188
189
            // Update hooks
190
            $this->load->library('cms_hooks');
191
            $this->cms_hooks->build_hooks();
192
193
            $this->lib_admin->log(lang('Installed a module', 'admin') . ' ' . $data['name']);
194
195 View Code Duplication
            if ($this->input->server('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest') {
196
                $result = true;
197
                echo json_encode(['result' => $result]);
198
            } else {
199
                return TRUE;
200
            }
201 View Code Duplication
        } else {
202
            if ($this->input->server('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest') {
203
                $result = true;
204
                echo json_encode(['result' => $result]);
205
            } else {
206
                return FALSE;
207
            }
208
        }
209
    }
210
211
    /**
212
     * @param string $moduleName
213
     * @return bool
0 ignored issues
show
Documentation introduced by
Should the return type not be boolean|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
214
     */
215
    public function deinstall($moduleName) {
216
        $modules = $this->input->post('ids') ?: [$moduleName];
217
218
        foreach ($modules as $module) {
219
            $module = strtolower($module);
220
221
            ($hook = get_hook('admin_deinstall_module')) ? eval($hook) : NULL;
0 ignored issues
show
Unused Code introduced by
The call to get_hook() has too many arguments starting with 'admin_deinstall_module'.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
Coding Style introduced by
It is generally not recommended to use eval unless absolutely required.

On one hand, eval might be exploited by malicious users if they somehow manage to inject dynamic content. On the other hand, with the emergence of faster PHP runtimes like the HHVM, eval prevents some optimization that they perform.

Loading history...
222
223
            $modulePath = getModulePath($module);
224
225
            if (file_exists($modulePath . $module . '.php') AND $this->is_installed($module) == 1) {
226
                $this->load->module($module);
227
228
                if (method_exists($module, '_deinstall') === TRUE) {
229
                    $this->$module->_deinstall();
230
                }
231
232
                $this->db->limit(1);
233
                $this->db->delete('components', ['name' => $module]);
234
                $this->lib_admin->log(lang('Deleted a module', 'admin') . ' ' . $module);
235
                if (PHP_SAPI == 'cli') {
236
                    return true;
237
                }
238
                showMessage(lang('The module successfully uninstall', 'admin'));
239
                pjax('/admin/components/modules_table');
240
            } else {
241
                if (PHP_SAPI == 'cli') {
242
                    return false;
243
                }
244
                showMessage(lang('Module deletion error', 'admin'), false, 'r');
245
                pjax('/admin/components/modules_table');
246
            }
247
248
            // Update hooks
249
            $this->load->library('cms_hooks');
250
            $this->cms_hooks->build_hooks();
251
        }
252
    }
253
254
    /**
255
     * Check is module exists
256
     * @param string $module_name module name
257
     * @return boolean
258
     */
259
    public function module_exists($module_name) {
260
        return moduleExists($module_name);
261
    }
262
263
    public function find_components($in_menu = FALSE) {
264
        $components = [];
265
        if ($in_menu == TRUE) {
266
            $this->db->where('in_menu', 1);
267
        }
268
        $this->db->not_like('identif', 'payment_method_');
269
        $installed = $this->db->get('components')->result_array();
270
271
        $modulesPaths = getModulesPaths();
272
        foreach ($modulesPaths as $moduleName => $modulePath) {
273
274
            $info_file = $modulePath . 'module_info.php';
275
            $com_file_admin = $modulePath . 'admin.php';
276
277
            $lang = new MY_Lang();
278
            $lang->load($moduleName);
279
280
            if (file_exists($info_file)) {
281
                include $info_file;
282
283
                if (file_exists($com_file_admin)) {
284
                    $admin_file = 1;
285
                } else {
286
                    $admin_file = 0;
287
                }
288
289
                $ins = FALSE;
290
291
                foreach ($installed as $k) {
292
                    if ($k['name'] == $moduleName) {
293
                        $ins = TRUE;
294
                    }
295
                }
296
297
                $new_com = [
298
                            'menu_name'  => $com_info['menu_name'],
0 ignored issues
show
Bug introduced by
The variable $com_info does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
299
                            'com_name'   => $moduleName,
300
                            'admin_file' => $admin_file,
301
                            'installed'  => $ins,
302
                            'type'       => $com_info['type'],
303
                           ];
304
305
                array_push($components, $new_com);
306
            }
307
        }
308
        return $components;
309
    }
310
311
    /**
312
     * Get components which show in menu and have admin.php
313
     * @return array|boolean
314
     */
315
    public function find_components_for_menu_list() {
316
        /** Get all components which show in menu */
317
        $components = $this->db->where('in_menu', 1);
318
319
        if (MAINSITE) {
320
            $components = $components->order_by('name', 'asc');
321
        } else {
322
            $components = $components->order_by('position', 'asc');
323
        }
324
325
        $components = $components->get('components')
326
            ->result_array();
327
328
        if (MAINSITE != '') {
329
            $components = $this->isPermitedModules($components, []);
330
            $components = $components[0];
331
        }
332
        /*         * If not components for show in menu */
333
        if (!$components) {
334
            return false;
335
        } else {
336
            /** Delete components which not have admin.php */
337
            foreach ($components as $key => $value) {
338
                if (!file_exists(getModulePath($value['name']) . 'admin.php')) {
339
                    unset($components[$key]);
340
                } else {
341
                    $info_file = getModulePath($value['name']) . 'module_info.php';
342
                    $lang = new MY_Lang();
343
                    $lang->load($value['name']);
344
345
                    if (file_exists($info_file)) {
346
                        include $info_file;
347
                        $components[$key]['type'] = $com_info['type'];
0 ignored issues
show
Bug introduced by
The variable $com_info does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
348
                        $components[$key] = array_merge($components[$key], $com_info);
349
                    }
350
                }
351
            }
352
        }
353
        return $components;
354
    }
355
356
    /**
357
     * @param string $component
358
     */
359
    public function component_settings($component) {
360
361
        $this->db->where('name', $component);
362
        $query = $this->db->get('components', 1);
363
364
        if ($query->num_rows() == 1) {
365
            $com = $query->row_array();
366
            $this->template->add_array($com);
367
        } else {
368
            $this->template->assign('com_name', $component);
369
            $this->template->assign('identif', $component);
370
            $this->template->assign('status', 0);
371
        }
372
373
        $this->template->show('component_settings', FALSE);
374
    }
375
376
    /**
377
     * Save component settings
378
     * @param string $component
379
     */
380
    public function save_settings($component) {
381
        //cp_check_perm('module_admin');
382
383
        $this->db->where('name', $component);
384
        $query = $this->db->get('components', 1);
385
386
        $com = $query->row_array();
387
388
        ($hook = get_hook('admin_component_save_settings')) ? eval($hook) : NULL;
0 ignored issues
show
Unused Code introduced by
The call to get_hook() has too many arguments starting with 'admin_component_save_settings'.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
Coding Style introduced by
It is generally not recommended to use eval unless absolutely required.

On one hand, eval might be exploited by malicious users if they somehow manage to inject dynamic content. On the other hand, with the emergence of faster PHP runtimes like the HHVM, eval prevents some optimization that they perform.

Loading history...
389
390
        if ($query->num_rows() >= 1) {
391
            $data = [
392
                     'enabled'  => (int) $this->input->post('status'),
393
                //'identif' => $this->input->post('identif'),
394
                     'identif'  => $com['name'],
395
                     'autoload' => (int) $this->input->post('autoload'),
396
                     'in_menu'  => (int) $this->input->post('in_menu'),
397
                    ];
398
399
            $this->db->where('name', $component);
400
            $this->db->update('components', $data);
401
402
            $this->lib_admin->log(lang('Changed the module settings', 'admin') . ' ' . $com['name']);
403
        }
404
405
        jsCode("ajax_div('modules_table',base_url + 'admin/components/modules_table/');");
406
    }
407
408
    /**
409
     * @param string $module
410
     */
411
    private function checkPerm($module) {
412
        if ($this->isNotPermited($module)) {
413
            $msg = count($this->permited) ? lang('Error checking permissions') : lang('Please wait for a few minutes. Your configuration file is being created.');
414
            die($msg);
415
        }
416
    }
417
418
    /**
419
     * Load component admin class in iframe/xhr
420
     * @param string $module
421
     */
422
    public function init_window($module) {
423
        $this->checkPerm($module);
424
        $lang = new MY_Lang();
425
        $lang->load($module);
426
427
        // buildWindow($id,$title,$contentURL,$width,$height,$method = 'iframe')
428
        //$module = $this->input->post('component');
429
        $info_file = getModulePath($module) . 'module_info.php';
430
431
        if (file_exists($info_file)) {
432
            include_once $info_file;
433
434
            switch ($com_info['admin_type']) {
0 ignored issues
show
Bug introduced by
The variable $com_info does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
435
                case 'window':
436
                    //buildWindow($module . '_window', lang('Module','admin') . ': ' . $com_info['menu_name'], site_url('admin/components/cp/' . $module), $com_info['w'], $com_info['h'], $com_info['window_type']);
437
                    //pjax('/admin/components/cp/'.$module, '.row-fluid');
438
                    $this->cp($module);
439
                    break;
440
441
                case 'inside':
442
                    //pjax('/admin/components/cp/'.$module, '.row-fluid');
443
                    $this->cp($module);
444
                    //updateDiv('page', site_url('admin/components/cp/' . $module));
445
                    break;
446
            }
447
        }
448
    }
449
450
    /**
451
     * @param string $module
452
     */
453
    public function cp($module) {
454
        $this->checkPerm($module);
455
        $func = $this->uri->segment(5);
456
457
        if ($func == FALSE) {
458
            $func = 'index';
459
        }
460
461
        $this->load->module('core/core');
462
        $args = $this->core->grab_variables(6);
463
464
        $this->template->assign('SELF_URL', site_url('admin/components/cp/' . $module));
465
466
        //echo '<div id="' . $module . '_module_block">' . modules::run($module . '/admin/' . $func, $args) . '</div>';
467
        echo modules::run($module . '/admin/' . $func, $args);
468
469
        //ajax_links($module);
470
    }
471
472
    /**
473
     * @param string $module
474
     */
475
    public function run($module) {
476
        $this->checkPerm($module);
477
478
        $func = $this->uri->segment(5);
479
        if ($func == FALSE) {
480
            $func = 'index';
481
        }
482
483
        ($hook = get_hook('admin_run_module_admin')) ? eval($hook) : NULL;
0 ignored issues
show
Unused Code introduced by
The call to get_hook() has too many arguments starting with 'admin_run_module_admin'.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
Coding Style introduced by
It is generally not recommended to use eval unless absolutely required.

On one hand, eval might be exploited by malicious users if they somehow manage to inject dynamic content. On the other hand, with the emergence of faster PHP runtimes like the HHVM, eval prevents some optimization that they perform.

Loading history...
484
485
        $this->load->module('core/core');
486
        $args = $this->core->grab_variables(6);
487
488
        $this->template->assign('SELF_URL', site_url('admin/components/cp/' . $module));
489
490
        echo modules::run($module . '/admin/' . $func, $args);
491
    }
492
493
    public function com_info() {
494
        $com_info = $this->get_module_info($this->input->post('component'));
495
496
        if ($com_info != FALSE) {
497
            $info_text = '<h1>' . $com_info['menu_name'] . '</h1><p>' . $com_info['description'] . '</p><p><b>' . lang('Author', 'admin') . '</b> ' . $com_info['author'] . '<br/><b>' . lang('Version ', 'admin') . '</b> ' . $com_info['version'] . '</p>';
498
499
            jsCode("alertBox.info('" . $info_text . "');");
500
        } else {
501
            showMessage(lang("Can't load module info file", 'admin'), false . 'r');
502
        }
503
    }
504
505
    /**
506
     * @param $mod_name
0 ignored issues
show
introduced by
Missing parameter type
Loading history...
507
     * @return bool|string
508
     */
509
    public function get_module_info($mod_name) {
510
        $info_file = getModulePath($mod_name) . 'module_info.php';
511
        $lang = new MY_Lang();
512
        $lang->load($mod_name);
513
        if (file_exists($info_file)) {
514
            include $info_file;
515
            return $com_info;
0 ignored issues
show
Bug introduced by
The variable $com_info does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
516
        } else {
517
            return FALSE;
518
        }
519
    }
520
521
    public function change_autoload() {
522
        if ($this->input->post('mid')) {
523
            $mid = $this->input->post('mid');
524
            $row = $this->db->where('id', $mid)->get('components')->row();
525
            if (count($row) > 0) {
526
                $autoload = $row->autoload;
527
                if ($autoload) {
528
                    $autoload = 0;
529
                    $status = lang('Disable', 'admin');
530
                } else {
531
                    $autoload = 1;
532
                    $status = lang('Enable', 'admin');
533
                }
534
                $this->db->where('id', $mid)->set('autoload', $autoload)->update('components');
535
                $row->autoload = $autoload;
536
537
                $nameModule = $this->get_module_info($row->identif)['menu_name'];
538
539
                $message = lang('Change Autoload. Module : ', 'admin') . ' '
540
                    . $nameModule . '. ' . lang('Status', 'admin') . ' : ' . $status . '.';
541
                $this->lib_admin->log($message);
542
                echo json_encode(['result' => $row]);
543
            } else {
544
                $result = false;
545
                echo json_encode(['result' => $result]);
546
            }
547
        }
548
    }
549
550
    public function change_url_access() {
551
        if ($this->input->post('mid')) {
552
            $mid = $this->input->post('mid');
553
            $row = $this->db->where('id', $mid)->get('components')->row();
554
555 View Code Duplication
            if (count($row) > 0) {
556
                $enabled = $row->enabled;
557
                if ($enabled) {
558
                    $enabled = 0;
559
                    $status = lang('Disable', 'admin');
560
                } else {
561
                    $enabled = 1;
562
                    $status = lang('Enable', 'admin');
563
                }
564
565
                $this->db->where('id', $mid)->set('enabled', $enabled)->update('components');
566
567
                $row->enabled = $enabled;
568
                $nameModule = $this->get_module_info($row->identif)['menu_name'];
569
570
                $message = lang('Change URL access. Module : ', 'admin') . ' '
571
                    . $nameModule . '. ' . lang('Status', 'admin') . ' : ' . $status . '.';
572
                $this->lib_admin->log($message);
573
            }
574
        }
575
    }
576
577
    public function change_show_in_menu() {
578
        $id = $this->input->post('id');
579
        $row = $this->db->where('id', (int) $id)->get('components')->row();
580 View Code Duplication
        if (count($row) > 0) {
581
            $in_menu = $row->in_menu;
582
            if ($in_menu == 1) {
583
                $in_menu = 0;
584
                $status = lang('Disable', 'admin');
585
            } else {
586
                $in_menu = 1;
587
                $status = lang('Enable', 'admin');
588
            }
589
            $this->db->where('id', (int) $id)->set('in_menu', $in_menu)->update('components');
590
591
            $nameModule = $this->get_module_info($row->identif)['menu_name'];
592
593
            $message = lang('Change Show in menu. Module : ', 'admin') . ' '
594
                . $nameModule . '. ' . lang('Status', 'admin') . ' : ' . $status . '.';
595
            $this->lib_admin->log($message);
596
        }
597
    }
598
599
    public function save_components_positions() {
600
        $positions = $this->input->post('positions');
601
        if (is_array($positions)) {
602
            foreach ($positions as $key => $value) {
603
                if ($this->db->where('name', $value)->set('position', $key)->update('components')) {
604
                    $result = true;
605
                } else {
606
                    $result = false;
607
                }
608
            }
609
            if ($result) {
610
                showMessage(lang('Positions updated', 'admin'));
611
            } else {
612
                showMessage(lang('Fail', 'admin'));
613
            }
614
        }
615
    }
616
617
}
618
619
/* End of components.php */