Code Duplication    Length = 38-39 lines in 2 locations

htdocs/modules/system/class/module.php 2 locations

@@ 754-792 (lines=39) @@
751
                    $tplfile->setVar('tpl_tplset', 'default');
752
                    $tplfile->setVar('tpl_file', $tpl['file']);
753
                    $tplfile->setVar('tpl_desc', $tpl['description']);
754
                    if (!$tplfile_handler->insertTpl($tplfile)) {
755
                        $this->trace[]['sub'] = '<span class="red">' . sprintf(
756
                            SystemLocale::EF_TEMPLATE_NOT_ADDED_TO_DATABASE,
757
                            '<strong>' . $tpl['file'] . '</strong>'
758
                        ) . '</span>';
759
                    } else {
760
                        $newid = $tplfile->getVar('tpl_id');
761
                        $this->trace[]['sub'] = sprintf(
762
                            SystemLocale::SF_TEMPLATE_ADDED,
763
                            '<strong>' . $tpl['file'] . '</strong>'
764
                        );
765
                        if ($module->getVar('dirname') === 'system') {
766
                            if (!$xoops->templateTouch($newid)) {
767
                                $this->trace[]['sub'] = '<span class="red">' . sprintf(
768
                                    SystemLocale::EF_TEMPLATE_NOT_RECOMPILED,
769
                                    '<strong>' . $tpl['file'] . '</strong>'
770
                                ) . '</span>';
771
                            } else {
772
                                $this->trace[]['sub'] = sprintf(
773
                                    SystemLocale::SF_TEMPLATE_RECOMPILED,
774
                                    '<strong>' . $tpl['file'] . '</strong>'
775
                                );
776
                            }
777
                        } else {
778
                            if ($xoops->config['template_set'] === 'default') {
779
                                if (!$xoops->templateTouch($newid)) {
780
                                    $this->trace[]['sub'] = '<span class="red">' . sprintf(
781
                                        SystemLocale::EF_TEMPLATE_NOT_RECOMPILED,
782
                                        '<strong>' . $tpl['file'] . '</strong>'
783
                                    ) . '</span>';
784
                                } else {
785
                                    $this->trace[]['sub'] = sprintf(
786
                                        SystemLocale::SF_TEMPLATE_RECOMPILED,
787
                                        '<strong>' . $tpl['file'] . '</strong>'
788
                                    );
789
                                }
790
                            }
791
                        }
792
                    }
793
                    unset($tpldata);
794
                } else {
795
                    $this->trace[]['sub'] = '<span class="red">' . sprintf(
@@ 925-962 (lines=38) @@
922
                            $tplfile_new->setVar('tpl_desc', $block['description']);
923
                            $tplfile_new->setVar('tpl_lastmodified', time());
924
                            $tplfile_new->setVar('tpl_lastimported', 0);
925
                            if (!$tplfile_handler->insertTpl($tplfile_new)) {
926
                                $this->trace[]['sub'] = '<span class="red">' . sprintf(
927
                                    SystemLocale::EF_TEMPLATE_NOT_UPDATED,
928
                                    '<strong>' . $block['template'] . '</strong>'
929
                                ) . '</span>';
930
                            } else {
931
                                $this->trace[]['sub'] = sprintf(
932
                                    SystemLocale::SF_TEMPLATE_UPDATED,
933
                                    '<strong>' . $block['template'] . '</strong>'
934
                                );
935
                                if ($module->getVar('dirname') === 'system') {
936
                                    if (!$xoops->templateTouch($tplfile_new->getVar('tpl_id'))) {
937
                                        $this->trace[]['sub'] = '<span class="red">' . sprintf(
938
                                            SystemLocale::EF_TEMPLATE_NOT_RECOMPILED,
939
                                            '<strong>' . $block['template'] . '</strong>'
940
                                        ) . '</span>';
941
                                    } else {
942
                                        $this->trace[]['sub'] = sprintf(
943
                                            SystemLocale::SF_TEMPLATE_RECOMPILED,
944
                                            '<strong>' . $block['template'] . '</strong>'
945
                                        );
946
                                    }
947
                                } else {
948
                                    if ($xoops->config['template_set'] === 'default') {
949
                                        if (!$xoops->templateTouch($tplfile_new->getVar('tpl_id'))) {
950
                                            $this->trace[]['sub'] = '<span class="red">' . sprintf(
951
                                                SystemLocale::EF_TEMPLATE_NOT_RECOMPILED,
952
                                                '<strong>' . $block['template'] . '</strong>'
953
                                            ) . '</span>';
954
                                        } else {
955
                                            $this->trace[]['sub'] = sprintf(
956
                                                SystemLocale::SF_TEMPLATE_RECOMPILED,
957
                                                '<strong>' . $block['template'] . '</strong>'
958
                                            );
959
                                        }
960
                                    }
961
                                }
962
                            }
963
                        }
964
                    }
965
                }