Code Duplication    Length = 16-20 lines in 2 locations

htdocs/modules/publisher/class/form/category.php 1 location

@@ 77-92 (lines=16) @@
74
        $module_id = $publisher->getModule()->mid();
75
        $allowed_editors = PublisherUtils::getEditors($gperm_handler->getItemIds('editors', $groups, $module_id));
76
        $nohtml = false;
77
        if (count($allowed_editors) > 0) {
78
            $editor = @$_POST['editor'];
79
            if (!empty($editor)) {
80
                PublisherUtils::setCookieVar('publisher_editor', $editor);
81
            } else {
82
                $editor = PublisherUtils::getCookieVar('publisher_editor');
83
                if (empty($editor) && $xoops->isUser()) {
84
                    $editor = $xoops->user->getVar('publisher_editor'); // Need set through user profile
85
                }
86
            }
87
            $editor = (empty($editor) || !in_array($editor, $allowed_editors)) ? $publisher->getConfig('submit_editor') : $editor;
88
            $form_editor = new Xoops\Form\SelectEditor($this, 'editor', $editor, $nohtml, $allowed_editors);
89
            $this->addElement($form_editor);
90
        } else {
91
            $editor = $publisher->getConfig('submit_editor');
92
        }
93
94
        $editor_configs = array();
95
        $editor_configs['rows'] = $publisher->getConfig('submit_editor_rows') == '' ? 35 : $publisher->getConfig('submit_editor_rows');

htdocs/modules/publisher/class/form/item.php 1 location

@@ 268-287 (lines=20) @@
265
        $nohtml = false;
266
        if (count($allowed_editors) == 1) {
267
            $editor = $allowed_editors[0];
268
        } else {
269
            if (count($allowed_editors) > 0) {
270
                $editor = @$_POST['editor'];
271
                if (!empty($editor)) {
272
                    PublisherUtils::setCookieVar('publisher_editor', $editor);
273
                } else {
274
                    $editor = PublisherUtils::getCookieVar('publisher_editor');
275
                    if (empty($editor) && $xoops->isUser()) {
276
                        $editor = $xoops->user->getVar('publisher_editor'); // Need set through user profile
277
                    }
278
                }
279
                $editor = (empty($editor) || !in_array($editor, $allowed_editors))
280
                    ? $publisher->getConfig('submit_editor') : $editor;
281
282
                $form_editor = new Xoops\Form\SelectEditor($this, 'editor', $editor, $nohtml, $allowed_editors);
283
                $mainTab->addElement($form_editor);
284
            } else {
285
                $editor = $publisher->getConfig('submit_editor');
286
            }
287
        }
288
289
        $editor_configs = array();
290
        $editor_configs["rows"] = !$publisher->getConfig('submit_editor_rows')