1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* You may not change or alter any portion of this comment or credits |
4
|
|
|
* of supporting developers from this source code or any supporting source code |
5
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
6
|
|
|
* |
7
|
|
|
* This program is distributed in the hope that it will be useful, |
8
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
9
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @copyright {@link http://xoops.org/ XOOPS Project} |
14
|
|
|
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
15
|
|
|
* @package |
16
|
|
|
* @since |
17
|
|
|
* @author XOOPS Development Team, |
18
|
|
|
* @author Antiques Promotion (http://www.antiquespromotion.ca) |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
defined('XOOPS_ROOT_PATH') || exit('XOOPS Root Path not defined'); |
22
|
|
|
|
23
|
|
|
// referer check |
24
|
|
|
$ref = xoops_getenv('HTTP_REFERER'); |
25
|
|
|
if ($ref === '' || strpos($ref, XOOPS_URL . '/modules/system/admin.php') === 0) { |
26
|
|
|
/* module specific part */ |
27
|
|
|
global $xoopsDB; |
28
|
|
|
|
29
|
|
|
// 0.75 to 0.76 |
30
|
|
|
$result = $GLOBALS['xoopsDB']->query('SELECT event_tz FROM ' . $GLOBALS['xoopsDB']->prefix("apcal{$mydirnumber}_event") . ' LIMIT 1'); |
31
|
|
|
if ($result) { |
32
|
|
|
list($event_tz) = $GLOBALS['xoopsDB']->fetchRow($result); |
33
|
|
|
if (false === strpos($event_tz, '.')) { |
34
|
|
|
$GLOBALS['xoopsDB']->queryF('ALTER TABLE ' |
35
|
|
|
. $GLOBALS['xoopsDB']->prefix("apcal{$mydirnumber}_event") |
36
|
|
|
. ' MODIFY event_tz FLOAT(2,1) NOT NULL DEFAULT 0.0, MODIFY server_tz FLOAT(2,1) NOT NULL DEFAULT 0.0, MODIFY poster_tz FLOAT(2,1) NOT NULL DEFAULT 0.0, ADD KEY (admission), ADD KEY (allday), ADD KEY (START), ADD KEY (END), ADD KEY (start_date), ADD KEY (end_date), ADD KEY (dtstamp), ADD KEY (unique_id), ADD KEY (cid), ADD KEY (event_tz), ADD KEY (server_tz), ADD KEY (poster_tz), ADD KEY (uid), ADD KEY (groupid), ADD KEY (class), ADD KEY (rrule_pid), ADD KEY (categories)'); |
37
|
|
|
} |
38
|
|
|
} |
39
|
|
|
// ALTER TABLE xoops_apcal_event MODIFY event_tz smallint(5) NOT NULL default 0, MODIFY server_tz smallint(5) NOT NULL default 0, MODIFY poster_tz smallint(5) NOT NULL default 0, DROP KEY admission, DROP KEY allday, DROP KEY start, DROP KEY end, DROP KEY start_date, DROP KEY end_date, DROP KEY dtstamp, DROP KEY unique_id, DROP KEY cid, DROP KEY event_tz, DROP KEY server_tz, DROP KEY poster_tz, DROP KEY uid, DROP KEY groupid, DROP KEY class, DROP KEY rrule_pid, DROP KEY categories ; |
40
|
|
|
|
41
|
|
|
// 0.76 to 0.8 |
42
|
|
|
$result = $GLOBALS['xoopsDB']->query('SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix("apcal{$mydirnumber}_plugins") . ' LIMIT 1'); |
43
|
|
View Code Duplication |
if (!$result) { |
|
|
|
|
44
|
|
|
$GLOBALS['xoopsDB']->queryF('ALTER TABLE ' |
45
|
|
|
. $GLOBALS['xoopsDB']->prefix("apcal{$mydirnumber}_cat") |
46
|
|
|
. " CHANGE cat_extkey1 cat_depth TINYINT UNSIGNED NOT NULL DEFAULT 0, ADD cat_style VARCHAR(255) NOT NULL DEFAULT '', ADD KEY (pid), ADD KEY (weight), ADD KEY (cat_depth)"); |
47
|
|
|
|
48
|
|
|
$GLOBALS['xoopsDB']->queryF('CREATE TABLE ' . $GLOBALS['xoopsDB']->prefix("apcal{$mydirnumber}_plugins") . " ( |
49
|
|
|
pi_id SMALLINT(5) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT, |
50
|
|
|
pi_title VARCHAR(255) NOT NULL DEFAULT '', |
51
|
|
|
pi_type VARCHAR(8) NOT NULL DEFAULT '', |
52
|
|
|
pi_dirname VARCHAR(50) NOT NULL DEFAULT '', |
53
|
|
|
pi_file VARCHAR(50) NOT NULL DEFAULT '', |
54
|
|
|
pi_dotgif VARCHAR(255) NOT NULL DEFAULT '', |
55
|
|
|
pi_options VARCHAR(255) NOT NULL DEFAULT '', |
56
|
|
|
pi_enabled TINYINT NOT NULL DEFAULT 0, |
57
|
|
|
pi_weight SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0, |
58
|
|
|
last_modified TIMESTAMP , |
59
|
|
|
|
60
|
|
|
KEY (pi_weight), |
61
|
|
|
KEY (pi_type), |
62
|
|
|
KEY (pi_dirname), |
63
|
|
|
KEY (pi_file), |
64
|
|
|
KEY (pi_options), |
65
|
|
|
KEY (pi_enabled), |
66
|
|
|
PRIMARY KEY (pi_id) |
67
|
|
|
) ENGINE=MyISAM "); |
68
|
|
|
} |
69
|
|
|
// DROP TABLE xoops_apcal_plugins ; |
70
|
|
|
|
71
|
|
|
// 0.8RC to 0.8RC2 |
72
|
|
|
$result = $GLOBALS['xoopsDB']->query('SELECT pi_weight FROM ' . $GLOBALS['xoopsDB']->prefix("apcal{$mydirnumber}_plugins") . ' LIMIT 1'); |
73
|
|
|
if (!$result) { |
74
|
|
|
$GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix("apcal{$mydirnumber}_plugins") . ' ADD pi_weight SMALLINT(5) UNSIGNED NOT NULL DEFAULT 0, ADD KEY (pi_weight)'); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/* General part */ |
78
|
|
|
|
79
|
|
|
// Keep the values of block's options when module is updated (by nobunobu) |
80
|
|
|
include __DIR__ . '/updateblock.inc.php'; |
81
|
|
|
} |
82
|
|
|
|
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.