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 | You may not change or alter any portion of this comment or credits |
||
| 4 | of supporting developers from this source code or any supporting source code |
||
| 5 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 6 | |||
| 7 | This program is distributed in the hope that it will be useful, |
||
| 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 10 | */ |
||
| 11 | /** |
||
| 12 | * Pedigree module |
||
| 13 | * |
||
| 14 | * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ |
||
| 15 | * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
||
| 16 | * @package wfdownload |
||
| 17 | * @since 3.23 |
||
| 18 | * @author Xoops Development Team |
||
| 19 | * @version svn:$id$ |
||
| 20 | */ |
||
| 21 | defined("XOOPS_ROOT_PATH") || die("XOOPS root path not defined"); |
||
| 22 | |||
| 23 | // This must contain the name of the folder in which reside Pedigree |
||
| 24 | define("PEDIGREE_DIRNAME", basename(dirname(__DIR__))); |
||
| 25 | define("PEDIGREE_URL", XOOPS_URL . '/modules/' . PEDIGREE_DIRNAME); |
||
| 26 | define("PEDIGREE_IMAGES_URL", PEDIGREE_URL . '/images'); |
||
| 27 | define("PEDIGREE_ADMIN_URL", PEDIGREE_URL . '/admin'); |
||
| 28 | define("PEDIGREE_ROOT_PATH", XOOPS_ROOT_PATH . '/modules/' . PEDIGREE_DIRNAME); |
||
| 29 | |||
| 30 | xoops_loadLanguage('common', PEDIGREE_DIRNAME); |
||
| 31 | //if (!@include_once XOOPS_ROOT_PATH . "/language/" . $xoopsConfig['language'] . "/global.php") { |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
44% 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...
|
|||
| 32 | // include_once XOOPS_ROOT_PATH . "/language/english/global.php"; |
||
| 33 | //} |
||
| 34 | |||
| 35 | xoops_loadLanguage('global'); |
||
| 36 | |||
| 37 | include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
| 38 | include_once XOOPS_ROOT_PATH . '/class/tree.php'; |
||
| 39 | include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||
| 40 | |||
| 41 | include_once PEDIGREE_ROOT_PATH . '/include/functions.php'; |
||
| 42 | //include_once PEDIGREE_ROOT_PATH . '/include/constants.php'; |
||
| 43 | //include_once PEDIGREE_ROOT_PATH . '/class/session.php'; // PedigreeSession class |
||
| 44 | include_once PEDIGREE_ROOT_PATH . '/class/pedigree.php'; // PedigreePedigree class |
||
| 45 | //include_once PEDIGREE_ROOT_PATH . '/class/request.php'; // PedigreeRequest class |
||
| 46 | include_once PEDIGREE_ROOT_PATH . '/class/breadcrumb.php'; // PedigreeBreadcrumb class |
||
| 47 | include_once PEDIGREE_ROOT_PATH . '/class/tree.php'; // PedigreeObjectTree class |
||
| 48 | //include_once PEDIGREE_ROOT_PATH . '/class/xoopstree.php'; // PedigreeXoopsTree class |
||
| 49 | //include_once PEDIGREE_ROOT_PATH . '/class/formelementchoose.php'; // PedigreeFormElementChoose class |
||
| 50 | |||
| 51 | xoops_load('XoopsUserUtility'); |
||
| 52 | // MyTextSanitizer object |
||
| 53 | $myts = MyTextSanitizer::getInstance(); |
||
| 54 | |||
| 55 | $debug = false; |
||
| 56 | $pedigree = PedigreePedigree::getInstance($debug); |
||
| 57 | |||
| 58 | //This is needed or it will not work in blocks. |
||
| 59 | global $pedigree_isAdmin; |
||
| 60 | |||
| 61 | // Load only if module is installed |
||
| 62 | if (is_object($pedigree->getModule())) { |
||
| 63 | // Find if the user is admin of the module |
||
| 64 | $pedigree_isAdmin = pedigree_userIsAdmin(); |
||
| 65 | } |
||
| 66 | |||
| 67 | // Load Xoops handlers |
||
| 68 | $module_handler = xoops_gethandler('module'); |
||
| 69 | $member_handler = xoops_gethandler('member'); |
||
| 70 | $notification_handler = &xoops_gethandler('notification'); |
||
| 71 | $gperm_handler = xoops_gethandler('groupperm'); |
||
| 72 |
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.