Completed
Push — master ( 2bafa4...eb74eb )
by Michael
01:58
created

blocksadmin.inc.php ➔ myblocksadmin_update_block()   F

Complexity

Conditions 17
Paths 560

Size

Total Lines 87
Code Lines 63

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 17
eloc 63
nc 560
nop 10
dl 0
loc 87
rs 2.6147
c 0
b 0
f 0

How to fix   Long Method    Complexity    Many Parameters   

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:

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 500 and the first side effect is on line 21.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/*
3
 * You may not change or alter any portion of this comment or credits
4
 * of supporting developers from this source code or any supporting source code
5
 * which is considered copyrighted (c) material of the original comment or credit authors.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 */
11
12
/**
13
 * @copyright    XOOPS Project https://xoops.org/
14
 * @license      GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
15
 * @package
16
 * @since
17
 * @author       XOOPS Development Team, Kazumi Ono (AKA onokazu)
18
 */
19
20 View Code Duplication
if (!is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid())) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
21
    exit('Access Denied');
22
}
23
require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
24
include XOOPS_ROOT_PATH . '/modules/system/admin/blocksadmin/blocksadmin.php';
25
26
$op = 'list';
27
28
if (!empty($_POST['op'])) {
29
    $op = $_POST['op'];
30
}
31
if (!empty($_POST['bid'])) {
32
    $bid = (int)$_POST['bid'];
33
}
34
35
if (isset($_GET['op'])) {
36
    if ('edit' === $_GET['op'] || 'delete' === $_GET['op'] || 'delete_ok' === $_GET['op']
37
        || 'clone' === $_GET['op'] /* || $_GET['op'] == 'previewpopup'*/) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
55% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
38
        $op  = $_GET['op'];
39
        $bid = isset($_GET['bid']) ? (int)$_GET['bid'] : 0;
40
    }
41
}
42
43
if (isset($_POST['previewblock'])) {
44
    //if ( !admin_refcheck("/modules/$admin_mydirname/admin/") ) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
62% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
45
    //  exit('Invalid Referer');
0 ignored issues
show
Unused Code Comprehensibility introduced by
84% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
46
    //}
47 View Code Duplication
    if (!$GLOBALS['xoopsSecurity']->check()) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
48
        redirect_header(XOOPS_URL . '/', 3, $GLOBALS['xoopsSecurity']->getErrors());
49
    }
50
51
    if (empty($bid)) {
52
        die('Invalid bid.');
53
    }
54
55
    if (!empty($_POST['bside'])) {
56
        $bside = (int)$_POST['bside'];
57
    } else {
58
        $bside = 0;
59
    }
60
    if (!empty($_POST['bweight'])) {
61
        $bweight = (int)$_POST['bweight'];
62
    } else {
63
        $bweight = 0;
64
    }
65
    if (!empty($_POST['bvisible'])) {
66
        $bvisible = (int)$_POST['bvisible'];
67
    } else {
68
        $bvisible = 0;
69
    }
70
    if (!empty($_POST['bmodule'])) {
71
        $bmodule = $_POST['bmodule'];
72
    } else {
73
        $bmodule = [];
74
    }
75
    if (!empty($_POST['btitle'])) {
76
        $btitle = $_POST['btitle'];
77
    } else {
78
        $btitle = '';
79
    }
80
    if (!empty($_POST['bcontent'])) {
81
        $bcontent = $_POST['bcontent'];
82
    } else {
83
        $bcontent = '';
84
    }
85
    if (!empty($_POST['bctype'])) {
86
        $bctype = $_POST['bctype'];
87
    } else {
88
        $bctype = '';
89
    }
90
    if (!empty($_POST['bcachetime'])) {
91
        $bcachetime = (int)$_POST['bcachetime'];
92
    } else {
93
        $bcachetime = 0;
94
    }
95
96
    xoops_cp_header();
97
    require_once XOOPS_ROOT_PATH . '/class/template.php';
98
    $xoopsTpl = new XoopsTpl();
