mambax7 /
pedigree
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
|
0 ignored issues
–
show
|
|||
| 2 | // ------------------------------------------------------------------------- |
||
| 3 | |||
| 4 | $currentFile = pathinfo(__FILE__, PATHINFO_BASENAME); |
||
| 5 | include __DIR__ . '/header.php'; |
||
| 6 | |||
| 7 | require_once dirname(dirname(__DIR__)) . '/mainfile.php'; |
||
| 8 | |||
| 9 | /* |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
43% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 10 | if (file_exists(XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->dirname() . "/language/" . $xoopsConfig['language'] . "/main.php")) { |
||
| 11 | require_once XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->dirname() . "/language/" . $xoopsConfig['language'] . "/main.php"; |
||
| 12 | } else { |
||
| 13 | include_once XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->dirname() . "/language/english/main.php"; |
||
| 14 | } |
||
| 15 | */ |
||
| 16 | |||
| 17 | xoops_loadLanguage('main', basename(dirname(__DIR__))); |
||
| 18 | |||
| 19 | // Include any common code for this module. |
||
| 20 | require_once(XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->dirname() . "/include/functions.php"); |
||
| 21 | require_once(XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->dirname() . "/include/class_field.php"); |
||
| 22 | |||
| 23 | $xoopsOption['template_main'] = "pedigree_index.tpl"; |
||
| 24 | |||
| 25 | include XOOPS_ROOT_PATH . '/header.php'; |
||
| 26 | |||
| 27 | $xoTheme->addScript(XOOPS_URL . '/browse.php?Frameworks/jquery/jquery.js'); |
||
| 28 | $xoTheme->addScript(PEDIGREE_URL . '/assets/js/jquery.ThickBox/thickbox-compressed.js'); |
||
| 29 | |||
| 30 | $xoTheme->addScript(PEDIGREE_URL . '/assets/js/jquery.magnific-popup.min.js'); |
||
| 31 | $xoTheme->addScript(PEDIGREE_URL . '/assets/js/colpick.js'); |
||
| 32 | |||
| 33 | $xoTheme->addStylesheet(PEDIGREE_URL . '/assets/js/colpick.css'); |
||
| 34 | $xoTheme->addStylesheet(PEDIGREE_URL . '/assets/js/magnific-popup.css'); |
||
| 35 | |||
| 36 | $xoTheme->addStylesheet(PEDIGREE_URL . '/assets/js/jquery.ThickBox/thickbox.css'); |
||
| 37 | $xoTheme->addStylesheet(PEDIGREE_URL . '/module.css'); |
||
| 38 | |||
| 39 | $xoopsTpl->assign('pedigree_url', PEDIGREE_URL . '/'); |
||
| 40 | |||
| 41 | // Breadcrumb |
||
| 42 | $breadcrumb = new PedigreeBreadcrumb(); |
||
| 43 | $breadcrumb->addLink($pedigree->getModule()->getVar('name'), PEDIGREE_URL); |
||
| 44 | |||
| 45 | $xoopsTpl->assign('module_home', pedigree_module_home(false)); // this definition is not removed for backward compatibility issues |
||
| 46 | $xoopsTpl->assign('pedigree_breadcrumb', $breadcrumb->render()); |
||
| 47 | |||
| 48 | //get module configuration |
||
| 49 | $module_handler =& xoops_gethandler('module'); |
||
| 50 | $module =& $module_handler->getByDirname("pedigree"); |
||
| 51 | $config_handler =& xoops_gethandler('config'); |
||
| 52 | $moduleConfig =& $config_handler->getConfigsByCat(0, $module->getVar('mid')); |
||
| 53 | |||
| 54 | index_main(); |
||
| 55 | |||
| 56 | //footer |
||
| 57 | include XOOPS_ROOT_PATH . "/footer.php"; |
||
| 58 | |||
| 59 | // Displays the "Main" tab of the module |
||
| 60 | function index_main() |
||
| 61 | { |
||
| 62 | global $xoopsTpl, $moduleConfig; |
||
| 63 | |||
| 64 | //create animal object |
||
| 65 | $animal = new Animal(); |
||
| 66 | |||
| 67 | //test to find out how many user fields there are.. |
||
| 68 | $fields = $animal->numoffields(); |
||
| 69 | |||
| 70 | for ($i = 0; $i < count($fields); ++$i) { |
||
| 71 | $userfield = new Field($fields[$i], $animal->getconfig()); |
||
| 72 | if ($userfield->active() && $userfield->hassearch()) { |
||
| 73 | $fieldType = $userfield->getSetting("FieldType"); |
||
| 74 | $fieldobject = new $fieldType($userfield, $animal); |
||
| 75 | $function = "user" . $fields[$i] . $fieldobject->getsearchstring(); |
||
| 76 | //echo $function."<br />"; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
67% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 77 | $usersearch[] = array( |
||
| 78 | 'title' => $userfield->getSetting("SearchName"), |
||
| 79 | 'searchid' => "user" . $fields[$i], |
||
| 80 | 'function' => $function, |
||
| 81 | 'explenation' => $userfield->getSetting("SearchExplenation"), |
||
| 82 | 'searchfield' => $fieldobject->searchfield() |
||
| 83 | ); |
||
| 84 | } |
||
| 85 | } |
||
| 86 | |||
| 87 | //add data to smarty template |
||
| 88 | $xoopsTpl->assign("sselect", strtr(_MA_PEDIGREE_SELECT, array('[animalType]' => $moduleConfig['animalType']))); |
||
| 89 | $xoopsTpl->assign("explain", _MA_PEDIGREE_EXPLAIN); |
||
| 90 | $xoopsTpl->assign("sname", _MA_PEDIGREE_SEARCHNAME); |
||
| 91 | $xoopsTpl->assign("snameex", strtr(_MA_PEDIGREE_SEARCHNAME_EX, array('[animalTypes]' => $moduleConfig['animalTypes']))); |
||
| 92 | $xoopsTpl->assign("usersearch", (isset($usersearch) ? $usersearch : '')); |
||
| 93 | } |
||
| 94 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.