Code Duplication    Length = 5-6 lines in 3 locations

src/dbo/templates.php 1 location

@@ 654-658 (lines=5) @@
651
        {
652
            $rs = dal_query('templates/count.sql');
653
654
            if (MAX_TEMPLATES_NUMBER != 0 && $rs->fetch(0) >= MAX_TEMPLATES_NUMBER)
655
            {
656
                debug_write_log(DEBUG_NOTICE, 'Maximum amount of templates is already reached.');
657
                return TRUE;
658
            }
659
660
            $template['name']         = ustrcut($template['name'],         MAX_TEMPLATE_NAME);
661
            $template['prefix']       = ustrcut($template['prefix'],       MAX_TEMPLATE_PREFIX);

src/projects/tclone.php 1 location

@@ 61-66 (lines=6) @@
58
59
$rs = dal_query('templates/count.sql');
60
61
if (MAX_TEMPLATES_NUMBER != 0 && $rs->fetch(0) >= MAX_TEMPLATES_NUMBER)
62
{
63
    debug_write_log(DEBUG_NOTICE, 'Maximum amount of templates is already reached.');
64
    header('HTTP/1.1 307 tview.php?id=' . $id);
65
    exit;
66
}
67
68
// cloned template has been submitted
69

src/projects/tcreate.php 1 location

@@ 49-54 (lines=6) @@
46
47
$templates = dal_query('templates/count.sql');
48
49
if (MAX_TEMPLATES_NUMBER != 0 && $templates->fetch(0) >= MAX_TEMPLATES_NUMBER)
50
{
51
    debug_write_log(DEBUG_NOTICE, 'Maximum amount of templates is already reached.');
52
    header('HTTP/1.1 307 index.php');
53
    exit;
54
}
55
56
// check that requested project exists
57