-
Notifications
You must be signed in to change notification settings - Fork 0
/
article.php
118 lines (104 loc) · 4.83 KB
/
article.php
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
<?php include $_SERVER['DOCUMENT_ROOT'].'/scripts/startScript.php';
$sql='SELECT * FROM articles WHERE shortName = ? LIMIT 1';
$shortName = $_GET['name'];
/* Prepare statement */
$stmt = $db->prepare($sql);
if($stmt === false) {
trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $db->error, E_USER_ERROR);
}
/* Bind parameters. TYpes: s = string, i = integer, d = double, b = blob */
$stmt->bind_param('s',$shortName);
/* Execute statement */
$stmt->execute();
$stmt->bind_result($id, $shortName, $fullName, $tags, $content, $description, $creationUser, $timeStamp, $editUser, $editTimeStamp, $enabled);
while ($stmt->fetch()) {
$title = $fullName;
}
include $_SERVER['DOCUMENT_ROOT'].'/header.php';
?>
<div id='clearMain' class='clearBox'>
<div id='contentArea' class='insetBox fullContent'>
<?php if ($admin==1 && $clientView != 1) { ?>
<div class='contentEdit'>
<a href='/editBlog.php?action=edit&id=<?php echo $id; ?>'><img src='/img/editBtn.png' alt='edit button' /></a>
<a class='deleteButton' href='/deleteBlog.php?id=<?php echo $id; ?>'><img src='/img/deleteBtn.png' alt='edit button' /></a>
</div>
<?php } ?>
<h1><?php echo $fullName; ?></h1>
<article>
<div class='date'>
<?php echo date('j.n.Y',$timeStamp); ?>
</div>
<div class='details fullDetails'>
<div class='articleContent'>
<?php echo $content; ?>
</div>
<div class='muted inArticleMute'>-<?php echo $creationUser; ?></div>
</div>
</article>
</div>
<!--<div class='specialProject insetBox'>
<h3>Latest Projects</h3>
<?php
$sql='SELECT * FROM projects LIMIT 8';
/* Prepare statement */
$stmt = $db->prepare($sql);
if($stmt === false) {
trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $db->error, E_USER_ERROR);
}
/* Execute statement */
$stmt->execute();
$stmt->bind_result($id, $shortName, $fullName, $tags, $content, $creationUser, $timeStamp, $editUser, $editTimeStamp, $thumbnail);
while ($stmt->fetch()) {
?>
<div class='specialProjectBox clearBox'>
<a href='/project/<?php echo $shortName; ?>' class='sideProjectLink'>
<img src='<?php echo $thumbnail; ?>' alt='<?php echo $fullName; ?>' class='projectThumb' />
<div class='projectName'><?php echo $fullName; ?></div>
<div class='projectTags'><?php echo $tags; ?></div>
</a>
</div>
<?php }
?>
</div> -->
</div>
</div>
<?php include 'footer.php'; ?>
<script>
if ($(window).width() > 900) {
parseAndFill('proceduralArea','leftSide','rightSide','middleArea');
} else {
$('#proceduralArea').css('background','url(../img/mobileBg.png) center bottom');
}
$('.deleteButton').on('click touch', function() {
var object = $(this).parent().parent();;
if (confirm('Are you sure?')) {
$.ajax({
type: "POST",
url: $(this).attr('href'),
dataType: "JSON",
data: {
'type': 'booper',
},
success: function(html)
{
if(html['status'] == 'Success')
{
console.log(object.remove());
}else
{
console.log(html['status']);
}
},
error: function (xhr, ajaxOptions, thrownError) {
emailAjaxCheck = 0;
console.log('Error! ' + ajaxOptions + ' - ' + thrownError);
console.log(xhr);
}
});
return false;
}
});
</script>
</body>
</html>