1 | <?php |
||
2 | |||
3 | /** |
||
4 | * Module: WF-Links |
||
5 | * Version: v1.0.3 |
||
6 | * Release Date: 21 June 2005 |
||
7 | * Developer: John N |
||
8 | * Team: WF-Projects |
||
9 | * Licence: GNU |
||
10 | */ |
||
11 | require_once __DIR__ . '/header.php'; |
||
12 | |||
13 | define('IS_UPDATE_FILE', true); |
||
14 | |||
15 | global $xoopsDB, $xoopsConfig, $xoopsUser, $xoopsModule; |
||
16 | if (!is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->getVar('mid'))) { |
||
17 | exit('Access Denied'); |
||
18 | } |
||
19 | require XOOPS_ROOT_PATH . '/header.php'; |
||
20 | |||
21 | function install_header() |
||
22 | { |
||
23 | ?> |
||
24 | <!DOCTYPE HTML> |
||
25 | <html> |
||
26 | <head> |
||
27 | <title>WF-Links Upgrade</title> |
||
28 | <meta http-equiv="Content-Type" content="text/html; charset="> |
||
29 | </head> |
||
30 | <body> |
||
31 | <br><div style="text-align:center;"><img src="./assets/images/logo-en.gif" alt=""><h4>WF-Links Update</h4> |
||
32 | <?php |
||
33 | } |
||
34 | |||
35 | function install_footer() |
||
36 | { |
||
37 | ?> |
||
38 | <img src="assets/images/wfl_slogo.gif" alt="WF-Projects" border="0"></div> |
||
39 | </body> |
||
40 | </html> |
||
41 | <?php |
||
42 | } |
||
43 | |||
44 | // echo "Welcome to the WF-Links update script"; |
||
45 | foreach ($_POST as $k => $v) { |
||
46 | ${$k} = $v; |
||
47 | } |
||
48 | |||
49 | foreach ($_GET as $k => $v) { |
||
50 | ${$k} = $v; |
||
51 | } |
||
52 | |||
53 | if (!isset($action) || '' === $action) { |
||
54 | $action = 'message'; |
||
55 | } |
||
56 | |||
57 | if ('message' === $action) { |
||
58 | install_header(); |
||
59 | /** @var \XoopsModuleHandler $moduleHandler */ |
||
60 | $moduleHandler = xoops_getHandler('module'); |
||
61 | $mylinks = $moduleHandler->getByDirname('mylinks'); |
||
62 | if ($mylinks) { |
||
63 | $mylinks_version = round($mylinks->getVar('version') / 100, 2); |
||
64 | } |
||
65 | |||
66 | $moduleHandler = xoops_getHandler('module'); |
||
67 | $weblinks = $moduleHandler->getByDirname('weblinks'); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
68 | if ($weblinks) { |
||
69 | $weblinks_version = round($weblinks->getVar('version') / 100, 2); |
||
70 | } |
||
71 | |||
72 | $act_wflinks = $moduleHandler->getByDirname('wflinks'); |
||
73 | if ($act_wflinks) { |
||
74 | $act_wflinks_version = $act_wflinks->getInfo('version'); |
||
75 | } |
||
76 | |||
77 | echo $act_wflinks_version; |
||
78 | |||
79 | /** |
||
80 | * Set version number |
||
81 | */ |
||
82 | |||
83 | if (1.0 == $act_wflinks_version && !$mylinks_version && !$weblinks_version) { |
||
84 | echo '<h4>Latest version of WF-Links installed. No Update Required</h4>'; |
||
85 | install_footer(); |
||
86 | require XOOPS_ROOT_PATH . '/footer.php'; |
||
87 | exit(); |
||
88 | } |
||
89 | |||
90 | $link_num = 0; |
||
91 | if (isset($mylinks_version)) { |
||
92 | $link_num = $mylinks_version; |
||
93 | } |
||
94 | |||
95 | if (isset($weblinks_version)) { |
||
96 | $link_num = $weblinks_version; |
||
97 | } |
||
98 | |||
99 | if (isset($wflinks_version) && 1.0 != $act_wflinks_version) { |
||
100 | $link_num = $wflinks_version; |
||
101 | } |
||
102 | |||
103 | echo '<div><b>Welcome to the WF-Links Update script</b></div><br>'; |
||
104 | echo '<div>This script will upgrade My-links or weblinks.</div><br><br>'; |
||
105 | |||
106 | if (0 != $link_num) { |
||
107 | echo "<div><span style='color:#ff0000;font-weight:bold;'>WARNING: If upgrading from My links or weblinks. The My links Module or weblinks Module will **NOT** function after the upgrade and should be unistalled. </span></div><br>"; |
||
108 | echo '<div><b>Before upgrading WF-Links, make sure that you have:</b></div><br>'; |
||
109 | echo "<div><span style='color:#ff0000; '>1. <b>Important:</b> First, create a back-up from your database before proceeding further. </span></div>"; |
||
110 | echo '<div>2. Upload all the contents of the WF-Links package to your server.</div><br>'; |
||
111 | echo '<div>3. After the upgrade you must update WF-Links in System Admin -> Modules.</div><br>'; |
||
112 | |||
113 | echo '<div><b>Press the button below to '; |
||
114 | switch ($link_num) { |
||
115 | case '1.0.1': |
||
116 | case '1.10': |
||
117 | case '1.1': |
||
118 | echo "update My links $link_num</b></div>"; |
||
119 | break; |
||
120 | case '0.93': |
||
121 | echo "update weblinks $link_num</b></div>"; |
||
122 | break; |
||
123 | } |
||
124 | |||
125 | echo "<form action='" . $_SERVER['SCRIPT_NAME'] . "' method='post'>"; |
||
126 | echo $GLOBALS['xoopsSecurity']->getTokenHTML(); |
||
127 | echo "<input type='submit' value='Start Upgrade'> |
||
128 | <input type='hidden' value='upgrade' name='action'> |
||
129 | <input type='hidden' name='link_num' value=$link_num> |
||
130 | </form>"; |
||
131 | } else { |
||
132 | echo '<h4>No module installed to update</h4>'; |
||
133 | } |
||
134 | |||
135 | install_footer(); |
||
136 | require XOOPS_ROOT_PATH . '/footer.php'; |
||
137 | exit(); |
||
138 | } |
||
139 | // THIS IS THE UPDATE DATABASE FROM HERE!!!!!!!!! DO NOT TOUCH THIS!!!!!!!! |
||
140 | if ('upgrade' === $action) { |
||
141 | install_header(); |
||
142 | |||
143 | $num = $_POST['link_num']; |
||
144 | switch ($num) { |
||
145 | case '1.0.1': |
||
146 | case '1.10': |
||
147 | case '1.1': |
||
148 | echo "Updating Mylinks $num"; |
||
149 | require_once __DIR__ . '/update/mylinks_update.php'; |
||
150 | break; |
||
151 | case '0.93': |
||
152 | echo "Updating weblinks $num"; |
||
153 | require_once __DIR__ . '/update/weblinks_update.php'; |
||
154 | break; |
||
155 | case '0': |
||
156 | default: |
||
157 | echo "Version: $num not supported yet. Please contact the developers of this module"; |
||
158 | break; |
||
159 | } |
||
160 | echo 'To complete the upgrade, You must update WF-Links in Xoops System Admin -> Modules'; |
||
161 | echo 'Please enjoy using WF-Links, the WF-Project Team'; |
||
162 | require XOOPS_ROOT_PATH . '/footer.php'; |
||
163 | } |
||
164 |