XoopsModules25x /
adminer
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Adminer Module based on Ghost Module |
||
| 4 | * |
||
| 5 | * You may not change or alter any portion of this comment or credits |
||
| 6 | * of supporting developers from this source code or any supporting source code |
||
| 7 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 8 | * This program is distributed in the hope that it will be useful, |
||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 11 | * |
||
| 12 | * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ |
||
| 13 | * @license http://www.fsf.org/copyleft/gpl.html GNU public license |
||
| 14 | * @package Adminer Module |
||
| 15 | * @since 2.3.0 |
||
| 16 | * @author Kris <http://www.xoofoo.org> |
||
| 17 | * @version $Id $ |
||
| 18 | **/ |
||
| 19 | // connect xoops database |
||
| 20 | include_once __DIR__ . '/admin_header.php'; |
||
| 21 | |||
| 22 | View Code Duplication | if (!is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid())) { |
|
|
0 ignored issues
–
show
|
|||
| 23 | exit(_NOPERM); |
||
| 24 | } |
||
| 25 | |||
| 26 | function adminer_object() |
||
| 27 | { |
||
| 28 | // required to run any plugin |
||
| 29 | include_once dirname(__DIR__) . '/include/plugins/plugin.php'; |
||
| 30 | // include_once dirname(__DIR__) . "/include/plugins/plugin.php"; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
50% 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...
|
|||
| 31 | include_once dirname(__DIR__) . '/include/plugins/frames.php'; |
||
| 32 | |||
| 33 | // autoloader |
||
| 34 | // foreach (glob("plugins/*.php") as $filename) { |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
60% 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...
|
|||
| 35 | // include_once "./$filename"; |
||
| 36 | // } |
||
| 37 | |||
| 38 | $plugins = array( |
||
| 39 | // specify enabled plugins here |
||
| 40 | // new AdminerDumpXml, |
||
| 41 | // new AdminerTinymce, |
||
| 42 | // new AdminerFileUpload("data/"), |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
63% 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...
|
|||
| 43 | // new AdminerSlugify, |
||
| 44 | // new AdminerTranslation, |
||
| 45 | // new AdminerForeignSystem, |
||
| 46 | new AdminerFrames, |
||
| 47 | ); |
||
| 48 | |||
| 49 | // It is possible to combine customization and plugins: |
||
| 50 | class AdminerCustomization extends AdminerPlugin |
||
| 51 | { |
||
| 52 | public function name() |
||
| 53 | { |
||
| 54 | return 'XOOPS Admin'; |
||
| 55 | } |
||
| 56 | |||
| 57 | public function credentials() |
||
| 58 | { |
||
| 59 | return array(XOOPS_DB_HOST, XOOPS_DB_USER, XOOPS_DB_PASS); |
||
| 60 | } |
||
| 61 | |||
| 62 | public function database() |
||
| 63 | { |
||
| 64 | return XOOPS_DB_NAME; |
||
| 65 | } |
||
| 66 | |||
| 67 | public function login($login, $password) |
||
| 68 | { |
||
| 69 | return ($login == XOOPS_DB_USER); |
||
| 70 | } |
||
| 71 | } |
||
| 72 | |||
| 73 | return new AdminerCustomization($plugins); |
||
| 74 | } |
||
| 75 | |||
| 76 | // include original Adminer or Adminer Editor |
||
| 77 | include_once dirname(__DIR__) . '/include/editor.php'; |
||
| 78 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.