99
    $xoopsTpl->xoops_setCaching(0);
100
    $block['bid'] = $bid;
101
102
    if ('clone_ok' === $op) {
103
        $block['form_title']    = _AM_CLONEBLOCK;
104
        $block['submit_button'] = _CLONE;
105
        $myblock                = new XoopsBlock();
106
        $myblock->setVar('block_type', 'C');
107
    } else {
108
        $op                     = 'update';
109
        $block['form_title']    = _AM_EDITBLOCK;
110
        $block['submit_button'] = _SUBMIT;
111
        $myblock                = new XoopsBlock($bid);
112
        $block['name']          = $myblock->getVar('name');
113
    }
114
115
    $wfmyts = MyTextSanitizer::getInstance();
116
    $myblock->setVar('title', $wfmyts->stripSlashesGPC($btitle));
117
    $myblock->setVar('content', $wfmyts->stripSlashesGPC($bcontent));
118
    //  $dummyhtml = '<html><head><meta http-equiv="content-type" content="text/html; charset='._CHARSET.'"><meta http-equiv="content-language" content="'._LANGCODE.'"><title>'.$xoopsConfig['sitename'].'</title><link rel="stylesheet" type="text/css" media="all" href="'.getcss($xoopsConfig['theme_set']).'"></head><body><table><tr><th>'.$myblock->getVar('title').'</th></tr><tr><td>'.$myblock->getContent('S', $bctype).'</td></tr></table></body></html>';
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
119
120
    /* $dummyfile = '_dummyfile_'.time().'.html';
0 ignored issues
show
Unused Code Comprehensibility introduced by
54% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
121
    $fp = fopen(XOOPS_CACHE_PATH.'/'.$dummyfile, 'w');
122
    fwrite($fp, $dummyhtml);
123
    fclose($fp);*/
124
    $block['edit_form'] = false;
125
    $block['template']  = '';
126
    $block['op']        = $op;
127
    $block['side']      = $bside;
128
    $block['weight']    = $bweight;
129
    $block['visible']   = $bvisible;
130
    $block['title']     = $myblock->getVar('title', 'E');
131
    $block['content']   = $myblock->getVar('content', 'E');
132
    $block['modules']   =& $bmodule;
133
    $block['ctype']     = isset($bctype) ? $bctype : $myblock->getVar('c_type');
134
    $block['is_custom'] = true;
135
    $block['cachetime'] = $bcachetime;
136
    echo '<a href="myblocksadmin.php">' . _AM_BADMIN . '</a>&nbsp;<span style="font-weight:bold;">&raquo;&raquo;</span>&nbsp;' . $block['form_title'] . '<br><br>';
137
    require_once __DIR__ . '/../admin/myblockform.php'; //GIJ
138
    //echo '<a href="admin.php?fct=blocksadmin">'. _AM_BADMIN .'</a>&nbsp;<span style="font-weight:bold;">&raquo;&raquo;</span>&nbsp;'.$block['form_title'].'<br><br>';
0 ignored issues
show
Unused Code Comprehensibility introduced by
53% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
139
    //include XOOPS_ROOT_PATH.'/modules/system/admin/blocksadmin/blockform.php';
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
140
    //    $form->addElement($xoopsGTicket->getTicketXoopsForm(__LINE__));//GIJ
0 ignored issues
show
Unused Code Comprehensibility introduced by
77% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
141
    $form->display();
142
143
    $original_level = error_reporting(E_ALL);
144
    echo "
145
    <table width='100%' class='outer' cellspacing='1'>
146
      <tr>
147
        <th>" . $myblock->getVar('title') . "</th>
148
      </tr>
149
      <tr>
150
        <td class='odd'>" . $myblock->getContent('S', $bctype) . "</td>
151
      </tr>
152
    </table>\n";
153
    error_reporting($original_level);
154
155
    xoops_cp_footer();
