Code Duplication    Length = 13-14 lines in 5 locations

main/glossary/index.php 2 locations

@@ 120-133 (lines=14) @@
117
            // setting the rules
118
            $form->addRule('glossary_title', get_lang('ThisFieldIsRequired'), 'required');
119
            // The validation or display
120
            if ($form->validate()) {
121
                $check = Security::check_token('post');
122
                if ($check) {
123
                    $values = $form->exportValues();
124
                    GlossaryManager::save_glossary($values);
125
                }
126
                Security::clear_token();
127
                GlossaryManager::display_glossary();
128
            } else {
129
                $token = Security::get_token();
130
                $form->addElement('hidden', 'sec_token');
131
                $form->setConstants(array('sec_token' => $token));
132
                $form->display();
133
            }
134
            break;
135
        case 'edit_glossary':
136
            if (is_numeric($_GET['glossary_id'])) {
@@ 177-190 (lines=14) @@
174
                $form->addRule('glossary_title', get_lang('ThisFieldIsRequired'), 'required');
175
176
                // The validation or display
177
                if ($form->validate()) {
178
                    $check = Security::check_token('post');
179
                    if ($check) {
180
                    $values = $form->exportValues();
181
                    GlossaryManager::update_glossary($values);
182
                    }
183
                    Security::clear_token();
184
                    GlossaryManager::display_glossary();
185
                } else {
186
                    $token = Security::get_token();
187
                    $form->addElement('hidden', 'sec_token');
188
                    $form->setConstants(array('sec_token' => $token));
189
                    $form->display();
190
                }
191
            }
192
            break;
193
        case 'delete_glossary':

main/forum/forumfunction.inc.php 3 locations

@@ 202-214 (lines=13) @@
199
    $form->addRule('forum_category_title', get_lang('ThisFieldIsRequired'), 'required');
200
201
    // The validation or display
202
    if ($form->validate()) {
203
        $check = Security::check_token('post');
204
        if ($check) {
205
            $values = $form->exportValues();
206
            store_forumcategory($values);
207
        }
208
        Security::clear_token();
209
    } else {
210
        $token = Security::get_token();
211
        $form->addElement('hidden', 'sec_token');
212
        $form->setConstants(array('sec_token' => $token));
213
        $form->display();
214
    }
215
}
216
217
/**
@@ 385-398 (lines=14) @@
382
    }
383
    $form->setDefaults($defaults);
384
    // Validation or display
385
    if ($form->validate()) {
386
        $check = Security::check_token('post');
387
        if ($check) {
388
            $values = $form->exportValues();
389
            $return_message = store_forum($values);
390
            Display :: display_confirmation_message($return_message);
391
        }
392
        Security::clear_token();
393
    } else {
394
        $token = Security::get_token();
395
        $form->addElement('hidden', 'sec_token');
396
        $form->setConstants(array('sec_token' => $token));
397
        $form->display();
398
    }
399
}
400
401
/**
@@ 470-482 (lines=13) @@
467
    $form->addRule('forum_category_title', get_lang('ThisFieldIsRequired'), 'required');
468
469
    // Validation or display
470
    if ($form->validate()) {
471
        $check = Security::check_token('post');
472
        if ($check) {
473
            $values = $form->exportValues();
474
            store_forumcategory($values);
475
        }
476
        Security::clear_token();
477
    } else {
478
        $token = Security::get_token();
479
        $form->addElement('hidden', 'sec_token');
480
        $form->setConstants(array('sec_token' => $token));
481
        $form->display();
482
    }
483
}
484
485
/**