Code Duplication    Length = 24-24 lines in 2 locations

src/projects/pexport.php 1 location

@@ 39-62 (lines=24) @@
36
37
$id = ustr2int(try_request('id'));
38
39
if (get_user_level() == USER_LEVEL_ADMIN)
40
{
41
    $xml = project_export($id);
42
43
    if (is_null($xml))
44
    {
45
        debug_write_log(DEBUG_NOTICE, 'Project cannot be found.');
46
        header('Location: index.php');
47
    }
48
    else
49
    {
50
        header('Pragma: private');
51
        header('Cache-Control: private, must-revalidate');
52
        header('Content-type: text/xml');
53
        header('Content-Disposition: attachment; filename=project-' . str_pad($id, 3, '0', STR_PAD_LEFT) . '.xml');
54
55
        echo($xml);
56
    }
57
}
58
else
59
{
60
    debug_write_log(DEBUG_NOTICE, 'User must have admin rights to be allowed.');
61
    header('Location: view.php?id=' . $id);
62
}
63
64
?>
65

src/projects/texport.php 1 location

@@ 39-62 (lines=24) @@
36
37
$id = ustr2int(try_request('id'));
38
39
if (get_user_level() == USER_LEVEL_ADMIN)
40
{
41
    $xml = template_export($id);
42
43
    if (is_null($xml))
44
    {
45
        debug_write_log(DEBUG_NOTICE, 'Template cannot be found.');
46
        header('Location: index.php');
47
    }
48
    else
49
    {
50
        header('Pragma: private');
51
        header('Cache-Control: private, must-revalidate');
52
        header('Content-type: text/xml');
53
        header('Content-Disposition: attachment; filename=template-' . str_pad($id, 3, '0', STR_PAD_LEFT) . '.xml');
54
55
        echo($xml);
56
    }
57
}
58
else
59
{
60
    debug_write_log(DEBUG_NOTICE, 'User must have admin rights to be allowed.');
61
    header('Location: tview.php?id=' . $id);
62
}
63
64
?>
65