156
    /* echo '<script type="text/javascript">
0 ignored issues
show
Unused Code Comprehensibility introduced by
54% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
157
    preview_window = openWithSelfMain("'.XOOPS_URL.'/modules/system/admin.php?fct=blocksadmin&op=previewpopup&file='.$dummyfile.'", "popup", 250, 200);
158
    </script>';*/
159
160
    exit();
161
}
162
163
/* if ($op == 'previewpopup') {
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
164
  if ( !admin_refcheck("/modules/$admin_mydirname/admin/") ) {
165
    exit('Invalid Referer');
166
  }
167
  $file = str_replace('..', '', XOOPS_CACHE_PATH.'/'.trim($_GET['file']));
168
  if (file_exists($file)) {
169
    include $file;
170
    @unlink($file);
171
  }
172
  exit();
173
} */
174
175
/* if ($op == "list") {
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
176
  xoops_cp_header();
177
  list_blocks();
178
  xoops_cp_footer();
179
  exit();
180
} */
181
182
if ('order' === $op) {
183
    //if ( !admin_refcheck("/modules/$admin_mydirname/admin/") ) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
62% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
184
    //  exit('Invalid Referer');
0 ignored issues
show
Unused Code Comprehensibility introduced by
84% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
185
    //}
186 View Code Duplication
    if (!$GLOBALS['xoopsSecurity']->check()) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
187
        redirect_header(XOOPS_URL . '/', 3, $GLOBALS['xoopsSecurity']->getErrors());
188
    }
189
    if (!empty($_POST['side'])) {
190
        $side = $_POST['side'];
191
    }
192
    //  if ( !empty($_POST['weight']) ) { $weight = $_POST['weight']; }
0 ignored issues
show
Unused Code Comprehensibility introduced by
66% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
193
    if (!empty($_POST['visible'])) {
194
        $visible = $_POST['visible'];
195
    }
196
    //  if ( !empty($_POST['oldside']) ) { $oldside = $_POST['oldside']; }
0 ignored issues
show
Unused Code Comprehensibility introduced by
66% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
197
    //  if ( !empty($_POST['oldweight']) ) { $oldweight = $_POST['oldweight']; }
0 ignored issues
show
Unused Code Comprehensibility introduced by
66% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
198
    //  if ( !empty($_POST['oldvisible']) ) { $oldvisible = $_POST['oldvisible']; }
0 ignored issues
show
Unused Code Comprehensibility introduced by
66% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
199
    if (!empty($_POST['bid'])) {
200
        $bid = $_POST['bid'];
201
    } else {
202
        $bid = [];
203
    }
204
    // GIJ start
205
    foreach (array_keys($bid) as $i) {
206
        if ($side[$i] < 0) {
207
            $visible[$i] = 0;
208
            $side[$i]    = -1;
209
        } else {
210
            $visible[$i] = 1;
211
        }
212
213
        $bmodule = (isset($_POST['bmodule'][$i])
214
                    && is_array($_POST['bmodule'][$i])) ? $_POST['bmodule'][$i] : [-1];
215
216
        myblocksadmin_update_block($i, $side[$i], $_POST['weight'][$i], $visible[$i], $_POST['title'][$i], null, null, $_POST['bcachetime'][$i], $bmodule, []);
217
218
        //    if ( $oldweight[$i] != $weight[$i] || $oldvisible[$i] != $visible[$i] || $oldside[$i] != $side[$i] )
0 ignored issues
show
Unused Code Comprehensibility introduced by
66% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
219
        //    order_block($bid[$i], $weight[$i], $visible[$i], $side[$i]);
0 ignored issues
show
Unused Code Comprehensibility introduced by
82% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
220
    }
221
    $query4redirect = '?dirname=' . urlencode(strip_tags(substr($_POST['query4redirect'], 9)));
222
    redirect_header("myblocksadmin.php$query4redirect", 1, _AM_DBUPDATED);
223
    // GIJ end
