-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharticle_iphone-old.php
More file actions
357 lines (316 loc) · 10.1 KB
/
Copy patharticle_iphone-old.php
File metadata and controls
357 lines (316 loc) · 10.1 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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
<?php
include("dbconnect.php");
include("util.php");
include("getcurrentdate.php");
$date = mysql_real_escape_string($_GET['date']);
$section = mysql_real_escape_string($_GET['section']);
$priority = mysql_real_escape_string($_GET['id']);
$authorID = mysql_real_escape_string($_GET['authorid']);
$seriesID = mysql_real_escape_string($_GET['seriesid']);
$featureSection = mysql_real_escape_string($_GET['featuresection']);
if(strcmp($date, "") == 0)
$date = $currentDate;
if(strcmp($section, "") == 0)
$section = 1;
if(strcmp($priority, "") == 0)
$priority = 1;
include("issuequery.php");
include("template/functions.php");
// First update the 'read' count of this article.
// Check to make sure it's "ready", and that this actually qualifies as a view.
$commentQuery =
"SELECT
username,
email,
comment,
id,
comment_date,
realname
FROM
comment
WHERE
deleted='n' AND
article_date = '$date' AND
article_section = '$section' AND
article_priority = '$priority'
ORDER BY
id ASC
";
$comments = mysql_query($commentQuery);
$numComments = mysql_num_rows($comments);
$readyQuery =
"SELECT
issue.ready
FROM
article,
issue
WHERE
article.date = '$date' AND
article.section_id = '$section' AND
article.priority = '$priority' AND
issue.issue_date = article.date
";
if (mysql_result(mysql_query($readyQuery), 0, 'ready') == 'y') {
$countPage =
"UPDATE
article
SET
article.views = article.views + 1
WHERE
article.date = '$date'
AND article.section_id = '$section'
AND article.priority = '$priority'
";
mysql_query($countPage);
// Now add to Bowdoin views
if (strpos(gethostbyaddr($_SERVER['REMOTE_ADDR']), "bowdoin") !== false) {
$countPage =
"UPDATE
article
SET
bowdoin_views = bowdoin_views + 1
WHERE
date = '$date'
AND section_id = '$section'
AND priority = '$priority'
";
mysql_query($countPage);
}
}
// This grabs the information about the article. More queries to come.
$articleQuery =
"SELECT
s.name AS sectionname,
ar.priority,
ar.author1,
a1.name AS author1name,
a1.photo AS author1photo,
ar.author2,
a2.name AS author2name,
a2.photo AS author2photo,
ar.author3,
a3.name AS author3name,
a3.photo AS author3photo,
j.name AS jobname,
ar.title AS title,
ar.subhead,
ar.text,
at.id AS typenumber,
at.name AS type,
series.name AS series,
series.id AS series_id,
s.order_flag
FROM
section s,
article ar,
author a1,
author a2,
author a3,
job j,
articletype at,
series
WHERE
ar.author_job = j.id AND
ar.section_id = s.id AND
ar.author1 = a1.id AND
ar.author2 = a2.id AND
ar.author3 = a3.id AND
ar.type = at.id AND
ar.series = series.id AND
ar.date = '$date' AND
ar.section_id = '$section' AND
ar.priority = '$priority'
";
$result = mysql_query ($articleQuery);
if ($row = mysql_fetch_array($result)) {
$sectionName = $row["sectionname"];
$articleAuthor1 = $row["author1name"];
$articleAuthor2 = $row["author2name"];
$articleAuthor3 = $row["author3name"];
$articleAuthorID1 = $row["author1"];
$articleAuthorID2 = $row["author2"];
$articleAuthorID3 = $row["author3"];
$articleAuthorPhoto1 = $row["author1photo"];
$articleAuthorPhoto2 = $row["author2photo"];
$articleAuthorPhoto3 = $row["author3photo"];
$articleJob = $row["jobname"];
$articleTypeNumber = $row["typenumber"];
$articleType = $row["type"];
$articleSubhead = $row["subhead"];
$articleTitle = $row["title"];
$articleText = $row["text"];
$articleSeries = $row["series"];
$seriesID = $row["series_id"];
$orderFlag = $row["order_flag"];
} else {
header("Location: index.php");
exit;
}
$title = $articleTitle." - The Bowdoin Orient";
global $title, $volumeNumber, $issueNumber, $date, $section, $priority, $articleDate;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title><?php echo $title; ?></title>
<link rel="alternate" type="application/rss+xml" title="The Bowdoin Orient" href="http://orient.bowdoin.edu/orient/rss.php" />
<link rel="icon" type="image/vnd.microsoft.icon" href="favicon.ico" />
<!-- Framework CSS -->
<link rel="stylesheet" href="css/blueprint/screen.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="css/blueprint/print.css" type="text/css" media="print">
<!-- Import fancy-type plugin for the sample page. -->
<link rel="stylesheet" href="css/blueprint/plugins/fancy-type/screen.css" type="text/css" media="screen, projection">
<link rel='stylesheet' href='css/nyroModal.css' type='text/css' media='screen, projection'>
<link rel='stylesheet' href='css/lightbox.css' type='text/css' media='screen, projection'>
<link rel="stylesheet" href="css/orient.css" type="text/css" media="screen, projection">
<style>
.iphonewrapper {
width:300px;
padding:10px;
}
#comments {
width:300px;
padding:0;
padding-left:0;
margin:0;
}
.comment {
width:290px;
padding:5px;
margin:0;
}
.articletitle {
font-size:150%;
}
</style>
<script type='text/javascript' src='js/jquery.js'></script>
<script type="text/javascript" charset="utf-8">
function showComments() {
$("#view-comments").hide("normal");
$("#comments").show("fast");
}
function submitComment() {
username = $("#username").val();
password = $("#password").val();
comment = $("#comment").val();
var url = "ajaxaddcomment.php";
var ardate = '<?php echo $date; ?>';
var section = '<?php echo $section; ?>';
var priority = '<?php echo $priority; ?>';
var data = {
"username": username,
"password": password,
"comment": comment,
"id": priority,
"section": section,
"date": ardate
};
$.post(url, data, commentSubmitted, "text");
showComments();
}
function commentSubmitted(data) {
if (data.substring(0, 9) == "Success: ") {
// If they've done more than one comment, remove the 'edit' link on the older one, and make it normal.
/*
if ($("#new-comment")) {
$("#new-comment").removeClass('newcomment').attr("id","");
$("#editlink").text("Report").attr("onclick",'reportComment(this); return false;');
}
*/
var numbers = data.substring(9);
commentID = numbers.substring(0,numbers.indexOf(","));
commentSecret = numbers.substring(numbers.indexOf(",") + 1);
var commentDiv = document.createElement("div");
commentDiv.setAttribute("class", "comment hide newcomment");
commentDiv.setAttribute("id", "new-comment");
commentDiv.setAttribute("commentid", commentID);
commentDiv.setAttribute("secret", commentSecret);
var user = "<p class='bottom'>" + username + "<\/p>";
user = "<p class='bottom edit'><strong>" + username + "<\/strong> (just now)<\/p>";
var content = "<p class='bottom edit_area'>" + comment + "<\/p>";
// "<span class='edit-text'><br />Double-click to edit text<\/span><\/p>";
commentDiv.innerHTML = user + content;
hideError();
$("#nocomments").hide("fast");
$("#comments").append(commentDiv);
$("#new-comment").show("normal");
$("#comment").val("");
editable();
} else {
$("#comment-error").text(data);
$("#comment-error").show("normal");
}
}
function hideError() {
$("#comment-error").hide("normal");
}
</script>
</head>
<body style="background-color:#FFFFFF; background-image:none;">
<div class="iphonewrapper">
<h3 class='bottom'><?php echo $articleType; ?></h3>
<?php
// If it's part of a series, link to the entire series.
if ($articleSeries) { ?>
<p style="margin:0"><?php echo strtoupper($articleSeries); ?></p>
<?php } ?>
<h2 class='top bottom' style="margin:0 0 5px 0;"><strong><?php echo $articleTitle; ?></strong></h2>
<?php if ($articleSubhead) {
echo "<h2 class='top bottom' style='font-size:150%'>" . $articleSubhead . "</h2><br/>";
}
?>
<div class='articleauthor'><?php echo strip_tags(authorsLinks($articleAuthor1, $articleAuthor2, $articleAuthor3, $articleAuthorID1, $articleAuthorID2, $articleAuthorID3, $articleJob), '<p><div>'); ?></div>
<div class='articletext'>
<?php
// Displays photos / documents / embeddables.
// echoMedia($date, $section, $priority);
?>
<?php echoMobilePhoto($date, $section, $priority); ?>
<?php echo strip_tags($articleText, '<p><b><i><u><strong><em>'); ?>
<div class='comments-div'>
<hr />
<a name='comments'></a>
<h3>Comments</h3>
<?php if ($numComments == 0) { ?>
<div id='nocomments'>There are no comments for this article yet.</div>
<?php } else { ?>
<div id='comment-disclaimer'>
Please note that comments do not in any way reflect the opinion of <em>The Orient</em>, nor of Bowdoin College.
<br />
<a href='#' id='view-comments' onclick='showComments(); return false;'>Click here to view all comments (<?php echo $numComments; ?>)</a>
<br />
</div>
<?php } ?>
<div id='comments'>
<?php
$counter = 0;
while ($row = mysql_fetch_array($comments)) {
$counter = $counter % 2;
echo "<div class='comment comment$counter' commentid='" . $row['id'] . "'>";
echo "<p class='bottom edit'>";
echo "<strong>".$row['realname']."</strong>";
$commentDate = strtotime($row['comment_date']);
echo "<span class='commentdate'>" . date(" (M j, Y, g:i a)", $commentDate) . "</span>";
echo "</p>";
echo "<div class='bottom edit_area'><p>" . stripslashes(implode("</p><p>", explode("\n", $row['comment']))) . "</p></div>";
echo "</div>";
spacer();
$counter++;
}
?>
</div>
<?php spacer(); ?>
<p id='comment-error' class='error'></p>
<p id='comment-success' class='success'></p>
<label>Username: <input type='text' name='username' id='username'/></label><br/>
<label>Password: <input type='password' name='password' id='password'/></label><br/>
<label><textarea name='comment' id='comment' style="width: 290px"></textarea></label>
<button id='submitComment' onclick='submitComment();'>Submit</button>
</div>
</div>
</div>
<?php
include("template/bottom.php");
?>