Code Duplication    Length = 25-26 lines in 3 locations

src/projects/tclone.php 1 location

@@ 116-141 (lines=26) @@
113
        }
114
    }
115
116
    switch ($error)
117
    {
118
        case NO_ERROR:
119
            header('HTTP/1.0 200 OK');
120
            echo($id);
121
            break;
122
123
        case ERROR_INCOMPLETE_FORM:
124
            send_http_error(get_html_resource(RES_ALERT_REQUIRED_ARE_EMPTY_ID));
125
            break;
126
127
        case ERROR_ALREADY_EXISTS:
128
            send_http_error(get_html_resource(RES_ALERT_TEMPLATE_ALREADY_EXISTS_ID));
129
            break;
130
131
        case ERROR_INVALID_INTEGER_VALUE:
132
            send_http_error(get_html_resource(RES_ALERT_INVALID_INTEGER_VALUE_ID));
133
            break;
134
135
        case ERROR_INTEGER_VALUE_OUT_OF_RANGE:
136
            send_http_error(ustrprocess(get_html_resource(RES_ALERT_INTEGER_VALUE_OUT_OF_RANGE_ID), MIN_TEMPLATE_DAYS_COUNT, MAX_TEMPLATE_DAYS_COUNT));
137
            break;
138
139
        default:
140
            send_http_error(get_html_resource(RES_ALERT_UNKNOWN_ERROR_ID));
141
    }
142
143
    exit;
144
}

src/projects/tcreate.php 1 location

@@ 88-112 (lines=25) @@
85
        $error = template_create($id, $template_name, $template_prefix, $critical_age, $frozen_time, $description, $guest_access);
86
    }
87
88
    switch ($error)
89
    {
90
        case NO_ERROR:
91
            header('HTTP/1.0 200 OK');
92
            break;
93
94
        case ERROR_INCOMPLETE_FORM:
95
            send_http_error(get_html_resource(RES_ALERT_REQUIRED_ARE_EMPTY_ID));
96
            break;
97
98
        case ERROR_ALREADY_EXISTS:
99
            send_http_error(get_html_resource(RES_ALERT_TEMPLATE_ALREADY_EXISTS_ID));
100
            break;
101
102
        case ERROR_INVALID_INTEGER_VALUE:
103
            send_http_error(get_html_resource(RES_ALERT_INVALID_INTEGER_VALUE_ID));
104
            break;
105
106
        case ERROR_INTEGER_VALUE_OUT_OF_RANGE:
107
            send_http_error(ustrprocess(get_html_resource(RES_ALERT_INTEGER_VALUE_OUT_OF_RANGE_ID), MIN_TEMPLATE_DAYS_COUNT, MAX_TEMPLATE_DAYS_COUNT));
108
            break;
109
110
        default:
111
            send_http_error(get_html_resource(RES_ALERT_UNKNOWN_ERROR_ID));
112
    }
113
114
    exit;
115
}

src/projects/tmodify.php 1 location

@@ 77-101 (lines=25) @@
74
        $error = template_modify($id, $template['project_id'], $template_name, $template_prefix, $critical_age, $frozen_time, $description, $guest_access);
75
    }
76
77
    switch ($error)
78
    {
79
        case NO_ERROR:
80
            header('HTTP/1.0 200 OK');
81
            break;
82
83
        case ERROR_INCOMPLETE_FORM:
84
            send_http_error(get_html_resource(RES_ALERT_REQUIRED_ARE_EMPTY_ID));
85
            break;
86
87
        case ERROR_ALREADY_EXISTS:
88
            send_http_error(get_html_resource(RES_ALERT_TEMPLATE_ALREADY_EXISTS_ID));
89
            break;
90
91
        case ERROR_INVALID_INTEGER_VALUE:
92
            send_http_error(get_html_resource(RES_ALERT_INVALID_INTEGER_VALUE_ID));
93
            break;
94
95
        case ERROR_INTEGER_VALUE_OUT_OF_RANGE:
96
            send_http_error(ustrprocess(get_html_resource(RES_ALERT_INTEGER_VALUE_OUT_OF_RANGE_ID), MIN_TEMPLATE_DAYS_COUNT, MAX_TEMPLATE_DAYS_COUNT));
97
            break;
98
99
        default:
100
            send_http_error(get_html_resource(RES_ALERT_UNKNOWN_ERROR_ID));
101
    }
102
103
    exit;
104
}