224
}
225
226
/* if ($op == 'save') {
0 ignored issues
show
Unused Code Comprehensibility introduced by
63% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
227
  if ( !admin_refcheck("/modules/$admin_mydirname/admin/") ) {
228
    exit('Invalid Referer');
229
  }
230
  if ( ! $GLOBALS['xoopsSecurity']->check() ) {
231
    redirect_header(XOOPS_URL.'/',3,$GLOBALS['xoopsSecurity']->getErrors());
232
  }
233
  if ( !empty($_POST['bside']) ) { $bside = (int)($_POST['bside']); } else { $bside = 0; }
234
  if ( !empty($_POST['bweight']) ) { $bweight = (int)($_POST['bweight']); } else { $bweight = 0; }
235
  if ( !empty($_POST['bvisible']) ) { $bvisible = (int)($_POST['bvisible']); } else { $bvisible = 0; }
236
  if ( !empty($_POST['bmodule']) ) { $bmodule = $_POST['bmodule']; } else { $bmodule = array(); }
237
  if ( !empty($_POST['btitle']) ) { $btitle = $_POST['btitle']; } else { $btitle = ""; }
238
  if ( !empty($_POST['bcontent']) ) { $bcontent = $_POST['bcontent']; } else { $bcontent = ""; }
239
  if ( !empty($_POST['bctype']) ) { $bctype = $_POST['bctype']; } else { $bctype = ""; }
240
  if ( !empty($_POST['bcachetime']) ) { $bcachetime = (int)($_POST['bcachetime']); } else { $bcachetime = 0; }
241
  save_block($bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bmodule, $bcachetime);
242
  exit();
243
} */
244
245
if ('update' === $op) {
246
    //if ( !admin_refcheck("/modules/$admin_mydirname/admin/") ) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
62% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
247
    //  exit('Invalid Referer');
0 ignored issues
show
Unused Code Comprehensibility introduced by
84% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
248
    //}
249 View Code Duplication
    if (!$GLOBALS['xoopsSecurity']->check()) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
250
        redirect_header(XOOPS_URL . '/', 3, $GLOBALS['xoopsSecurity']->getErrors());
251
    }
252
    /*  if ( !empty($_POST['bside']) ) { $bside = (int)($_POST['bside']); } else { $bside = 0; }
0 ignored issues
show
Unused Code Comprehensibility introduced by
62% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
253
      if ( !empty($_POST['bweight']) ) { $bweight = (int)($_POST['bweight']); } else { $bweight = 0; }
254
      if ( !empty($_POST['bvisible']) ) { $bvisible = (int)($_POST['bvisible']); } else { $bvisible = 0; }
255
      if ( !empty($_POST['btitle']) ) { $btitle = $_POST['btitle']; } else { $btitle = ""; }
256
      if ( !empty($_POST['bcontent']) ) { $bcontent = $_POST['bcontent']; } else { $bcontent = ""; }
257
      if ( !empty($_POST['bctype']) ) { $bctype = $_POST['bctype']; } else { $bctype = ""; }
258
      if ( !empty($_POST['bcachetime']) ) { $bcachetime = (int)($_POST['bcachetime']); } else { $bcachetime = 0; }
259
      if ( !empty($_POST['bmodule']) ) { $bmodule = $_POST['bmodule']; } else { $bmodule = array(); }
260
      if ( !empty($_POST['options']) ) { $options = $_POST['options']; } else { $options = array(); }
261
      update_block($bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $bmodule, $options);*/
262
263
    $bcachetime = isset($_POST['bcachetime']) ? (int)$_POST['bcachetime'] : 0;
264
    $options    = isset($_POST['options']) ? $_POST['options'] : [];
265
    $bcontent   = isset($_POST['bcontent']) ? $_POST['bcontent'] : '';
266
    $bctype     = isset($_POST['bctype']) ? $_POST['bctype'] : '';
267
    $bmodule    = (isset($_POST['bmodule']) && is_array($_POST['bmodule'])) ? $_POST['bmodule'] : [-1]; // GIJ +
268
    $msg        = myblocksadmin_update_block($_POST['bid'], $_POST['bside'], $_POST['bweight'], $_POST['bvisible'], $_POST['btitle'], $bcontent, $bctype, $bcachetime, $bmodule, $options); // GIJ !
