Code Duplication    Length = 14-17 lines in 2 locations

htdocs/lib2/db.inc.php 1 location

@@ 287-300 (lines=14) @@
284
285
    // strip escapes of &
286
    $nextarg = strpos($filtered_sql, '\&');
287
    while ($nextarg !== false) {
288
        $escapesCount = 0;
289
        while ((($nextarg - $escapesCount - 1) > 0)
290
            && (substr($filtered_sql, $nextarg - $escapesCount - 1, 1) == '\\')) {
291
            $escapesCount++;
292
        }
293
        if (($escapesCount % 2) == 0) {
294
            // strip escapes of &
295
            $filtered_sql = substr($filtered_sql, 0, $nextarg) . '&' . substr($filtered_sql, $nextarg + 2);
296
            $nextarg--;
297
        }
298
299
        $nextarg = strpos($filtered_sql, '\&', $nextarg + 2);
300
    }
301
302
    //
303
    // ok ... filtered_sql is ready for usage

htdocs/lib/clicompatbase.inc.php 1 location

@@ 355-371 (lines=17) @@
352
353
    // \& durch & ersetzen
354
    $nextarg = mb_strpos($filtered_sql, '\&');
355
    while ($nextarg !== false) {
356
        $escapesCount = 0;
357
        while ((($nextarg - $escapesCount - 1) > 0) &&
358
            (mb_substr($filtered_sql, $nextarg - $escapesCount - 1, 1) == '\\')) {
359
            $escapesCount++;
360
        }
361
        if (($escapesCount % 2) == 0) {
362
            // \& ersetzen durch &
363
            $filtered_sql = mb_substr($filtered_sql, 0, $nextarg) . '&' . mb_substr($filtered_sql, $nextarg + 2);
364
            $nextarg--;
365
        }
366
367
        $nextarg = mb_strpos($filtered_sql, '\&', $nextarg + 2);
368
    }
369
370
    //
371
    // ok ... hier ist filtered_sql fertig
372
    //
373
374
    /* todo: