-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupgrade.php
More file actions
321 lines (294 loc) · 8.72 KB
/
upgrade.php
File metadata and controls
321 lines (294 loc) · 8.72 KB
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
<?php
/*
+ ----------------------------------------------------------------------------+
| PHPDirector.
| $License: GPL General Public License
| $Website: phpdirector.co.uk
| $Author: Ben Swanson
+----------------------------------------------------------------------------+
*/?>
<html>
<head>
<style>
html, body {
background:#BFE4FF;
font-family:"Trebuchet MS",Helvetica,Arial,sans-serif;
font-size:12px;
height:100%;
left:0pt;
margin:0pt;
min-width:700px;
padding:0pt;
position:absolute;
top:0pt;
width:100%;
}
a {
color:#333333;
}
a:hover {
text-decoration:none;
}
h1, h2, h3, h4, h5, h6 {
margin: 0 0 0 0;
padding:0pt;
}
img {
border:0px none;
}
.hidden {
display:none;
}
.right {
clear:none;
float:right;
}
.left {
clear:none;
float:left;
}
#license_agreement{
text-align:center;
}
#install-header {
margin: auto auto auto -10px;
background:#00487D;
border-bottom:8px solid #0066B3;
color:#FFFFFF;
height:60px;
vertical-align:top;
}
#install-header h1 {
font-family:"Trebuchet MS",Helvetica,Arial,sans-serif;
font-size:30px;
font-weight:bold;
padding-left:14px;
padding-top:14px;
vertical-align:top;
width:auto;
}
#install-progress {
background:#80C9FF none repeat scroll 0%;
clear:both;
color:#00487D;
float:left;
height:40px;
list-style-image:none;
list-style-position:outside;
list-style-type:none;
margin:0pt 0pt 0pt 0px;
padding:0px;
width:100%;
}
#install-progress li a {
float:left;
position:relative;
color:#FFFFFF;
display:block;
float:left;
font-weight:bold;
height:20px;
margin:5px 2px;
padding:7px 15px 3px;
text-decoration:none;
vertical-align:middle;
}
#install-progress li.selected a {
background:#0066B3 none repeat scroll 0%;
}
form {
margin-bottom:20px;
}
form div {
margin:auto;
padding:5px;
text-align:left;
width:400px;
}
form div input, form div textarea, form div select {
border:1px solid #AAAAAA;
font-family:"Trebuchet MS",Helvetica,Arial,sans-serif;
font-size:12px;
margin-top:2px;
padding:4px;
width:390px;
}
form div select {
width:100%;
}
form div input.submit {
height:30px;
width:200px;
}
</style>
<title>PHPDirector Install Wizard</title>
</head>
<body>
<ul ID="install-header">
<h1>Php Director Upgrade </h1>
</ul>
<ul ID="install-progress"><li><a HREF="#">Upgrade/Install</a></li><li <?php if ($_POST["Installing"] == "License"){echo "class='selected'";}?>><a HREF="#">License Agreement</a></li>
<li <?php if ($_POST["Installing"] == "Upgrade"){echo "class='selected'";}?>><a HREF="#">Upgrade Mysql </a></li>
</ul>
<div align="center">
<?php
function Install(){
define("PHPdirector", 1);
require("db.php");
$confresult = mysql_query("SELECT * FROM pp_config");
$row1 = mysql_fetch_array($confresult);
if($row1["version"] == "0.1"){
echo'Welcome Php Director Upgrader<br />
<form action="upgrade.php" method="POST"><div>
<input type="hidden" value="License" name="Installing">
<input type="submit" value="Upgrade"></div>
</form></p>
';
}else{
echo "Wrong Version";
}
}
function License(){
echo'
<br /><br />
<!-- Creative Commons License --><br /><br /><br /><br />
<a href="http://creativecommons.org/licenses/GPL/2.0/">
<img alt="CC-GNU GPL" border="0" src="http://creativecommons.org/images
/public/cc-GPL-a.png" /></a><br />
This software is licensed under the <a href="http://creativecommons.org/licenses/GPL/2.0/">CC-GNU GPL</a>.
<!-- /Creative Commons License -->
<!--
<rdf:RDF xmlns="http://web.resource.org/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Work rdf:about="">
<license rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
<dc:type rdf:resource="http://purl.org/dc/dcmitype/Software" />
</Work>
<License rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
<permits rdf:resource="http://web.resource.org/cc/Reproduction" />
<permits rdf:resource="http://web.resource.org/cc/Distribution" />
<requires rdf:resource="http://web.resource.org/cc/Notice" />
<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<requires rdf:resource="http://web.resource.org/cc/ShareAlike" />
<requires rdf:resource="http://web.resource.org/cc/SourceCode" />
</License>
</rdf:RDF>
-->
<br /><br /><br /><br /><br /><br />
Cliking this will also start the upgrade process
<form ACTION="upgrade.php" METHOD="POST"><div>
<input type="hidden" value="Upgrade" name="Installing">
<input TYPE="submit" VALUE="I hearby have read and agreed to the License">
</form>
';
}
function Upgrade(){
define("PHPdirector", 1);
require("db.php");
//CONFIG
mysql_query("ALTER TABLE `pp_config` DROP `exerntalheader");
mysql_query("ALTER TABLE `pp_config` DROP `externalheaderurl`");
mysql_query("ALTER TABLE `pp_config` DROP `header_height`");
mysql_query("ALTER TABLE `pp_config` DROP DROP `cssstyle`");
mysql_query("ALTER TABLE `pp_config` DROP `logo`");
mysql_query("ALTER TABLE `pp_config` ADD `news` VARCHAR(255) NOT NULL");
mysql_query("ALTER TABLE `pp_config` ADD `news` VARCHAR(255) NOT NULL");
mysql_query("ALTER TABLE `pp_config` ADD `template` VARCHAR(255) NOT NULL");
mysql_query("UPDATE `pp_config` SET `version` = '0.2'");
mysql_query("UPDATE `pp_config` SET `template` = 'Photine'");
mysql_query("UPDATE `pp_config` SET `lang` = 'en-gb.inc.php'");
//Files
mysql_query("ALTER TABLE `pp_files` CHANGE `category` `category` VARCHAR( 255 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '0'");
mysql_query("ALTER TABLE `pp_files` ADD `file2` VARCHAR(255) NOT NULL");
mysql_query("ALTER TABLE `pp_files` ADD `video_type` VARCHAR(255) NOT NULL");
//Categories
mysql_query("CREATE TABLE `pp_categories` (
`id` int(225) NOT NULL auto_increment,
`name` varchar(225) NOT NULL,
`disable` varchar(2) NOT NULL default '0',
`image` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
)");
$filename = 'config.php';
$somecontent = '
<?php
/*
+ ----------------------------------------------------------------------------+
| PHPDirector Config File
| $License: GPL General Public License
| $Website: phpdirector.co.uk
| $Author: Ben Swanson
+----------------------------------------------------------------------------+
*/
$cfg["db_host"] = "'.$cfg[db_host].'";
$cfg["db_name"] = "'.$cfg[db_name].'";
$cfg["db_user"] = "'.$cfg[db_user].'";
$cfg["db_pass"] = "'.$cfg[db_pass].'";
$cfg["admin_user"] = "'.$cfg[admin_user].'";
$cfg["admin_pass"] = "'.$cfg[admin_pass].'";
?>';
if (is_writable($filename)) {
if (!$handle = fopen($filename, 'w')) {
echo "Cannot write to file please change permissions";
exit;
}
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file please change permissions";
exit;
}
echo "Config.php updated\n";
fclose($handle);
} else {
echo "Cannot write to file please change permissions";
}
$confresult = mysql_query("SELECT * FROM pp_config");
$row1 = mysql_fetch_array($confresult);
if($row1[template] == "Photine"){
echo"<br />Success<br /><b>VERY IMPORTANT-</b> Must delete upgrade.php and install director if there<br /><a href='../'>Goto Site</a>";
}else{
echo"<br />Failed -mysql conumications- Please see phpdirector forums <br /> <a href='../'>Check Anyway?</a>";
}
}
if(isset($_POST["Installing"])){
$installing = $_POST["Installing"];
if($installing == "License"){
License();
}
if($installing == "Upgrade"){
Upgrade();
}
}else{
if(isset($_GET["connect"])){
echo"Could not connect";
Connections();
}else{
Install();
}
}
?><br /><br />
<a HREF="http://www.phpdirector.co.uk/">Powered by PHP Director 0.2</a> | PHPDIRECTOR © 2007, Ben Swanson
<br />
<!-- Creative Commons License -->
This software is licensed under the <a HREF="http://creativecommons.org/licenses/GPL/2.0/">CC-GNU GPL</a>.
<!-- /Creative Commons License -->
<!--
<rdf:RDF xmlns="http://web.resource.org/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Work rdf:about="">
<license rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
<dc:type rdf:resource="http://purl.org/dc/dcmitype/Software" />
</Work>
<License rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
<permits rdf:resource="http://web.resource.org/cc/Reproduction" />
<permits rdf:resource="http://web.resource.org/cc/Distribution" />
<requires rdf:resource="http://web.resource.org/cc/Notice" />
<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<requires rdf:resource="http://web.resource.org/cc/ShareAlike" />
<requires rdf:resource="http://web.resource.org/cc/SourceCode" />
</License>
</rdf:RDF>
-->
</body>
</html>