269
    redirect_header('myblocksadmin.php', 1, $msg);
270
}
271
272
if ('delete_ok' === $op) {
273
    //if ( !admin_refcheck("/modules/$admin_mydirname/admin/") ) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
62% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
274
    //  exit('Invalid Referer');
0 ignored issues
show
Unused Code Comprehensibility introduced by
84% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
275
    //}
276 View Code Duplication
    if (!$GLOBALS['xoopsSecurity']->check()) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
277
        redirect_header(XOOPS_URL . '/', 3, $GLOBALS['xoopsSecurity']->getErrors());
278
    }
279
    // delete_block_ok($bid); GIJ imported from blocksadmin.php
280
    $myblock = new XoopsBlock($bid);
281
    if ('D' !== $myblock->getVar('block_type') && 'C' !== $myblock->getVar('block_type')) {
282
        redirect_header('myblocksadmin.php', 4, 'Invalid block');
283
    }
284
    $myblock->delete();
285
    if (!defined('XOOPS_ORETEKI') && '' !== $myblock->getVar('template')) {
286
        $tplfileHandler = xoops_getHandler('tplfile');
287
        $btemplate      = $tplfileHandler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $bid);
288
        if (count($btemplate) > 0) {
289
            $tplman->delete($btemplate[0]);
290
        }
291
    }
292
    redirect_header('myblocksadmin.php', 1, _AM_DBUPDATED);
293
294
    // end of delete_block_ok() GIJ
295
}
296
297
if ('delete' === $op) {
298
    xoops_cp_header();
299
    // delete_block($bid); GIJ imported from blocksadmin.php
300
    $myblock = new XoopsBlock($bid);
301
    if ('S' === $myblock->getVar('block_type')) {
302
        $message = _AM_SYSTEMCANT;
303
        redirect_header('admin.php?fct=blocksadmin', 4, $message);
304
    } elseif ('M' === $myblock->getVar('block_type')) {
305
        $message = _AM_MODULECANT;
306
        redirect_header('admin.php?fct=blocksadmin', 4, $message);
307
    } else {
308
        xoops_confirm(['fct' => 'blocksadmin', 'op' => 'delete_ok', 'bid' => $myblock->getVar('bid')], 'admin.php', sprintf(_AM_RUSUREDEL, $myblock->getVar('title')));
309
    }
310
    // end of delete_block() GIJ
311
    xoops_cp_footer();
312
    exit();
313
}
314
315 View Code Duplication
if ('edit' === $op) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
316
    xoops_cp_header();
317
    // edit_block($bid); GIJ imported from blocksadmin.php
318
    $myblock = new XoopsBlock($bid);
319
320
    $db      = XoopsDatabaseFactory:: getDatabaseConnection();
321
    $sql     = 'SELECT module_id FROM ' . $db->prefix('block_module_link') . ' WHERE block_id=' . (int)$bid;
322
    $result  = $db->query($sql);
323
    $modules = [];
324
    while ($row = $db->fetchArray($result)) {
325
        $modules[] = (int)$row['module_id'];
326
    }
327
    $is_custom = ('C' === $myblock->getVar('block_type') || 'E' === $myblock->getVar('block_type'));
328
    $block     = [
329
        'form_title'    => _AM_EDITBLOCK,
330
        'name'          => $myblock->getVar('name'),
331
        'side'          => $myblock->getVar('side'),
332
        'weight'        => $myblock->getVar('weight'),
333
        'visible'       => $myblock->getVar('visible'),
334
        'title'         => $myblock->getVar('title', 'E'),
335
        'content'       => $myblock->getVar('content', 'E'),
336
        'modules'       => $modules,
337
        'is_custom'     => $is_custom,
338
        'ctype'         => $myblock->getVar('c_type'),
339
        'cachetime'     => $myblock->getVar('bcachetime'),
340
        'op'            => 'update',
341
        'bid'           => $myblock->getVar('bid'),
342
        'edit_form'     => $myblock->getOptions(),
343
        'template'      => $myblock->getVar('template'),
344
        'options'       => $myblock->getVar('options'),
345
        'submit_button' => _SUBMIT
346
    ];
