Code Duplication    Length = 12-13 lines in 3 locations

htdocs/modules/system/admin/modulesadmin/modulesadmin.php 3 locations

@@ 901-913 (lines=13) @@
898
                $tplfile->setVar('tpl_tplset', 'default');
899
                $tplfile->setVar('tpl_file', $tpl['file'], true);
900
                $tplfile->setVar('tpl_desc', $tpl['description'], true);
901
                if (!$tplfile_handler->insert($tplfile)) {
902
                    $msgs[] = '&nbsp;&nbsp;<span style="color:#ff0000;">' . sprintf(_AM_SYSTEM_MODULES_TEMPLATE_ADD_ERROR, '<strong>' . $tpl['file'] . '</strong>') . '</span>';
903
                } else {
904
                    $newid  = $tplfile->getVar('tpl_id');
905
                    $msgs[] = '&nbsp;&nbsp;' . sprintf(_AM_SYSTEM_MODULES_TEMPLATE_INSERT_DATA, '<strong>' . $tpl['file'] . '</strong>');
906
                    if ($xoopsConfig['template_set'] === 'default') {
907
                        if (!xoops_template_touch($newid)) {
908
                            $msgs[] = '&nbsp;&nbsp;<span style="color:#ff0000;">' . sprintf(_AM_SYSTEM_MODULES_TEMPLATE_RECOMPILE_ERROR, '<strong>' . $tpl['file'] . '</strong>') . '</span>';
909
                        } else {
910
                            $msgs[] = '&nbsp;&nbsp;<span>' . sprintf(_AM_SYSTEM_MODULES_TEMPLATE_RECOMPILE, '<strong>' . $tpl['file'] . '</strong>') . '</span>';
911
                        }
912
                    }
913
                }
914
                unset($tpldata);
915
                // irmtfan bug fix: remove codes for delete templates
916
                /*
@@ 976-987 (lines=12) @@
973
                                $tplfile_new->setVar('tpl_lastmodified', time());
974
                                $tplfile_new->setVar('tpl_lastimported', 0);
975
                                $tplfile_new->setVar('tpl_file', $block['template'], true); // irmtfan bug fix:  block template file will not updated after update the module
976
                                if (!$tplfile_handler->insert($tplfile_new)) {
977
                                    $msgs[] = '&nbsp;&nbsp;<span style="color:#ff0000;">' . sprintf(_AM_SYSTEM_MODULES_TEMPLATE_UPDATE_ERROR, '<strong>' . $block['template'] . '</strong>') . '</span>';
978
                                } else {
979
                                    $msgs[] = '&nbsp;&nbsp;' . sprintf(_AM_SYSTEM_MODULES_TEMPLATE_UPDATE, '<strong>' . $block['template'] . '</strong>');
980
                                    if ($xoopsConfig['template_set'] === 'default') {
981
                                        if (!xoops_template_touch($tplfile_new->getVar('tpl_id'))) {
982
                                            $msgs[] = '&nbsp;&nbsp;<span style="color:#ff0000;">' . sprintf(_AM_SYSTEM_MODULES_TEMPLATE_RECOMPILE_ERROR, '<strong>' . $block['template'] . '</strong>') . '</span>';
983
                                        } else {
984
                                            $msgs[] = '&nbsp;&nbsp;' . sprintf(_AM_SYSTEM_MODULES_TEMPLATE_RECOMPILE, '<strong>' . $block['template'] . '</strong>');
985
                                        }
986
                                    }
987
                                }
988
                            }
989
                        }
990
                    }
@@ 1034-1046 (lines=13) @@
1031
                                $tplfile->setVar('tpl_lastimported', time());
1032
                                $tplfile->setVar('tpl_lastmodified', time());
1033
                                $tplfile->setVar('tpl_desc', $block['description'], true);
1034
                                if (!$tplfile_handler->insert($tplfile)) {
1035
                                    $msgs[] = '&nbsp;&nbsp;<span style="color:#ff0000;">' . sprintf(_AM_SYSTEM_MODULES_TEMPLATE_ADD_ERROR, '<strong>' . $block['template'] . '</strong>') . '</span>';
1036
                                } else {
1037
                                    $newid  = $tplfile->getVar('tpl_id');
1038
                                    $msgs[] = '&nbsp;&nbsp;' . sprintf(_AM_SYSTEM_MODULES_TEMPLATE_ADD_DATA, '<strong>' . $block['template'] . '</strong>');
1039
                                    if ($xoopsConfig['template_set'] === 'default') {
1040
                                        if (!xoops_template_touch($newid)) {
1041
                                            $msgs[] = '&nbsp;&nbsp;<span style="color:#ff0000;">' . sprintf(_AM_SYSTEM_MODULES_TEMPLATE_RECOMPILE_FAILD, '<strong>' . $block['template'] . '</strong>') . '</span>';
1042
                                        } else {
1043
                                            $msgs[] = '&nbsp;&nbsp;' . sprintf(_AM_SYSTEM_MODULES_TEMPLATE_RECOMPILE, '<strong>' . $block['template'] . '</strong>');
1044
                                        }
1045
                                    }
1046
                                }
1047
                            }
1048
                            $msgs[] = '&nbsp;&nbsp;' . sprintf(_AM_SYSTEM_MODULES_BLOCK_CREATED, '<strong>' . $block['name'] . '</strong>') . sprintf(_AM_SYSTEM_MODULES_BLOCK_ID, '<strong>' . $newbid . '</strong>');
1049
                            $sql    = 'INSERT INTO ' . $xoopsDB->prefix('block_module_link') . ' (block_id, module_id) VALUES (' . $newbid . ', -1)';