-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost.php
More file actions
162 lines (119 loc) · 6.08 KB
/
post.php
File metadata and controls
162 lines (119 loc) · 6.08 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
<?php
include($_SERVER['DOCUMENT_ROOT'] . "/includes/inc-db-connection.php");
include($_SERVER['DOCUMENT_ROOT'] . "/includes/inc-functions.php");
include($_SERVER['DOCUMENT_ROOT'] . "/includes/inc-header.php");
?>
<main>
<?php
$postId = isset($_GET['postId']) ? $_GET['postId'] : '';
$update = isset($_GET['postId']) ? updatePostViews($_GET['postId']) : '';
$post = DB::getInstance()->selectValues("SELECT * FROM `posts` WHERE `post_id`='{$postId}'");
$categoryId = $post['post_category_id'];
$pagesArray = getAllPages();
$categoriesArray = getAllCategories();
$shortenersArray = getAllShorteners();
//print_r($shortenersArray);
?>
<div class="card breadcrumb-card">
<div class="card-body breadcrumb-body">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<?= urlFull(); ?>" class="home-link"><i class="fas fa-home"></i></a></li>
<li class="breadcrumb-item" aria-current="page"><?= seoFriendlyUrls($post['post_category_id'], getCategoryName($post['post_category_id']), true, false); ?></li>
<li class="breadcrumb-item active" aria-current="page"><?= $post['post_title']; ?></li>
</ol>
</nav>
</div>
</div>
<div class="row">
<!-- post -->
<div class="col-md-<?= getValue("hide_all_sidebars") == 0 ? "12" : "9"; ?>">
<div class="card" style="box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);">
<div class="card-header" style="font-family: 'Helvetica Neue', sans-serif; font-size: 16px; text-transform: uppercase; text-align: center; background-color: transparent; padding: 1rem;">
<small>
<i class="fas fa-pencil-alt"></i> Posted <strong><?= date("F j, Y", strtotime($post['post_date'])); ?></strong> by <strong><span class="text-success"><?= getPostersUsername($post['post_member_id']); ?></span></strong>.
</small>
<?php
if (checkUsersIpToEdit(getRealIp())) {
?>
<span class="float-end">
<a href="<?= urlFull(); ?>posts.php?delete=1&postId=<?= $post['post_id']; ?>" onClick="return confirm('Delete the post?')" class="btn btn-danger btn-sm" role="button" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Quick delete"><i class="far fa-trash-alt"></i></a>
<form action="<?php echo urlFull().'edit-post.php'; ?>" method="GET" style="display: inline;">
<input type="hidden" name="postId" value="<?php echo trim($postId); ?>">
<button type="submit" class="btn btn-warning btn-sm" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Quick edit"><i class="fas fa-edit"></i></button>
</form>
</span>
<?php } ?>
</div>
<div class="card-body">
<h1 style="font-family: 'Helvetica Neue', sans-serif; font-size: 24px;"><?= $post['post_title']; ?></h1>
<?php if (!empty($post['post_image'])) { ?>
<p class="text-center">
<?php list($imageUrl, $imageWidth, $imageHeight) = getFeaturedImageToUse($post['post_image']); ?>
<img class="img-thumbnail" src="<?= $imageUrl ?>" alt="<?= $post['post_image_alt_text']; ?>" width="<?= $imageWidth ?>" height="<?= $imageHeight ?>">
</p>
<?php } ?>
<div id="post-cta"><?= displayCTAImage($post['post_affiliate_url']); ?></div>
<div id="post-content"><?= generateTableOfContents($post['post_body'], $pagesArray, $categoriesArray, $post['post_image_alt_text'], $shortenersArray); ?></div>
<div id="post-cta"><?= displayCTAImage($post['post_affiliate_url']); ?></div>
<p style="font-size: 1.2em; text-align: center; font-family: 'Helvetica Neue', sans-serif;">Share this Article</p>
<p class="text-center">
<a href="https://twitter.com/intent/tweet?text=<?= $post['post_title']; ?>&url=<?= sharingSocialMediaUrls($post['post_id'], $post['post_title']); ?>" data-bs-toggle="tooltip" data-placement="bottom" title="Share on Twitter" target="_blank"><i class="fab fa-twitter fa-2x me-3" style="color: #55acee; transition: 0.3s;"></i></a>
<a href="https://www.facebook.com/sharer/sharer.php?u=<?= sharingSocialMediaUrls($post['post_id'], $post['post_title']); ?>&quote=Check this out!" data-bs-toggle="tooltip" data-placement="bottom" title="Share on Facebook" target="_blank"><i class="fab fa-facebook fa-2x me-3" style="color: #4267B2; transition: 0.3s;"></i></a>
</p>
<div id="post-content-videos">
<?php if (startsWith($post['post_source_url'], "[") == true) {
getSourceVideos($post['post_source_url']);
} else {
echo " ";
} ?>
</div>
<div id="post-content-source-urls">
<?php if (startsWith($post['post_source_url'], "[") == true) {
getSourceUrls($post['post_source_url']);
} else {
echo " ";
} ?>
</div>
</div>
<div class="card-footer text-muted" style="font-size: 14px; background-color: transparent;">
<small>
<i class="fas fa-pencil-alt"></i> Updated on: <strong><?= date("F j, Y", strtotime($post['post_date_updated'])); ?></strong>
<span class="float-end"><i class="fas fa-eye"></i> <?= $post['post_views']; ?></span>
</small>
</div>
</div>
</div>
<?php if (getValue("hide_all_sidebars") != 0) { ?>
<!-- categories / sidebars -->
<div class="col-md-3">
<?php
if (!empty(getValue("about_us_header")) && !empty(getValue("about_us_text"))) {
include($_SERVER['DOCUMENT_ROOT'] . "/includes/inc-about-us.php");
}
?>
<?php
include($_SERVER['DOCUMENT_ROOT'] . "/includes/inc-sidebar-recent-posts.php");
?>
<?php
if (getValue("homepage_show_categories")) {
include($_SERVER['DOCUMENT_ROOT'] . "/includes/inc-sidebar-categories.php");
}
?>
<?php
if (!empty(getValue("sidebar_cta_1_header")) && !empty(getValue("sidebar_cta_1_text"))) {
include($_SERVER['DOCUMENT_ROOT'] . "/includes/inc-sidebar-cta-1.php");
}
?>
<?php
if (!empty(getValue("sidebar_cta_2_header")) && !empty(getValue("sidebar_cta_2_text"))) {
include($_SERVER['DOCUMENT_ROOT'] . "/includes/inc-sidebar-cta-2.php");
}
?>
</div>
<?php } ?>
</div>
</main>
<?php
include($_SERVER['DOCUMENT_ROOT'] . "/includes/inc-footer.php");
?>