347
348
    echo '<a href="myblocksadmin.php">' . _AM_BADMIN . '</a>&nbsp;<span style="font-weight:bold;">&raquo;&raquo;</span>&nbsp;' . _AM_EDITBLOCK . '<br><br>';
349
    require_once __DIR__ . '/../admin/myblockform.php'; //GIJ
350
    //    $form->addElement($xoopsGTicket->getTicketXoopsForm(__LINE__));//GIJ
0 ignored issues
show
Unused Code Comprehensibility introduced by
77% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
351
    $form->display();
352
    // end of edit_block() GIJ
353
    xoops_cp_footer();
354
    exit();
355
}
356
357 View Code Duplication
if ('clone' === $op) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
358
    xoops_cp_header();
359
    $myblock = new XoopsBlock($bid);
360
361
    $db      = XoopsDatabaseFactory:: getDatabaseConnection();
362
    $sql     = 'SELECT module_id FROM ' . $db->prefix('block_module_link') . ' WHERE block_id=' . (int)$bid;
363
    $result  = $db->query($sql);
364
    $modules = [];
365
    while ($row = $db->fetchArray($result)) {
366
        $modules[] = (int)$row['module_id'];
367
    }
368
    $is_custom = ('C' === $myblock->getVar('block_type') || 'E' === $myblock->getVar('block_type'));
369
    $block     = [
370
        'form_title'    => _AM_CLONEBLOCK,
371
        'name'          => $myblock->getVar('name'),
372
        'side'          => $myblock->getVar('side'),
373
        'weight'        => $myblock->getVar('weight'),
374
        'visible'       => $myblock->getVar('visible'),
375
        'content'       => $myblock->getVar('content', 'N'),
376
        'title'         => $myblock->getVar('title', 'E'),
377
        'modules'       => $modules,
378
        'is_custom'     => $is_custom,
379
        'ctype'         => $myblock->getVar('c_type'),
380
        'cachetime'     => $myblock->getVar('bcachetime'),
381
        'op'            => 'clone_ok',
382
        'bid'           => $myblock->getVar('bid'),
383
        'edit_form'     => $myblock->getOptions(),
384
        'template'      => $myblock->getVar('template'),
385
        'options'       => $myblock->getVar('options'),
386
        'submit_button' => _CLONE
387
    ];
388
    echo '<a href="myblocksadmin.php">' . _AM_BADMIN . '</a>&nbsp;<span style="font-weight:bold;">&raquo;&raquo;</span>&nbsp;' . _AM_CLONEBLOCK . '<br><br>';
389
    require_once __DIR__ . '/../admin/myblockform.php';
390
    //    $form->addElement($xoopsGTicket->getTicketXoopsForm(__LINE__));//GIJ
0 ignored issues
show
Unused Code Comprehensibility introduced by
77% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
391
    $form->display();
392
    xoops_cp_footer();
393
    exit();
394
}
395
396
if ('clone_ok' === $op) {
397
    // Ticket Check
398 View Code Duplication
    if (!$GLOBALS['xoopsSecurity']->check()) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
399
        redirect_header(XOOPS_URL . '/', 3, $GLOBALS['xoopsSecurity']->getErrors());
400
    }
401
402
    $block = new XoopsBlock($bid);
403
404
    // block type check
405
    $block_type = $block->getVar('block_type');
406
    if ('C' !== $block_type && 'M' !== $block_type && 'D' !== $block_type) {
407
        redirect_header('myblocksadmin.php', 4, 'Invalid block');
408
    }
409
410
    if (empty($_POST['options'])) {
411
        $options = [];
412
    } else {
413
        if (is_array($_POST['options'])) {
414
            $options = $_POST['options'];
415
        } else {
416
            $options = explode('|', $_POST['options']);
417
        }
418
    }
419
420
    // for backward compatibility
