forked from zivtech/bear
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bear.install
262 lines (248 loc) · 7.31 KB
/
bear.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<?php
/**
* Implement hook_install().
*
* Perform actions to set up the site for this profile.
*/
function bear_install() {
// See standard_install().
// This contains less setup than standard install, but similar.
// Add text formats.
$filtered_html_format = array(
'format' => 'filtered_html',
'name' => 'Filtered HTML',
'weight' => -10,
'filters' => array(
// URL filter.
'filter_url' => array(
'weight' => 0,
'status' => 1,
),
// HTML filter.
'filter_html' => array(
'weight' => 1,
'status' => 1,
'settings' => array(
'allowed_html' => '<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <br> <table> <tr> <td> <thead> <tbody> <th> <u> <s> <h2> <h3> <h4> <h5>',
'filter_html_help' => 1,
'filter_html_nofollow' => 0,
),
),
// Media Filter.
'assets_filter' => array(
'weight' => 2,
'status' => 1,
'settings' => array(),
),
'kill_nbsp' => array(
'status' => 1,
'weight' => 1,
'settings' => array(),
),
// HTML corrector filter.
'filter_htmlcorrector' => array(
'weight' => 10,
'status' => 1,
),
),
);
$filtered_html_format = (object) $filtered_html_format;
filter_format_save($filtered_html_format);
$full_html_format = array(
'format' => 'full_html',
'name' => 'Full HTML',
'weight' => -9,
'filters' => array(
// URL filter.
'filter_url' => array(
'weight' => 0,
'status' => 1,
),
// Line break filter.
'filter_autop' => array(
'weight' => 1,
'status' => 1,
),
// Assets Filter.
'assets_filter' => array(
'weight' => 2,
'status' => 1,
'settings' => array(),
),
'kill_nbsp' => array(
'status' => 1,
'weight' => 1,
'settings' => array(),
),
// HTML corrector filter.
'filter_htmlcorrector' => array(
'weight' => 10,
'status' => 1,
),
),
);
$full_html_format = (object) $full_html_format;
filter_format_save($full_html_format);
$plain_text_format = array(
'format' => 'plain_text',
'name' => 'Plain text',
'weight' => -8,
'filters' => array(
'filter_html_escape' => array(
'weight' => 0,
'status' => 1,
'settings' => array(),
),
'filter_url' => array(
'weight' => 1,
'status' => 1,
'settings' => array(
'filter_url_length' => 72,
),
),
'filter_autop' => array(
'weight' => 2,
'status' => 1,
'settings' => array(),
),
),
);
$plain_text_format = (object) $plain_text_format;
filter_format_save($plain_text_format);
// Enable some standard blocks.
$default_theme = variable_get('theme_default', 'bartik');
$admin_theme = 'seven';
$blocks = array(
array(
'module' => 'system',
'delta' => 'main',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'content',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'help',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'help',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'main',
'theme' => $admin_theme,
'status' => 1,
'weight' => 0,
'region' => 'content',
'pages' => '',
'cache' => -1,
),
array(
'module' => 'system',
'delta' => 'help',
'theme' => $admin_theme,
'status' => 1,
'weight' => 0,
'region' => 'help',
'pages' => '',
'cache' => -1,
),
);
$query = db_insert('block')->fields(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache'));
foreach ($blocks as $block) {
$query->values($block);
}
$query->execute();
// Insert default pre-defined node types into the database. For a complete
// list of available node type attributes, refer to the node type API
// documentation at: http://api.drupal.org/api/HEAD/function/hook_node_info.
$types = array(
array(
'type' => 'page',
'name' => st('Basic page'),
'base' => 'node_content',
'description' => st("Use <em>basic pages</em> for your static content, such as an 'About us' page."),
'custom' => 1,
'modified' => 1,
'locked' => 0,
),
);
foreach ($types as $type) {
$type = node_type_set_defaults($type);
node_type_save($type);
node_add_body_field($type);
}
// Default "Basic page" settings.
variable_set('node_options_page', array('status', 'revision'));
variable_set('node_preview_page', 0);
variable_set('node_submitted_page', FALSE);
// Default pathauto setting to match menu positions.
variable_set('pathauto_node_pattern', "[node:menu-link:parents:join-path]/[node:title]");
// Allow visitor account creation with administrative approval.
variable_set('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
// Enable default permissions for system roles.
$filtered_html_permission = filter_permission_name($filtered_html_format);
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content', $filtered_html_permission));
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content', $filtered_html_permission));
// Create a default role for site administrators, with all available permissions assigned.
$admin_role = new stdClass();
$admin_role->name = 'administrator';
$admin_role->weight = 3;
user_role_save($admin_role);
user_role_grant_permissions($admin_role->rid, array_keys(module_invoke_all('permission')));
// Set this as the administrator role.
variable_set('user_admin_role', $admin_role->rid);
// Add an editor role.
$editor_role = new stdClass();
$editor_role->name = 'editor';
$editor_role->weight = 2;
user_role_save($editor_role);
$perms = array(
'access administration menu',
'access administration pages',
'access assets overview',
'access coffee',
'access content',
'access content overview',
'access user profiles',
'administer assets',
'administer asset types',
'administer menu',
'administer nodes',
'administer url aliases',
'administer users',
'bypass node access',
'change own username',
'create url aliases',
'create asset with type document',
'create asset with type image',
'create asset with type embed',
'delete asset with type document',
'delete asset with type image',
'delete asset with type embed',
'delete revisions',
'edit asset with type document',
'edit asset with type image',
'edit asset with type embed',
'revert revisions',
'use text format filtered_html',
'use text format full_html',
'view own unpublished content',
'view revisions',
'view style guides',
'view the administration theme',
'edit field help text',
);
user_role_grant_permissions($editor_role->rid, $perms);
// Enable seven and bear_skin themes and set defaults.
theme_enable(array('seven', 'bear_coat'));
variable_set('theme_default', 'bear_coat');
variable_set('admin_theme', 'seven');
variable_set('node_admin_theme', '1');
}