Code Duplication    Length = 13-15 lines in 2 locations

include/blocksadmin.inc.php 2 locations

@@ 216-230 (lines=15) @@
213
        $bid = array();
214
    }
215
    // GIJ start
216
    foreach (array_keys($bid) as $i) {
217
        if ($side[$i] < 0) {
218
            $visible[$i] = 0;
219
            $side[$i]    = -1;
220
        } else {
221
            $visible[$i] = 1;
222
        }
223
224
        $bmodule = (isset($_POST['bmodule'][$i]) && is_array($_POST['bmodule'][$i])) ? $_POST['bmodule'][$i] : array(-1);
225
226
        myblocksadmin_update_block($i, $side[$i], $_POST['weight'][$i], $visible[$i], $_POST['title'][$i], null, null, $_POST['bcachetime'][$i], $bmodule, array());
227
228
        //    if ( $oldweight[$i] != $weight[$i] || $oldvisible[$i] != $visible[$i] || $oldside[$i] != $side[$i] )
229
        //    order_block($bid[$i], $weight[$i], $visible[$i], $side[$i]);
230
    }
231
    $query4redirect = '?dirname=' . urlencode(strip_tags(substr($_POST['query4redirect'], 9)));
232
    redirect_header("myblocksadmin.php$query4redirect", 1, _AM_DBUPDATED);
233
    // GIJ end
@@ 262-274 (lines=13) @@
259
            $id = array();
260
        }
261
262
        foreach (array_keys($id) as $i) {
263
            // separate side and visible
264
            if ($side[$i] < 0) {
265
                $visible[$i] = 0;
266
                $side[$i]    = -1; // for not to destroy the original position
267
            } else {
268
                $visible[$i] = 1;
269
            }
270
271
            $bmodule = (isset($_POST['bmodule'][$i]) && is_array($_POST['bmodule'][$i])) ? $_POST['bmodule'][$i] : array(-1);
272
273
            myblocksadmin_update_blockinstance($i, $side[$i], $_POST['weight'][$i], $visible[$i], $_POST['title'][$i], null, null, $_POST['bcachetime'][$i], $bmodule, array());
274
        }
275
    }
276
277
    $query4redirect = '?dirname=' . urlencode(strip_tags(substr($_POST['query4redirect'], 9)));