nas commited on 2010-11-29 05:00:10
Showing 5 changed files, with 783 additions and 0 deletions.
... | ... |
@@ -0,0 +1,454 @@ |
1 |
+<?php |
|
2 |
+########################################################### |
|
3 |
+# Simple Desk Project - www.simpledesk.net # |
|
4 |
+########################################################### |
|
5 |
+# An advanced help desk modifcation built on SMF # |
|
6 |
+########################################################### |
|
7 |
+# # |
|
8 |
+# * Copyright 2010 - SimpleDesk.net # |
|
9 |
+# # |
|
10 |
+# This file and its contents are subject to the license # |
|
11 |
+# included with this distribution, license.txt, which # |
|
12 |
+# states that this software is New BSD Licensed. # |
|
13 |
+# Any questions, please contact SimpleDesk.net # |
|
14 |
+# # |
|
15 |
+########################################################### |
|
16 |
+# SimpleDesk Version: 1.0 Felidae # |
|
17 |
+# File Info: install.php / 1.0 Felidae # |
|
18 |
+########################################################### |
|
19 |
+ |
|
20 |
+/** |
|
21 |
+ * This script prepares the database for all the tables and other database changes that SimpleDesk requires. |
|
22 |
+ * |
|
23 |
+ * NOTE: This script is meant to run using the <samp><database></database></samp> elements of the package-info.xml file. This is so |
|
24 |
+ * that admins have the choice to uninstall any database data installed with the mod. Also, since using the <samp><database></samp> |
|
25 |
+ * elements automatically calls on db_extend('packages'), we will only be calling that if we are running this script standalone. |
|
26 |
+ * |
|
27 |
+ * @package installer |
|
28 |
+ * @since 1.0 |
|
29 |
+ */ |
|
30 |
+ |
|
31 |
+/** |
|
32 |
+ * Before attempting to execute, this file attempts to load SSI.php to enable access to the database functions. |
|
33 |
+*/ |
|
34 |
+ |
|
35 |
+// If we have found SSI.php and we are outside of SMF, then we are running standalone. |
|
36 |
+if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF')) |
|
37 |
+ require_once(dirname(__FILE__) . '/SSI.php'); |
|
38 |
+elseif (!defined('SMF')) // If we are outside SMF and can't find SSI.php, then throw an error |
|
39 |
+ die('<b>Error:</b> Cannot install - please verify you put this file in the same place as SMF\'s SSI.php.'); |
|
40 |
+ |
|
41 |
+if (SMF == 'SSI') |
|
42 |
+ db_extend('packages'); |
|
43 |
+ |
|
44 |
+global $modSettings, $smcFunc; |
|
45 |
+ |
|
46 |
+// For our BBC settings, we first fetch a list off all BBC tags there are. |
|
47 |
+$bbc_tags = array(); |
|
48 |
+foreach (parse_bbc(false) AS $tag) |
|
49 |
+ $bbc_tags[] = $tag['tag']; |
|
50 |
+ |
|
51 |
+// Here we will update the $modSettings variables. |
|
52 |
+$mod_settings = array( |
|
53 |
+ 'shd_attachments_mode' => 'ticket', |
|
54 |
+ 'shd_staff_badge' => 'nobadge', |
|
55 |
+ 'shd_ticketnav_style' => 'sd', |
|
56 |
+ 'shd_enabled_bbc' => implode(',', $bbc_tags), // By default, all available tags are enabled. |
|
57 |
+ 'shd_privacy_display' => 'smart', |
|
58 |
+); |
|
59 |
+ |
|
60 |
+if (empty($modSettings['shd_attachments_mode'])) |
|
61 |
+{ |
|
62 |
+ // If this is set, SD has been installed before, so this shouldn't be run; this is only for new installs. |
|
63 |
+ $mod_settings += array( |
|
64 |
+ 'shd_allow_wikilinks' => 1, |
|
65 |
+ 'shd_display_ticket_logs' => 1, |
|
66 |
+ 'shd_logopt_resolve' => 1, |
|
67 |
+ 'shd_logopt_assign' => 1, |
|
68 |
+ 'shd_logopt_privacy' => 1, |
|
69 |
+ 'shd_logopt_urgency' => 1, |
|
70 |
+ 'shd_logopt_tickettopicmove' => 1, |
|
71 |
+ 'shd_logopt_delete' => 1, |
|
72 |
+ 'shd_logopt_restore' => 1, |
|
73 |
+ 'shd_logopt_permadelete' => 1, |
|
74 |
+ 'shd_logopt_relationships' => 1, |
|
75 |
+ 'shd_logopt_newposts' => 1, |
|
76 |
+ 'shd_logopt_editposts' => 1, |
|
77 |
+ 'shd_logopt_split' => 1, |
|
78 |
+ 'shd_thank_you_post' => 1, |
|
79 |
+ ); |
|
80 |
+} |
|
81 |
+// shd_disable_tickettotopic, shd_maintenance_mode should not be added because it's empty by default! |
|
82 |
+ |
|
83 |
+// Now, we move on to adding new tables to the database. |
|
84 |
+$tables = array(); |
|
85 |
+$tables[] = array( |
|
86 |
+ 'table_name' => '{db_prefix}helpdesk_tickets', |
|
87 |
+ 'columns' => array( |
|
88 |
+ db_field('id_ticket', 'mediumint', 0, true, true), |
|
89 |
+ db_field('id_first_msg', 'int'), |
|
90 |
+ db_field('id_member_started', 'mediumint'), |
|
91 |
+ db_field('id_last_msg', 'int'), |
|
92 |
+ db_field('id_member_updated', 'mediumint'), |
|
93 |
+ db_field('id_member_assigned', 'mediumint'), |
|
94 |
+ db_field('num_replies', 'int'), |
|
95 |
+ db_field('deleted_replies', 'int'), |
|
96 |
+ db_field('subject', 'varchar', 100), |
|
97 |
+ db_field('urgency', 'tinyint'), |
|
98 |
+ db_field('status', 'tinyint'), |
|
99 |
+ db_field('private', 'tinyint'), |
|
100 |
+ db_field('withdeleted', 'tinyint'), |
|
101 |
+ ), |
|
102 |
+ 'indexes' => array( |
|
103 |
+ array( |
|
104 |
+ 'columns' => array('id_ticket'), |
|
105 |
+ 'type' => 'primary', |
|
106 |
+ ), |
|
107 |
+ array( |
|
108 |
+ 'columns' => array('status', 'id_member_assigned'), |
|
109 |
+ 'type' => 'index', |
|
110 |
+ ), |
|
111 |
+ array( |
|
112 |
+ 'columns' => array('id_member_started', 'private'), |
|
113 |
+ 'type' => 'index', |
|
114 |
+ ), |
|
115 |
+ array( |
|
116 |
+ 'columns' => array('status', 'withdeleted', 'deleted_replies'), |
|
117 |
+ ), |
|
118 |
+ ), |
|
119 |
+ 'if_exists' => 'update', |
|
120 |
+ 'error' => 'fatal', |
|
121 |
+ 'parameters' => array(), |
|
122 |
+); |
|
123 |
+$tables[] = array( |
|
124 |
+ 'table_name' => '{db_prefix}helpdesk_ticket_replies', |
|
125 |
+ 'columns' => array( |
|
126 |
+ db_field('id_msg', 'int', 0, true, true), |
|
127 |
+ db_field('id_ticket', 'mediumint'), |
|
128 |
+ db_field('body', ($modSettings['max_messageLength'] > 65535 ? 'text' : 'mediumtext')), |
|
129 |
+ db_field('id_member', 'mediumint'), |
|
130 |
+ db_field('poster_time', 'int'), |
|
131 |
+ db_field('poster_name', 'varchar', 255), |
|
132 |
+ db_field('poster_email', 'varchar', 255), |
|
133 |
+ db_field('poster_ip', 'varchar', 255), |
|
134 |
+ db_field('modified_time', 'int'), |
|
135 |
+ db_field('modified_member', 'mediumint'), |
|
136 |
+ db_field('modified_name', 'varchar', 255), |
|
137 |
+ db_field('smileys_enabled', 'tinyint'), |
|
138 |
+ db_field('message_status', 'tinyint'), |
|
139 |
+ ), |
|
140 |
+ 'indexes' => array( |
|
141 |
+ array( |
|
142 |
+ 'columns' => array('id_msg'), |
|
143 |
+ 'type' => 'primary', |
|
144 |
+ ), |
|
145 |
+ array( |
|
146 |
+ 'columns' => array('id_ticket', 'id_msg', 'message_status'), |
|
147 |
+ 'type' => 'index', |
|
148 |
+ ), |
|
149 |
+ ), |
|
150 |
+ 'if_exists' => 'update', |
|
151 |
+ 'error' => 'fatal', |
|
152 |
+ 'parameters' => array(), |
|
153 |
+); |
|
154 |
+$tables[] = array( |
|
155 |
+ 'table_name' => '{db_prefix}helpdesk_log_action', |
|
156 |
+ 'columns' => array( |
|
157 |
+ db_field('id_action', 'int', 0, true, true), |
|
158 |
+ db_field('log_time', 'int'), // when this happened |
|
159 |
+ db_field('id_member', 'mediumint'), // person making the event |
|
160 |
+ db_field('ip', 'varchar', 255), // member's IP |
|
161 |
+ db_field('action', 'varchar', 30), // defines the message to use |
|
162 |
+ db_field('id_ticket', 'mediumint'), // ticket it applies to |
|
163 |
+ db_field('id_msg', 'int'), // msg it applies to |
|
164 |
+ db_field('extra', 'mediumtext') // serialised array of params for log message |
|
165 |
+ ), |
|
166 |
+ 'indexes' => array( |
|
167 |
+ array( |
|
168 |
+ 'columns' => array('id_action'), |
|
169 |
+ 'type' => 'primary', |
|
170 |
+ ), |
|
171 |
+ array( |
|
172 |
+ 'columns' => array('id_ticket'), |
|
173 |
+ 'type' => 'index', |
|
174 |
+ ), |
|
175 |
+ ), |
|
176 |
+ 'if_exists' => 'update', |
|
177 |
+ 'error' => 'fatal', |
|
178 |
+ 'parameters' => array(), |
|
179 |
+); |
|
180 |
+$tables[] = array( |
|
181 |
+ 'table_name' => '{db_prefix}helpdesk_log_read', |
|
182 |
+ 'columns' => array( |
|
183 |
+ db_field('id_ticket', 'mediumint'), |
|
184 |
+ db_field('id_member', 'mediumint'), |
|
185 |
+ db_field('id_msg', 'int'), |
|
186 |
+ ), |
|
187 |
+ 'indexes' => array( |
|
188 |
+ array( |
|
189 |
+ 'columns' => array('id_ticket', 'id_member'), |
|
190 |
+ 'type' => 'primary', |
|
191 |
+ ), |
|
192 |
+ ), |
|
193 |
+ 'if_exists' => 'update', |
|
194 |
+ 'error' => 'fatal', |
|
195 |
+ 'parameters' => array(), |
|
196 |
+); |
|
197 |
+$tables[] = array( |
|
198 |
+ 'table_name' => '{db_prefix}helpdesk_attachments', |
|
199 |
+ 'columns' => array( |
|
200 |
+ db_field('id_attach', 'int'), |
|
201 |
+ db_field('id_ticket', 'mediumint'), |
|
202 |
+ db_field('id_msg', 'int'), |
|
203 |
+ ), |
|
204 |
+ 'indexes' => array( |
|
205 |
+ array( |
|
206 |
+ 'columns' => array('id_attach'), |
|
207 |
+ 'type' => 'primary', |
|
208 |
+ ), |
|
209 |
+ ), |
|
210 |
+ 'if_exists' => 'update', |
|
211 |
+ 'error' => 'fatal', |
|
212 |
+ 'parameters' => array(), |
|
213 |
+); |
|
214 |
+$tables[] = array( |
|
215 |
+ 'table_name' => '{db_prefix}helpdesk_relationships', |
|
216 |
+ 'columns' => array( |
|
217 |
+ db_field('primary_ticket', 'mediumint'), |
|
218 |
+ db_field('secondary_ticket', 'mediumint'), |
|
219 |
+ db_field('rel_type', 'tinyint'), |
|
220 |
+ ), |
|
221 |
+ 'indexes' => array( |
|
222 |
+ array( |
|
223 |
+ 'columns' => array('primary_ticket', 'secondary_ticket'), |
|
224 |
+ 'type' => 'primary', |
|
225 |
+ ), |
|
226 |
+ array( |
|
227 |
+ 'columns' => array('primary_ticket', 'rel_type'), |
|
228 |
+ ), |
|
229 |
+ ), |
|
230 |
+ 'if_exists' => 'update', |
|
231 |
+ 'error' => 'fatal', |
|
232 |
+ 'parameters' => array(), |
|
233 |
+); |
|
234 |
+$tables[] = array( |
|
235 |
+ 'table_name' => '{db_prefix}helpdesk_custom_fields', |
|
236 |
+ 'columns' => array( |
|
237 |
+ db_field('id_field', 'smallint', 0, true, true), |
|
238 |
+ db_field('active', 'tinyint'), |
|
239 |
+ db_field('field_order', 'smallint'), |
|
240 |
+ db_field('field_name', 'varchar', 40), |
|
241 |
+ db_field('field_desc', 'varchar', 255), |
|
242 |
+ db_field('field_loc', 'tinyint'), |
|
243 |
+ db_field('icon', 'varchar', 20), |
|
244 |
+ db_field('field_type', 'tinyint'), |
|
245 |
+ ), |
|
246 |
+ 'indexes' => array( |
|
247 |
+ array( |
|
248 |
+ 'columns' => array('id_field', 'active'), |
|
249 |
+ 'type' => 'primary', |
|
250 |
+ ), |
|
251 |
+ ), |
|
252 |
+ 'if_exists' => 'update', |
|
253 |
+ 'error' => 'fatal', |
|
254 |
+ 'parameters' => array(), |
|
255 |
+); |
|
256 |
+$tables[] = array( |
|
257 |
+ 'table_name' => '{db_prefix}helpdesk_roles', |
|
258 |
+ 'columns' => array( |
|
259 |
+ db_field('id_role', 'smallint', 0, true, true), |
|
260 |
+ db_field('template', 'tinyint'), |
|
261 |
+ db_field('role_name', 'varchar', 80), |
|
262 |
+ ), |
|
263 |
+ 'indexes' => array( |
|
264 |
+ array( |
|
265 |
+ 'columns' => array('id_role'), |
|
266 |
+ 'type' => 'primary', |
|
267 |
+ ), |
|
268 |
+ ), |
|
269 |
+ 'if_exists' => 'update', |
|
270 |
+ 'error' => 'fatal', |
|
271 |
+ 'parameters' => array(), |
|
272 |
+); |
|
273 |
+$tables[] = array( |
|
274 |
+ 'table_name' => '{db_prefix}helpdesk_role_groups', |
|
275 |
+ 'columns' => array( |
|
276 |
+ db_field('id_role', 'smallint'), |
|
277 |
+ db_field('id_group', 'smallint'), |
|
278 |
+ ), |
|
279 |
+ 'indexes' => array( |
|
280 |
+ array( |
|
281 |
+ 'columns' => array('id_role', 'id_group'), |
|
282 |
+ 'type' => 'primary', |
|
283 |
+ ), |
|
284 |
+ ), |
|
285 |
+ 'if_exists' => 'update', |
|
286 |
+ 'error' => 'fatal', |
|
287 |
+ 'parameters' => array(), |
|
288 |
+); |
|
289 |
+$tables[] = array( |
|
290 |
+ 'table_name' => '{db_prefix}helpdesk_role_permissions', |
|
291 |
+ 'columns' => array( |
|
292 |
+ db_field('id_role', 'smallint'), |
|
293 |
+ db_field('permission', 'varchar', 40), |
|
294 |
+ db_field('add_type', 'tinyint'), |
|
295 |
+ ), |
|
296 |
+ 'indexes' => array( |
|
297 |
+ array( |
|
298 |
+ 'columns' => array('id_role', 'permission'), |
|
299 |
+ 'type' => 'primary', |
|
300 |
+ ), |
|
301 |
+ ), |
|
302 |
+ 'if_exists' => 'update', |
|
303 |
+ 'error' => 'fatal', |
|
304 |
+ 'parameters' => array(), |
|
305 |
+); |
|
306 |
+$tables[] = array( |
|
307 |
+ 'table_name' => '{db_prefix}helpdesk_preferences', |
|
308 |
+ 'columns' => array( |
|
309 |
+ db_field('id_member', 'mediumint'), |
|
310 |
+ db_field('variable', 'varchar', 30), |
|
311 |
+ db_field('value', 'text'), |
|
312 |
+ ), |
|
313 |
+ 'indexes' => array( |
|
314 |
+ array( |
|
315 |
+ 'columns' => array('id_member', 'variable'), |
|
316 |
+ 'type' => 'primary', |
|
317 |
+ ), |
|
318 |
+ ), |
|
319 |
+ 'if_exists' => 'update', |
|
320 |
+ 'error' => 'fatal', |
|
321 |
+ 'parameters' => array(), |
|
322 |
+); |
|
323 |
+ |
|
324 |
+// Oh joy, we've now made it to extra rows... (testing data) |
|
325 |
+$rows = array(); |
|
326 |
+$rows[] = array( |
|
327 |
+ 'method' => 'replace', |
|
328 |
+ 'table_name' => '{db_prefix}helpdesk_custom_fields', |
|
329 |
+ 'columns' => array( |
|
330 |
+ 'active' => 'int', |
|
331 |
+ 'field_order' => 'int', |
|
332 |
+ 'field_name' => 'string', |
|
333 |
+ 'field_desc' => 'string', |
|
334 |
+ 'field_loc' => 'int', |
|
335 |
+ 'icon' => 'string', |
|
336 |
+ 'field_type' => 'int', |
|
337 |
+ ), |
|
338 |
+ 'data' => array( |
|
339 |
+ array( |
|
340 |
+ 1, |
|
341 |
+ 0, |
|
342 |
+ 'Test field', |
|
343 |
+ 'This is my test field', |
|
344 |
+ 1, |
|
345 |
+ '', |
|
346 |
+ 1, |
|
347 |
+ ), |
|
348 |
+ array( |
|
349 |
+ 1, |
|
350 |
+ 1, |
|
351 |
+ 'Second test field', |
|
352 |
+ 'This is my second test field', |
|
353 |
+ 2, |
|
354 |
+ '', |
|
355 |
+ 3, |
|
356 |
+ ), |
|
357 |
+ array( |
|
358 |
+ 0, |
|
359 |
+ 2, |
|
360 |
+ 'Third test field', |
|
361 |
+ 'This is my third test field', |
|
362 |
+ 3, |
|
363 |
+ '', |
|
364 |
+ 4, |
|
365 |
+ ), |
|
366 |
+ ), |
|
367 |
+ 'keys' => array('id_field'), |
|
368 |
+); |
|
369 |
+ |
|
370 |
+// Now we can add a new column to an existing table |
|
371 |
+$columns = array(); |
|
372 |
+ |
|
373 |
+// Update mod settings if applicable |
|
374 |
+foreach ($mod_settings as $new_setting => $new_value) |
|
375 |
+{ |
|
376 |
+ if (empty($modSettings[$new_setting])) |
|
377 |
+ updateSettings(array($new_setting => $new_value)); |
|
378 |
+} |
|
379 |
+ |
|
380 |
+// Create new tables, if any |
|
381 |
+foreach ($tables as $table) |
|
382 |
+ $smcFunc['db_create_table']($table['table_name'], $table['columns'], $table['indexes'], $table['parameters'], $table['if_exists'], $table['error']); |
|
383 |
+ |
|
384 |
+// Create new rows, if any |
|
385 |
+foreach ($rows as $row) |
|
386 |
+ $smcFunc['db_insert']($row['method'], $row['table_name'], $row['columns'], $row['data'], $row['keys']); |
|
387 |
+ |
|
388 |
+// Create new columns, if any |
|
389 |
+foreach ($columns as $column) |
|
390 |
+ $smcFunc['db_add_column']($column['table_name'], $column['column_info'], $column['parameters'], $column['if_exists'], $column['error']); |
|
391 |
+ |
|
392 |
+// Are we done? |
|
393 |
+if (SMF == 'SSI') |
|
394 |
+ echo 'Database changes are complete!'; |
|
395 |
+ |
|
396 |
+function db_field($name, $type, $size = 0, $unsigned = true, $auto = false) |
|
397 |
+{ |
|
398 |
+ $fields = array( |
|
399 |
+ 'varchar' => array( |
|
400 |
+ 'auto' => false, |
|
401 |
+ 'type' => 'varchar', |
|
402 |
+ 'size' => $size == 0 ? 50 : $size, |
|
403 |
+ 'null' => false, |
|
404 |
+ ), |
|
405 |
+ 'text' => array( |
|
406 |
+ 'auto' => false, |
|
407 |
+ 'type' => 'text', |
|
408 |
+ 'null' => false, |
|
409 |
+ ), |
|
410 |
+ 'mediumtext' => array( |
|
411 |
+ 'auto' => false, |
|
412 |
+ 'type' => 'mediumtext', |
|
413 |
+ 'null' => false, |
|
414 |
+ ), |
|
415 |
+ 'tinyint' => array( |
|
416 |
+ 'auto' => $auto, |
|
417 |
+ 'type' => 'tinyint', |
|
418 |
+ 'default' => 0, |
|
419 |
+ 'size' => empty($unsigned) ? 4 : 3, |
|
420 |
+ 'unsigned' => $unsigned, |
|
421 |
+ 'null' => false, |
|
422 |
+ ), |
|
423 |
+ 'smallint' => array( |
|
424 |
+ 'auto' => $auto, |
|
425 |
+ 'type' => 'smallint', |
|
426 |
+ 'default' => 0, |
|
427 |
+ 'size' => empty($unsigned) ? 6 : 5, |
|
428 |
+ 'unsigned' => $unsigned, |
|
429 |
+ 'null' => false, |
|
430 |
+ ), |
|
431 |
+ 'mediumint' => array( |
|
432 |
+ 'auto' => $auto, |
|
433 |
+ 'type' => 'mediumint', |
|
434 |
+ 'default' => 0, |
|
435 |
+ 'size' => 8, |
|
436 |
+ 'unsigned' => $unsigned, |
|
437 |
+ 'null' => false, |
|
438 |
+ ), |
|
439 |
+ 'int' => array( |
|
440 |
+ 'auto' => $auto, |
|
441 |
+ 'type' => 'int', |
|
442 |
+ 'default' => 0, |
|
443 |
+ 'size' => empty($unsigned) ? 11 : 10, |
|
444 |
+ 'unsigned' => $unsigned, |
|
445 |
+ 'null' => false, |
|
446 |
+ ), |
|
447 |
+ ); |
|
448 |
+ |
|
449 |
+ $field = $fields[$type]; |
|
450 |
+ $field['name'] = $name; |
|
451 |
+ |
|
452 |
+ return $field; |
|
453 |
+} |
|
454 |
+?> |
|
0 | 455 |
\ No newline at end of file |
... | ... |
@@ -0,0 +1,24 @@ |
1 |
+Copyright (c) 2010, SimpleDesk Team |
|
2 |
+All rights reserved. |
|
3 |
+ |
|
4 |
+Redistribution and use in source and binary forms, with or without |
|
5 |
+modification, are permitted provided that the following conditions are met: |
|
6 |
+ * Redistributions of source code must retain the above copyright |
|
7 |
+ notice, this list of conditions and the following disclaimer. |
|
8 |
+ * Redistributions in binary form must reproduce the above copyright |
|
9 |
+ notice, this list of conditions and the following disclaimer in the |
|
10 |
+ documentation and/or other materials provided with the distribution. |
|
11 |
+ * Neither the name of SimpleDesk nor the |
|
12 |
+ names of its contributors may be used to endorse or promote products |
|
13 |
+ derived from this software without specific prior written permission. |
|
14 |
+ |
|
15 |
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
|
16 |
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
17 |
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|
18 |
+DISCLAIMED. IN NO EVENT SHALL SIMPLEDESK TEAM BE LIABLE FOR ANY |
|
19 |
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
|
20 |
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|
21 |
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|
22 |
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
23 |
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|
24 |
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
0 | 25 |
\ No newline at end of file |
... | ... |
@@ -0,0 +1,100 @@ |
1 |
+<?xml version="1.0"?> |
|
2 |
+<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info"> |
|
3 |
+<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/"> |
|
4 |
+ <id>SimpleDeskTeam:SimpleDesk</id> |
|
5 |
+ <name>SimpleDesk - Integrated Helpdesk for Simple Machines Forum</name> |
|
6 |
+ <version>1.1 r753</version> |
|
7 |
+ <type>modification</type> |
|
8 |
+ |
|
9 |
+ <install for="2.0 RC4"> |
|
10 |
+ <!-- readme files --> |
|
11 |
+ <readme lang="english" parsebbc="true" type="file">language-readme/readme.english.txt</readme> |
|
12 |
+ |
|
13 |
+ <!-- general edits --> |
|
14 |
+ <modification format="xml" type="file">install-xml/install.xml</modification> |
|
15 |
+ <modification format="xml" type="file">install-xml/install-attachments.xml</modification> |
|
16 |
+ <modification format="xml" type="file">install-xml/install-trackip.xml</modification> |
|
17 |
+ |
|
18 |
+ <!-- language files --> |
|
19 |
+ <require-file name="language-php/SimpleDesk.english.php" destination="$languagedir" /> |
|
20 |
+ <require-file name="language-php/SimpleDeskPermissions.english.php" destination="$languagedir" /> |
|
21 |
+ <require-file name="language-php/SimpleDeskLogAction.english.php" destination="$languagedir" /> |
|
22 |
+ <require-file name="language-php/SimpleDeskAdmin.english.php" destination="$languagedir" /> |
|
23 |
+ <require-file name="language-php/SimpleDeskWho.english.php" destination="$languagedir" /> |
|
24 |
+ <require-file name="language-php/SimpleDeskProfile.english.php" destination="$languagedir" /> |
|
25 |
+ |
|
26 |
+ <!-- sources --> |
|
27 |
+ <require-dir name="sd_source" destination="$sourcedir" /> |
|
28 |
+ |
|
29 |
+ <!-- templates --> |
|
30 |
+ <require-dir name="sd_template" destination="$themedir" /> |
|
31 |
+ |
|
32 |
+ <!-- images --> |
|
33 |
+ <require-dir name="images/simpledesk" destination="$themes_dir/default/images" /> |
|
34 |
+ <require-dir name="images/sd_plugins" destination="$themes_dir/default/images" /> |
|
35 |
+ <require-dir name="images/shd" destination="$imagesdir/admin" /> |
|
36 |
+ <require-file name="images/feature_shd.png" destination="$themes_dir/default/images/admin" /><!-- explicitly called from default theme in ACP --> |
|
37 |
+ |
|
38 |
+ <!-- css --> |
|
39 |
+ <require-file name="css/helpdesk.css" destination="$themedir/css" /> |
|
40 |
+ <require-file name="css/helpdesk_admin.css" destination="$themedir/css" /> |
|
41 |
+ <require-file name="css/helpdesk_ie6.css" destination="$themedir/css" /> |
|
42 |
+ |
|
43 |
+ <!-- scripts --> |
|
44 |
+ <require-file name="scripts/helpdesk_admin.js" destination="$themedir/scripts" /> |
|
45 |
+ <require-file name="scripts/helpdesk.js" destination="$themedir/scripts" /> |
|
46 |
+ |
|
47 |
+ <!-- bundled plugins --> |
|
48 |
+ <require-dir name="sd_plugins_source" destination="$sourcedir" /> |
|
49 |
+ <require-dir name="sd_plugins_template" destination="$themes_dir/default" /> |
|
50 |
+ <require-file name="sd_plugins_lang/email_notifications/SDPluginEmailNotifications.english.php" destination="$languagedir" /> |
|
51 |
+ |
|
52 |
+ <!-- database changes --> |
|
53 |
+ <database>install.php</database> |
|
54 |
+ |
|
55 |
+ <redirect url="?action=admin;area=corefeatures#js_feature_shd" /> |
|
56 |
+ </install> |
|
57 |
+ |
|
58 |
+ <uninstall for="2.0 RC4"> |
|
59 |
+ <!-- database changes, undone --> |
|
60 |
+ <database>uninstall-optional.php</database> |
|
61 |
+ <code type="file">uninstall-required.php</code> |
|
62 |
+ |
|
63 |
+ <!-- general edits, undone --> |
|
64 |
+ <modification format="xml" type="file" reverse="true">install-xml/install.xml</modification> |
|
65 |
+ <modification format="xml" type="file" reverse="true">install-xml/install-attachments.xml</modification> |
|
66 |
+ <modification format="xml" type="file" reverse="true">install-xml/install-trackip.xml</modification> |
|
67 |
+ |
|
68 |
+ <!-- language files, removed --> |
|
69 |
+ <remove-file name="$languagedir/SimpleDesk.english.php" /> |
|
70 |
+ <remove-file name="$languagedir/SimpleDeskPermissions.english.php" /> |
|
71 |
+ <remove-file name="$languagedir/SimpleDeskLogAction.english.php" /> |
|
72 |
+ <remove-file name="$languagedir/SimpleDeskAdmin.english.php" /> |
|
73 |
+ <remove-file name="$languagedir/SimpleDeskWho.english.php" /> |
|
74 |
+ <remove-file name="$languagedir/SimpleDeskProfile.english.php" /> |
|
75 |
+ |
|
76 |
+ <!-- source files, removed --> |
|
77 |
+ <remove-dir name="$sourcedir/sd_source" /> |
|
78 |
+ |
|
79 |
+ <!-- template files, removed --> |
|
80 |
+ <remove-dir name="$themedir/sd_template" /> |
|
81 |
+ |
|
82 |
+ <!-- images, removed --> |
|
83 |
+ <remove-dir name="$themes_dir/default/images/simpledesk" /> |
|
84 |
+ <remove-dir name="$imagesdir/admin/shd" /> |
|
85 |
+ <remove-file name="$themes_dir/default/images/admin/feature_shd.png" /> |
|
86 |
+ |
|
87 |
+ <!-- css, removed --> |
|
88 |
+ <remove-file name="$themedir/css/helpdesk.css" /> |
|
89 |
+ <remove-file name="$themedir/css/helpdesk-admin.css" /> |
|
90 |
+ <remove-file name="$themedir/css/helpdesk-ie6.css" /> |
|
91 |
+ |
|
92 |
+ <!-- bundled plugins removed (NOTE: done one by one to avoid eating existing plugins on upgrade) --> |
|
93 |
+ <remove-dir name="$sourcedir/sd_plugins_source/email_notifications" /> |
|
94 |
+ <remove-file name="$languagedir/SDPluginEmailNotifications.english.php" /> |
|
95 |
+ |
|
96 |
+ <!-- scripts, removed --> |
|
97 |
+ <remove-file name="$themedir/scripts/helpdesk-admin.js" /> |
|
98 |
+ <remove-file name="$themedir/scripts/helpdesk.js" /> |
|
99 |
+ </uninstall> |
|
100 |
+</package-info> |
|
0 | 101 |
\ No newline at end of file |
... | ... |
@@ -0,0 +1,144 @@ |
1 |
+<?php |
|
2 |
+############################################################### |
|
3 |
+# Simple Desk Project - www.simpledesk.net # |
|
4 |
+############################################################### |
|
5 |
+# An advanced help desk modifcation built on SMF # |
|
6 |
+############################################################### |
|
7 |
+# # |
|
8 |
+# * Copyright 2010 - SimpleDesk.net # |
|
9 |
+# # |
|
10 |
+# This file and its contents are subject to the license # |
|
11 |
+# included with this distribution, license.txt, which # |
|
12 |
+# states that this software is New BSD Licensed. # |
|
13 |
+# Any questions, please contact SimpleDesk.net # |
|
14 |
+# # |
|
15 |
+############################################################### |
|
16 |
+# SimpleDesk Version: 1.0 Felidae # |
|
17 |
+# File Info: uninstall-optional.php / 1.0 Felidae # |
|
18 |
+############################################################### |
|
19 |
+ |
|
20 |
+/** |
|
21 |
+ * This script removes all the extraneous data if the user requests it be removed on uninstall. |
|
22 |
+ * |
|
23 |
+ * NOTE: This script is meant to run using the <samp><database></database></samp> elements of the package-info.xml file. The install |
|
24 |
+ * script, run through <samp><database></samp> elements would have set up the tables and so on. This script runs from |
|
25 |
+ * <samp><database></samp> during uninstallation only when the user requests that data should be cleared, so this script deals with it; |
|
26 |
+ * note that table removal will be dealt with by SMF itself because of <samp><database></samp> handling, so this is for things like |
|
27 |
+ * settings that are not covered in <samp><database></samp>. |
|
28 |
+ * |
|
29 |
+ * @package installer |
|
30 |
+ * @since 1.0 |
|
31 |
+ */ |
|
32 |
+ |
|
33 |
+/** |
|
34 |
+ * Before attempting to execute, this file attempts to load SSI.php to enable access to the database functions. |
|
35 |
+*/ |
|
36 |
+ |
|
37 |
+// If we have found SSI.php and we are outside of SMF, then we are running standalone. |
|
38 |
+if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF')) |
|
39 |
+{ |
|
40 |
+ require_once(dirname(__FILE__) . '/SSI.php'); |
|
41 |
+ db_extend('packages'); |
|
42 |
+} |
|
43 |
+// If we are outside SMF and can't find SSI.php, then throw an error |
|
44 |
+elseif (!defined('SMF')) |
|
45 |
+{ |
|
46 |
+ die('<b>Error:</b> Cannot uninstall - please verify you put this file in the same place as SMF\'s SSI.php.'); |
|
47 |
+} |
|
48 |
+ |
|
49 |
+$to_remove = array( |
|
50 |
+ 'shd_staff_badge', |
|
51 |
+ 'shd_display_avatar', |
|
52 |
+ 'shd_disable_action_log', |
|
53 |
+ 'shd_ticketnav_style', |
|
54 |
+ 'shd_allow_ticket_bbc', |
|
55 |
+ 'shd_allow_ticket_smileys', |
|
56 |
+ 'shd_enabled_bbc', |
|
57 |
+ 'shd_helpdesk_only', |
|
58 |
+ 'shd_attachments_mode', |
|
59 |
+ 'shd_disable_pm', |
|
60 |
+ 'shd_disable_mlist', |
|
61 |
+ 'shd_bbc', |
|
62 |
+ 'shd_staff_ticket_self', |
|
63 |
+ 'shd_admins_not_assignable', |
|
64 |
+ 'shd_privacy_display', |
|
65 |
+ 'shd_disable_tickettotopic', |
|
66 |
+ 'shd_display_ticket_logs', |
|
67 |
+ 'shd_logopt_newposts', |
|
68 |
+ 'shd_logopt_editposts', |
|
69 |
+ 'shd_logopt_resolve', |
|
70 |
+ 'shd_logopt_assign', |
|
71 |
+ 'shd_logopt_privacy', |
|
72 |
+ 'shd_logopt_urgency', |
|
73 |
+ 'shd_logopt_tickettopicmove', |
|
74 |
+ 'shd_logopt_delete', |
|
75 |
+ 'shd_logopt_restore', |
|
76 |
+ 'shd_logopt_permadelete', |
|
77 |
+ 'shd_logopt_relationships', |
|
78 |
+ 'shd_maintenance_mode', |
|
79 |
+ 'shd_allow_wikilinks', |
|
80 |
+ 'shd_thank_you_post', |
|
81 |
+ 'shd_thank_you_nonstaff', |
|
82 |
+ // Plugin related: general |
|
83 |
+ 'shd_enabled_plugins', |
|
84 |
+ // Plugin: source load hooks |
|
85 |
+ 'shd_include_init', |
|
86 |
+ 'shd_include_helpdesk', |
|
87 |
+ 'shd_include_hdadmin', |
|
88 |
+ 'shd_include_hdprofile', |
|
89 |
+ // Plugin: lang load hooks |
|
90 |
+ 'shd_includelang_init', |
|
91 |
+ 'shd_includelang_helpdesk', |
|
92 |
+ 'shd_includelang_hdadmin', |
|
93 |
+ 'shd_includelang_hdprofile', |
|
94 |
+ // Plugin: general hooks |
|
95 |
+ 'shd_hook_actions', |
|
96 |
+ 'shd_hook_perms', |
|
97 |
+ 'shd_hook_permstemplate', |
|
98 |
+ 'shd_hook_prefs', |
|
99 |
+ 'shd_hook_newticket', |
|
100 |
+ 'shd_hook_newreply', |
|
101 |
+ 'shd_hook_modpost', |
|
102 |
+ 'shd_hook_assign', |
|
103 |
+ 'shd_hook_buffer', |
|
104 |
+ 'shd_hook_postingopts', |
|
105 |
+ // Plugin: menu hooks |
|
106 |
+ 'shd_hook_mainmenu', |
|
107 |
+ 'shd_hook_profilemenu', |
|
108 |
+ 'shd_hook_adminmenu', |
|
109 |
+ // Plugin: area hooks |
|
110 |
+ 'shd_hook_helpdesk', |
|
111 |
+ 'shd_hook_hdadmin', |
|
112 |
+ 'shd_hook_hdadminopts', |
|
113 |
+ 'shd_hook_hdadminoptssrch', |
|
114 |
+ 'shd_hook_hdprofile', |
|
115 |
+ // Plugin: bundled email notifications plugins |
|
116 |
+ 'shd_notify_new_ticket', |
|
117 |
+ 'shd_notify_new_reply_own', |
|
118 |
+ 'shd_notify_new_reply_assigned', |
|
119 |
+ 'shd_notify_new_reply_previous', |
|
120 |
+ 'shd_notify_new_reply_any', |
|
121 |
+); |
|
122 |
+ |
|
123 |
+global $modSettings; |
|
124 |
+ |
|
125 |
+// Clear in-situ modsettings |
|
126 |
+foreach ($to_remove as $setting) |
|
127 |
+ if (isset($modSettings[$setting])) |
|
128 |
+ unset($modSettings[$setting]); |
|
129 |
+ |
|
130 |
+// Remove from the database; updateSettings can't actually remove them, it seems :( |
|
131 |
+$smcFunc['db_query']('', ' |
|
132 |
+ DELETE FROM {db_prefix}settings |
|
133 |
+ WHERE variable IN ({array_string:settings})', |
|
134 |
+ array( |
|
135 |
+ 'settings' => $to_remove, |
|
136 |
+ ) |
|
137 |
+); |
|
138 |
+ |
|
139 |
+// And tell SMF we've updated $modSettings |
|
140 |
+updateSettings(array( |
|
141 |
+ 'settings_updated' => time(), |
|
142 |
+)); |
|
143 |
+ |
|
144 |
+?> |
|
0 | 145 |
\ No newline at end of file |
... | ... |
@@ -0,0 +1,61 @@ |
1 |
+<?php |
|
2 |
+############################################################### |
|
3 |
+# Simple Desk Project - www.simpledesk.net # |
|
4 |
+############################################################### |
|
5 |
+# An advanced help desk modifcation built on SMF # |
|
6 |
+############################################################### |
|
7 |
+# # |
|
8 |
+# * Copyright 2010 - SimpleDesk.net # |
|
9 |
+# # |
|
10 |
+# This file and its contents are subject to the license # |
|
11 |
+# included with this distribution, license.txt, which # |
|
12 |
+# states that this software is New BSD Licensed. # |
|
13 |
+# Any questions, please contact SimpleDesk.net # |
|
14 |
+# # |
|
15 |
+############################################################### |
|
16 |
+# SimpleDesk Version: 1.0 Felidae # |
|
17 |
+# File Info: uninstall-required.php / 1.0 Felidae # |
|
18 |
+############################################################### |
|
19 |
+ |
|
20 |
+/** |
|
21 |
+ * This script removes all the extraneous data if the user requests it be removed on uninstall. |
|
22 |
+ * |
|
23 |
+ * NOTE: This script is meant to run using the <samp><code></code></samp> elements of our package-info.xml file. This is because |
|
24 |
+ * certain items in the database and within SMF will need to be removed regardless of whether the user wants to keep data or not, |
|
25 |
+ * for example SimpleDesk needs to be deactivated in the Core Features panel, which must be done regardless of whether the user |
|
26 |
+ * wanted to keep data or not during uninstallation. Future expansions may add items here, especially such as scheduled tasks. |
|
27 |
+ * |
|
28 |
+ * @package installer |
|
29 |
+ * @since 1.0 |
|
30 |
+ */ |
|
31 |
+ |
|
32 |
+/** |
|
33 |
+ * Before attempting to execute, this file attempts to load SSI.php to enable access to the database functions. |
|
34 |
+*/ |
|
35 |
+ |
|
36 |
+// If we have found SSI.php and we are outside of SMF, then we are running standalone. |
|
37 |
+if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF')) |
|
38 |
+{ |
|
39 |
+ require_once(dirname(__FILE__) . '/SSI.php'); |
|
40 |
+ db_extend('packages'); |
|
41 |
+} |
|
42 |
+// If we are outside SMF and can't find SSI.php, then throw an error |
|
43 |
+elseif (!defined('SMF')) |
|
44 |
+{ |
|
45 |
+ die('<b>Error:</b> Cannot uninstall - please verify you put this file in the same place as SMF\'s SSI.php.'); |
|
46 |
+} |
|
47 |
+ |
|
48 |
+// Unchecking the option in Core Features, and deactivating all the hooks |
|
49 |
+ |
|
50 |
+global $modSettings; |
|
51 |
+$modSettings['helpdesk_active'] = false; |
|
52 |
+$features = implode(',', array_diff(explode(',', $modSettings['admin_features']), array('shd'))); |
|
53 |
+ |
|
54 |
+updateSettings( |
|
55 |
+ array( |
|
56 |
+ 'admin_features' => $features, |
|
57 |
+ ), |
|
58 |
+ true |
|
59 |
+); |
|
60 |
+ |
|
61 |
+?> |
|
0 | 62 |
\ No newline at end of file |
1 | 63 |