421
    // $cblock = $block->clone(); or $cblock = $block->xoopsClone();
0 ignored issues
show
Unused Code Comprehensibility introduced by
55% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
422
    $cblock = new XoopsBlock();
423
    foreach ($block->vars as $k => $v) {
424
        $cblock->assignVar($k, $v['value']);
425
    }
426
    $cblock->setNew();
427
428
    $cblock->setVar('side', $_POST['bside']);
429
    $cblock->setVar('weight', $_POST['bweight']);
430
    $cblock->setVar('visible', $_POST['bvisible']);
431
    $cblock->setVar('title', $_POST['btitle']);
432
    //$cblock->setVar('content', $bcontent);
0 ignored issues
show
Unused Code Comprehensibility introduced by
80% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
433
    //$cblock->setVar('title', $btitle);
0 ignored issues
show
Unused Code Comprehensibility introduced by
80% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
434
    $cblock->setVar('bcachetime', $_POST['bcachetime']);
435
    if (isset($options) && (count($options) > 0)) {
436
        $options = implode('|', $options);
437
        $cblock->setVar('options', $options);
438
    }
439
    $cblock->setVar('bid', 0);
440
    $cblock->setVar('block_type', 'C' === $block_type ? 'C' : 'D');
441
    $cblock->setVar('func_num', 255);
442
    $newid = $cblock->store();
443
    if (!$newid) {
444
        xoops_cp_header();
445
        $cblock->getHtmlErrors();
446
        xoops_cp_footer();
447
        exit();
448
    }
449
    /*  if ($cblock->getVar('template') != '') {
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
450
            $tplfileHandler = xoops_getHandler('tplfile');
451
            $btemplate = $tplfileHandler->find($GLOBALS['xoopsConfig']['template_set'], 'block', $bid);
452
            if (count($btemplate) > 0) {
453
                $tplclone = $btemplate[0]->clone();
454
                $tplclone->setVar('tpl_id', 0);
455
                $tplclone->setVar('tpl_refid', $newid);
456
                $tplman->insert($tplclone);
457
            }
458
        } */
459
    $db      = XoopsDatabaseFactory:: getDatabaseConnection();
460
    $bmodule = (isset($_POST['bmodule']) && is_array($_POST['bmodule'])) ? $_POST['bmodule'] : [-1]; // GIJ +
461
    foreach ($bmodule as $bmid) {
462
        $sql = 'INSERT INTO ' . $db->prefix('block_module_link') . ' (block_id, module_id) VALUES (' . $newid . ', ' . $bmid . ')';
463
        $db->query($sql);
464
    }
465
466
    /*  global $xoopsUser;
0 ignored issues
show
Unused Code Comprehensibility introduced by
57% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
467
        $groups = $xoopsUser->getGroups();
468
        $count = count($groups);
469
        for ($i = 0; $i < $count; ++$i) {
470
            $sql = "INSERT INTO ".$db->prefix('group_permission')." (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES (".$groups[$i].", ".$newid.", 1, 'block_read')";
471
            $db->query($sql);
472
        }
473
    */
474
475
    $sql    = 'SELECT gperm_groupid FROM ' . $db->prefix('group_permission') . " WHERE gperm_name='block_read' AND gperm_modid='1' AND gperm_itemid='$bid'";
476
    $result = $db->query($sql);
477
    while (list($gid) = $db->fetchRow($result)) {
478
        $sql = 'INSERT INTO ' . $db->prefix('group_permission') . " (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES ($gid, $newid, 1, 'block_read')";
479
        $db->query($sql);
480
    }
481
482
    redirect_header('myblocksadmin.php', 1, _AM_DBUPDATED);
483
}
484
485
// import from modules/system/admin/blocksadmin/blocksadmin.php
486
/**
487
 * @param       $bid
488
 * @param       $bside
489
 * @param       $bweight
490
 * @param       $bvisible
491
 * @param       $btitle
492
 * @param       $bcontent
493
 * @param       $bctype
494
 * @param       $bcachetime
495
 * @param       $bmodule
496
 * @param array $options
497
 *
498
 * @return string
499
 */
