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())) { |
|
|
|
|
23
|
|
|
exit(_NOPERM); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @return AdminerCustomization |
28
|
|
|
*/ |
29
|
|
|
function adminer_object() |
|
|
|
|
30
|
|
|
{ |
31
|
|
|
// required to run any plugin |
32
|
|
|
include_once dirname(__DIR__) . '/include/plugins/plugin.php'; |
33
|
|
|
// include_once dirname(__DIR__) . "/include/plugins/plugin.php"; |
|
|
|
|
34
|
|
|
include_once dirname(__DIR__) . '/include/plugins/frames.php'; |
35
|
|
|
|
36
|
|
|
// autoloader |
37
|
|
|
// foreach (glob("plugins/*.php") as $filename) { |
|
|
|
|
38
|
|
|
// include_once "./$filename"; |
39
|
|
|
// } |
40
|
|
|
|
41
|
|
|
$plugins = array( |
42
|
|
|
// specify enabled plugins here |
43
|
|
|
// new AdminerDumpXml, |
44
|
|
|
// new AdminerTinymce, |
45
|
|
|
// new AdminerFileUpload("data/"), |
|
|
|
|
46
|
|
|
// new AdminerSlugify, |
47
|
|
|
// new AdminerTranslation, |
48
|
|
|
// new AdminerForeignSystem, |
49
|
|
|
new AdminerFrames |
50
|
|
|
); |
51
|
|
|
|
52
|
|
|
// It is possible to combine customization and plugins: |
53
|
|
|
/** |
54
|
|
|
* Class AdminerCustomization |
55
|
|
|
*/ |
56
|
|
|
class AdminerCustomization extends AdminerPlugin |
|
|
|
|
57
|
|
|
{ |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
return new AdminerCustomization($plugins); |
61
|
|
|
|
62
|
|
|
// return new AdminerPlugin($plugins); |
|
|
|
|
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
// include original Adminer or Adminer Editor |
66
|
|
|
include_once dirname(__DIR__) . '/include/adminer.php'; |
67
|
|
|
|
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.