~swishcms/swishcontent/swishcontent

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
<?php

/*
    This file is part of SwishCONTENT.

    SwishCONTENT is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License v2 as published by
    the Free Software Foundation.

    SwishCONTENT is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with SwishCONTENT; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

	function doit() {
		dbconnect();

		$query1 = "ALTER TABLE `content_pages` ADD `catid` int(11) DEFAULT '1' NOT NULL;";
		$query1a = "ALTER TABLE `content_pages` ADD `password` VARCHAR(75) NOT NULL;";

		$query2 = "ALTER TABLE `content_settings` ADD `version` VARCHAR(5) DEFAULT '1.5' NOT NULL;";

		$result = mysql_query($query1);

		if(!$result) {
			echo("Upgrade Failed! (1) Details: ".mysql_error()."");
			return 0;
		}

		$result = mysql_query($query1a);

		if(!$result) {
			echo("Upgrade Failed! (1a) Details: ".mysql_error()."");
			return 0;
		}

		$result = mysql_query($query2);

		if(!$result) {
			echo("Upgrade Failed! (2) Details: ".mysql_error()."");
			return 0;
		}
		
		$query3a = "CREATE TABLE IF NOT EXISTS `content_categories` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(50) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;";
		$query3b = "INSERT INTO `content_categories` VALUES (1, 'Uncategorized');";

		$result = mysql_query($query3a);

		if(!$result) {
			echo("Upgrade Failed! (3a) Details: ".mysql_error()."");
			return 0;
		}
		
		$result = mysql_query($query3b);

		if(!$result) {
			echo("Upgrade Failed! (3b) Details: ".mysql_error()."");
			return 0;
		}

		dbdisconnect();

		echo('Done! <br /><br /><form name="input" action="upgrade.php" method="post"><input type="hidden" name="page" value="page2"><input type="submit" value="Next"></form>');
	}
	
	function tplupdate() {
		dbconnect();
		
		$header = mysql_real_escape_string('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<!--[if lt IE 7.]>
<script defer type="text/javascript" src="pngfix.js"></script>
<![endif]-->
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="content-type">
  <title>SwishCONTENT</title>
  <style type="text/css">

body {
	font-family: Arial, Helvetica, sans-serif;
	margin: 0px;
}

#header {
	background-image: url("images/logograd.png");
	background-color: #CCCCCC;
	height: 70px;
}

/* Where the home/page index/search buttons are */
#buttonbox {
	display: inline;
	top: 15px;
	right: 15px;
	position: absolute;
	font-size: xx-large;
	font-weight: bold;
	color: #ffffff;
}

#content {
	padding: 5px;
	background-image: url("images/headbkg.png");
	background-position: top;
	background-repeat: repeat-x;
	color: #000000;
}

#footer {
	padding: 5px;
	background-image: url("images/footbkg.png");
	background-position: top;
	background-repeat: repeat-x;
	font-size: 12px;
	color: #666666;
}

/* Box containing logo */
#logobox {
	background: #ffffff;
	height: 70px;
	width: 180px;
}

/* Curve next to logo */
#curve {
	background-image: url("images/curve.png");
	background-repeat: no-repeat;
	height: 70px;
	width: 40px;
	position: absolute;
	left: 180px;
	top: 0px;
}

/* The logo itself */
.logo {
	padding: 5px;
	left: 4px;
	position: absolute;
}

/* Button on the buttonbar */
.button {
	background-color: #FFFFFF;
	border: 1px solid #666666;
	padding: 5px;
}

/* An image on a button */
.button img {
	border: 0;
}

a {
	text-decoration: none;
}

input, textarea {
	border: 1px solid gray;
}
.code {
	border: 1px dashed gray;
	padding: 2px;
	background-color: rgb(255, 255, 204);
	font-family: "Courier New",Courier,monospace;
	font-size: larger;
}

/* Nicer header part for a table */
th {
	text-align: left;
	border-bottom: 1px solid gray;
	background-color: #eeeeee;
}

/* Table style used on search and page index */
table.form {
	border: 1px solid gray;
}


/* Table style used on page index - tinted row for a category */
td.hrow {
	border-top: 1px solid gray;
	border-bottom: 1px solid gray;
	background-color: #e8e8f8;
}

/* Highlighted row for every second item on page list */
.row1 {
	background-color: #f0f0ff;
}
  </style>
</head>
<body>
<div id="header"><div id="curve"> </div><div id="logobox"><a href="index.php"><img
 src="images/logo.png" alt="SwishCONTENT" border="0" class="logo"></a></div></div>
<div id="buttonbox">
<a href="index.php"><img src="images/house.png"
 alt="Home" border="0" class="button"></a> <a
 href="index.php?tool=index"><img src="images/page.png"
 alt="Index" border="0" class="button"></a> <a
 href="index.php?tool=search"><img src="images/search32.png"
 alt="Search" border="0" class="button"></a>
</div>
<div id="content">');
// Phew!

		$footer = mysql_real_escape_string('</div>
<div id="footer"><br />&copy; 2008 SwishCMS Development Team - <a href="http://swishcms.exclaim-project.org">SwishCMS Homepage</a> - <a href="http://validator.w3.org/check?uri=referer"> Valid HTML</a></div>
<br />
</body>
</html>');

		$query = "UPDATE `content_template` SET `header` = '".$header."', `footer` = '".$footer."' LIMIT 1";
	
		$result = mysql_query($query);
		
		if(!$result) {
			echo("Upgrade failed! Details: ".mysql_error()."");
			return;
		}
		
		dbdisconnect();

		echo('Done! <br /><br /><form name="input" action="upgrade.php" method="post"><input type="hidden" name="page" value="page2"><input type="submit" value="Next"></form>');
	}
		
?>