500
function myblocksadmin_update_block(
501
    $bid,
502
    $bside,
503
    $bweight,
504
    $bvisible,
505
    $btitle,
506
    $bcontent,
507
    $bctype,
508
    $bcachetime,
509
    $bmodule,
510
    $options = [])
511
{
512
    global $xoopsConfig;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
513
    /* if (empty($bmodule)) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
63% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
514
        xoops_cp_header();
515
        xoops_error(sprintf(_AM_NOTSELNG, _AM_VISIBLEIN));
516
        xoops_cp_footer();
517
        exit();
518
    } */
519
    $myblock = new XoopsBlock($bid);
520
    // $myblock->setVar('side', $bside); GIJ -
0 ignored issues
show
Unused Code Comprehensibility introduced by
54% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
521
    if ($bside >= 0) {
522
        $myblock->setVar('side', $bside);
523
    } // GIJ +
524
    $myblock->setVar('weight', $bweight);
525
    $myblock->setVar('visible', $bvisible);
526
    $myblock->setVar('title', $btitle);
527
    if (isset($bcontent)) {
528
        $myblock->setVar('content', $bcontent);
529
    }
530
    if (isset($bctype)) {
531
        $myblock->setVar('c_type', $bctype);
532
    }
533
    $myblock->setVar('bcachetime', $bcachetime);
534
    if (isset($options) && (count($options) > 0)) {
535
        $options = implode('|', $options);
536
        $myblock->setVar('options', $options);
537
    }
538
    if ('C' === $myblock->getVar('block_type')) {
539
        switch ($myblock->getVar('c_type')) {
540
            case 'H':
541
                $name = _AM_CUSTOMHTML;
542
                break;
543
            case 'P':
544
                $name = _AM_CUSTOMPHP;
545
                break;
546
            case 'S':
547
                $name = _AM_CUSTOMSMILE;
548
                break;
549
            default:
550
                $name = _AM_CUSTOMNOSMILE;
551
                break;
552
        }
553
        $myblock->setVar('name', $name);
554
    }
555
    $msg = _AM_DBUPDATED;
556
    if (false !== $myblock->store()) {
557
        $db  = XoopsDatabaseFactory:: getDatabaseConnection();
558
        $sql = sprintf('DELETE FROM %s WHERE block_id = %u', $db->prefix('block_module_link'), $bid);
559
        $db->query($sql);
560
        foreach ($bmodule as $bmid) {
561
            $sql = sprintf('INSERT INTO %s (block_id, module_id) VALUES (%u, %d)', $db->prefix('block_module_link'), $bid, (int)$bmid);
562
            $db->query($sql);
563
        }
564
        require_once XOOPS_ROOT_PATH . '/class/template.php';
565
        $xoopsTpl = new XoopsTpl();
566
        $xoopsTpl->xoops_setCaching(2);
567
        if ('' !== $myblock->getVar('template')) {
568
            if ($xoopsTpl->is_cached('db:' . $myblock->getVar('template'))) {
569
                if (!$xoopsTpl->clear_cache('db:' . $myblock->getVar('template'))) {
570
                    $msg = 'Unable to clear cache for block ID' . $bid;
571
                }
572
            }
573
        } else {
574
            if ($xoopsTpl->is_cached('db:system_dummy.tpl', 'block' . $bid)) {
575
                if (!$xoopsTpl->clear_cache('db:system_dummy.tpl', 'block' . $bid)) {
576
                    $msg = 'Unable to clear cache for block ID' . $bid;
577
                }
578
            }
579
        }
580
    } else {
581
        $msg = 'Failed update of block. ID:' . $bid;
582
    }
583
    // redirect_header('admin.php?fct=blocksadmin&amp;t='.time(),1,$msg);
0 ignored issues
show
Unused Code Comprehensibility introduced by
72% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
584
    // exit(); GIJ -
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
585
    return $msg; // GIJ +
586
}
587