-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharticles.php
More file actions
99 lines (78 loc) · 3.46 KB
/
articles.php
File metadata and controls
99 lines (78 loc) · 3.46 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
<?php
include( 'includes/database.php' );
include( 'includes/config.php' );
include( 'includes/functions.php' );
secure();
include( 'includes/header.php' );
if( isset( $_GET['delete'] ) )
{
$query = 'DELETE FROM articles
WHERE id = '.$_GET['delete'].'
LIMIT 1';
mysqli_query( $connect, $query );
set_message( 'Article has been deleted' );
header( 'Location: articles.php' );
die();
}
$query = 'SELECT *
FROM articles ';
if(isset($_GET['filter']))
{
if($_GET['filter'] == 'home') $query .= 'WHERE home = "Yes" ';
else $query .= 'WHERE type = "'.strtolower($_GET['filter']).'" ';
}
$query .= 'ORDER BY date DESC';
$result = mysqli_query( $connect, $query );
include 'includes/wideimage/WideImage.php';
?>
<h2>Manage Articles<?php echo isset($_GET['filter']) ? ': '.ucfirst($_GET['filter']) : ''; ?></h2>
<p style="padding: 0 1%; text-align: center;">
<a href="/articles.php?filter=home"><?php echo icon('home'); ?> Home</a> |
<a href="/articles.php?filter=industry"><?php echo icon('industry'); ?> Industry Projects</a> |
<a href="/articles.php?filter=professional"><?php echo icon('professional'); ?> Professional Development</a> |
<a href="/articles.php?filter=research"><?php echo icon('research'); ?> Research and Publishings</a> |
<a href="/articles.php?filter=speaking"><?php echo icon('speaking'); ?> Speaking Engagements</a> |
<a href="/articles.php?filter=technology"><?php echo icon('technology'); ?> Technology</a> |
<a href="/articles.php?filter=tinkering"><?php echo icon('tinkering'); ?> Tinkering</a>
</p>
<table>
<tr>
<th></th>
<th align="center">ID</th>
<th align="left">Title</th>
<th align="center">Type</th>
<th align="center">Date</th>
<th></th>
<th></th>
<th></th>
</tr>
<?php while( $record = mysqli_fetch_assoc( $result ) ): ?>
<tr>
<td align="center">
<img src="image.php?type=article&id=<?php echo $record['id']; ?>&width=300&height=300&format=inside">
</td>
<td align="center"><?php echo $record['id']; ?></td>
<td align="left">
<?php echo htmlentities( $record['title'] ); ?>
<small><?php echo $record['content']; ?></small>
<?php echo ($record['home'] == 'Yes') ? icon('home') : ''; ?>
<?php echo ($record['photo']) ? '<i class="fas fa-camera"></i>' : ''; ?>
<?php echo ($record['instagramId']) ? '<i class="fab fa-instagram-square"></i>' : ''; ?>
<?php echo ($record['twitterId']) ? '<i class="fab fa-twitter-square"></i>' : ''; ?>
<?php echo ($record['soundcloudId']) ? '<i class="fab fa-soundcloud"></i>' : ''; ?>
<?php echo ($record['url']) ? '<i class="fas fa-link"></i>' : ''; ?>
</td>
<td align="center"><?php echo icon($record['type']); ?></td>
<td align="center" style="white-space: nowrap;"><?php echo htmlentities( $record['date'] ); ?></td>
<td align="center"><a href="articles_photo.php?id=<?php echo $record['id']; ?>"><i class="fas fa-camera"></i></a></td>
<td align="center"><a href="articles_edit.php?id=<?php echo $record['id']; ?>"><i class="fas fa-edit"></i></a></td>
<td align="center">
<a href="articles.php?delete=<?php echo $record['id']; ?>" onclick="javascript:confirm('Are you sure you want to delete this article?');"><i class="fas fa-trash-alt"></i></a>
</td>
</tr>
<?php endwhile; ?>
</table>
<p><a href="articles_add.php"><i class="fas fa-plus-square"></i> Add Article</a></p>
<?php
include( 'includes/footer.php' );
?>