1 | <?php |
||
2 | |||
3 | /** |
||
4 | * @package Ultimate Menu mod |
||
5 | * @version 1.0.4 |
||
6 | * @author John Rayes <[email protected]> |
||
7 | * @copyright Copyright (c) 2014, John Rayes |
||
8 | * @license http://opensource.org/licenses/MIT MIT |
||
9 | */ |
||
10 | |||
11 | // If SSI.php is in the same place as this file, and SMF isn't defined... |
||
12 | if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF')) |
||
13 | require_once(dirname(__FILE__) . '/SSI.php'); |
||
14 | |||
15 | // Hmm... no SSI.php and no SMF? |
||
16 | elseif (!defined('SMF')) |
||
17 | die('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.'); |
||
18 | |||
19 | $tables = array( |
||
20 | array( |
||
21 | 'name' => 'um_menu', |
||
22 | 'columns' => array( |
||
23 | array( |
||
24 | 'name' => 'id_button', |
||
25 | 'type' => 'smallint', |
||
26 | 'size' => 5, |
||
27 | 'unsigned' => true, |
||
28 | 'auto' => true, |
||
29 | ), |
||
30 | array( |
||
31 | 'name' => 'name', |
||
32 | 'type' => 'varchar', |
||
33 | 'size' => 65, |
||
34 | ), |
||
35 | array( |
||
36 | 'name' => 'slug', |
||
37 | 'type' => 'varchar', |
||
38 | 'size' => 80, |
||
39 | ), |
||
40 | array( |
||
41 | 'name' => 'type', |
||
42 | 'type' => 'enum(\'forum\',\'external\')', |
||
43 | 'default' => 'forum', |
||
44 | ), |
||
45 | array( |
||
46 | 'name' => 'target', |
||
47 | 'type' => 'enum(\'_self\',\'_blank\')', |
||
48 | 'default' => '_self', |
||
49 | ), |
||
50 | array( |
||
51 | 'name' => 'position', |
||
52 | 'type' => 'varchar', |
||
53 | 'size' => 65, |
||
54 | ), |
||
55 | array( |
||
56 | 'name' => 'link', |
||
57 | 'type' => 'varchar', |
||
58 | 'size' => 255, |
||
59 | ), |
||
60 | array( |
||
61 | 'name' => 'status', |
||
62 | 'type' => 'enum(\'active\',\'inactive\')', |
||
63 | 'default' => 'active', |
||
64 | ), |
||
65 | array( |
||
66 | 'name' => 'permissions', |
||
67 | 'type' => 'varchar', |
||
68 | 'size' => 255, |
||
69 | ), |
||
70 | array( |
||
71 | 'name' => 'parent', |
||
72 | 'type' => 'varchar', |
||
73 | 'size' => 65, |
||
74 | ), |
||
75 | ), |
||
76 | 'indexes' => array( |
||
77 | array( |
||
78 | 'type' => 'primary', |
||
79 | 'columns' => array('id_button') |
||
80 | ), |
||
81 | ) |
||
82 | ) |
||
83 | ); |
||
84 | |||
85 | db_extend('packages'); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
86 | |||
87 | foreach ($tables as $table) |
||
88 | { |
||
89 | $smcFunc['db_create_table']('{db_prefix}' . $table['name'], $table['columns'], $table['indexes'], array(), 'update'); |
||
90 | |||
91 | if (isset($table['default'])) |
||
92 | $smcFunc['db_insert']('ignore', '{db_prefix}' . $table['name'], $table['default']['columns'], $table['default']['values'], $table['default']['keys']); |
||
93 | } |
||
94 | |||
95 | // Now presenting... *drumroll* |
||
96 | add_integration_function('integrate_pre_include', '$sourcedir/Subs-UltimateMenu.php'); |
||
97 | add_integration_function('integrate_menu_buttons', 'um_load_menu'); |
||
98 | add_integration_function('integrate_admin_areas', 'um_admin_areas'); |
||
99 | |||
100 | ?> |
||
0 ignored issues
–
show
It is not recommended to use PHP's closing tag
?> in files other than templates.
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore. A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever. ![]() |
|||
101 |