This repository has been archived by the owner on Mar 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
list.php
367 lines (347 loc) · 23.3 KB
/
list.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
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
358
359
360
361
362
363
364
365
366
367
<?php
$PAGE_TITLE = 'Anime';
require_once("./settings/config.php");
require_once("./settings/header_footer.php");
$anime = filter_input(INPUT_GET, 'anime', FILTER_SANITIZE_STRING);
$provider = filter_input(INPUT_GET, 'u', FILTER_SANITIZE_STRING);
$anime = str_replace('.php', '', $anime);
$q2 = $PDOConn->prepare("SELECT * FROM ao_index WHERE title = :anime LIMIT 1");
$q2->bindParam(':anime', $anime, PDO::PARAM_STR);
$q2->execute();
$a2 = $q2->fetch(PDO::FETCH_ASSOC);
$animeId = $a2['id'];
if ($q2->rowCount() <= 0) {
header('location: '.$site_link);
exit;
}
$anime_name = $a2["text_title"];
$icon = $a2["icon"];
$eps = $a2["episodes"];
$desc = $a2["description"];
$tags = $a2["tags"];
$translation = $a2["translation"];
$link = $a2["link"];
$released = $a2["released"];
if($translation == "raw") $translation = "(Raw)";
elseif($translation == "dubbed") $translation = "(Dubbed)";
elseif($translation == "subbed") $translation = "(Subbed)";
else $translation = "(Not specified)";
$user = $loggedUser["username"] ?? '';
$userIs = $loggedUser["id"] ?? 0;
$function = filter_input(INPUT_GET, 'f', FILTER_SANITIZE_STRING);
$f_anime = filter_input(INPUT_GET, 'a', FILTER_SANITIZE_STRING);
$f_episode = filter_input(INPUT_GET, 'e', FILTER_SANITIZE_STRING);
if ($userIs > 0) {
$createComment = filter_input(INPUT_POST, 'sendComment', FILTER_UNSAFE_RAW);
if (isset($createComment)) {
$commentMessage = filter_input(INPUT_POST, 'msg', FILTER_SANITIZE_STRING);
$reply = filter_input(INPUT_POST, 'reply', FILTER_VALIDATE_INT);
if (!isset($reply))
$reply = 0;
$commentMessage = trim($commentMessage);
$postComment = $PDOConn->prepare(
"INSERT INTO `comments` (`user`, `reply`, `anime`, `episode`, `message`) VALUES (:usr, :reply, :anm, '0', :msg)");
$postComment->bindParam('usr', $userIs, PDO::PARAM_INT);
$postComment->bindParam('reply', $reply, PDO::PARAM_INT);
$postComment->bindParam('anm', $animeId, PDO::PARAM_INT);
$postComment->bindParam('msg', $commentMessage, PDO::PARAM_STR);
$postComment->execute();
header('location: '.$site_link.'/anime/'.$anime);
exit;
}
$cm = filter_input(INPUT_GET, 'cm', FILTER_VALIDATE_INT);
$rt = filter_input(INPUT_GET, 'rt', FILTER_VALIDATE_INT);
$del = filter_input(INPUT_GET, 'del', FILTER_VALIDATE_INT);
if (isset($cm, $rt)) {
$checkCommentInfo = $PDOConn->prepare("SELECT * FROM `comments` WHERE `id`=:cid AND `user`=:us");
$checkCommentInfo->bindParam('cid', $cm, PDO::PARAM_INT);
$checkCommentInfo->bindParam('us', $userIs, PDO::PARAM_INT);
$checkCommentInfo->execute();
if ($checkCommentInfo->rowCount() == 0) {
$checkComment = $PDOConn->prepare('SELECT * FROM `comments_rate` WHERE `comm_id`=:cid AND `user_id`=:uid');
$checkComment->bindParam('cid', $cm, PDO::PARAM_INT);
$checkComment->bindParam('uid', $userIs, PDO::PARAM_INT);
$checkComment->execute();
if ($checkComment->rowCount() > 0) {
$upCheck = $PDOConn->prepare('UPDATE `comments_rate` SET `rate`=:rt WHERE `comm_id`=:cid AND `user_id`=:uid');
$upCheck->bindParam('rt', $rt, PDO::PARAM_INT);
$upCheck->bindParam('cid', $cm, PDO::PARAM_INT);
$upCheck->bindParam('uid', $userIs, PDO::PARAM_INT);
$upCheck->execute();
} else {
$inCheck = $PDOConn->prepare('INSERT INTO `comments_rate` (`comm_id`, `user_id`, `rate`) VALUES (:cid, :uid, :rt)');
$inCheck->bindParam('rt', $rt, PDO::PARAM_INT);
$inCheck->bindParam('cid', $cm, PDO::PARAM_INT);
$inCheck->bindParam('uid', $userIs, PDO::PARAM_INT);
$inCheck->execute();
}
}
header('location: '.$site_link.'/anime/'.$anime);
exit;
}
if (isset($cm, $del)) {
$checkCommentInfo = $PDOConn->prepare("DELETE FROM `comments` WHERE `id`=:cid AND `user`=:us");
$checkCommentInfo->bindParam('cid', $cm, PDO::PARAM_INT);
$checkCommentInfo->bindParam('us', $userIs, PDO::PARAM_INT);
$checkCommentInfo->execute();
$dle = $PDOConn->prepare("DELETE FROM `comments` WHERE `reply`=:cid");
$dle->bindParam('cid', $cm, PDO::PARAM_INT);
$dle->execute();
header('location: '.$site_link.'/anime/'.$anime);
exit;
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title><?=$anime_name?> <?=$translation?> | <?=$site_title?></title>
<meta property="og:title" content="<?=$anime_name?> <?=$translation?> | Anime World" />
<meta property="og:url" content="<?=$site_link?>/list.php?anime=<?=$anime_name?>" />
<meta property="og:image" content="<?=$icon?>" />
<meta property="og:description" content="<?=$eps?> Episodes Available" />
<meta name="description" content="<?=$eps?> Episodes Available" />
<meta name="keywords" content="anime, world, online, animeworld, animeworld.online, <?=$anime_name?>, watch, free, episode, episodes, subbed, dubbed, countdown, release, released, list, all, all episodes" />
<?=$head_tags?>
<link rel="stylesheet" href="<?=$site_link?>/css/comment.min.css">
</head>
<body>
<div id="var_anime_name" style="display:none;visibility:hidden"><?=$anime_name?></div>
<div id="var_translation" style="display:none;visibility:hidden"><?=$translation?></div>
<?php
$translation = $a2["translation"];
if($translation == "raw") $translation = "Raw";
elseif($translation == "dubbed") $translation = "Dubbed";
elseif($translation == "subbed") $translation = "Subbed";
else $translation = "Unknown";
?>
<?=$header?>
<?php
if($link == "" or $link == "$site_link/img/anime/newicons/") $link = "$site_link/img/soon.png";
$ANIME_DESCRIPTION = str_replace("\n", '<br>', $desc);
?>
<div class="anime-page-background" style='background-image: url("<?=$link?>"'><div class="anime-page-background-overlay"></div></div>
<div class="anime-page-new">
<div class="anime-info-new">
<div class="anime-title-new"><?=$anime_name?></div>
<div class="anime-tags-new">
<?php
foreach (explode(',', $tags) as $tg)
{
$tg = trim($tg);
echo "<a href='$site_link/search.php?sortBy=title&genre=$tg' class='anime-tag-new'>$tg</a>";
}
?>
</div>
<div class="anime-description-new"><?=$ANIME_DESCRIPTION?></div>
<div class="anime-sub-info-new">
<div class="anime-sub-element-new"><i class="ase-new-icon far fa-calendar-alt"></i>Released: <span><?=$released?></span></div>
<div class="anime-sub-element-new"><i class="ase-new-icon fas fa-video"></i>Episodes: <span><?=$eps?></span></div>
<div class="anime-sub-element-new"><i class="ase-new-icon fas fa-globe"></i>Translation: <span><?=$translation?></span></div>
<?php if (isset($a2['studio']) && trim($a2['studio']) != '') { ?><div class="anime-sub-element-new"><i class="ase-new-icon fas fa-users"></i>Studio: <span><?=trim($a2['studio'])?></span></div><?php } ?>
<div class="anime-sub-element-new"><i class="ase-new-icon fas fa-stamp"></i>Status: <span><?=$a2['status']?></span></div>
<div class="anime-sub-element-new"><i class="ase-new-icon fas fa-hourglass-start"></i>Age: <span><?=$a2['age']?></span></div>
</div>
</div>
</div>
<div class="anime-episodes-title-new">Episodes</div>
<?php
$EPISODES_LIST = [];
$q1 = $PDOConn->prepare("SELECT * FROM ao_episodes WHERE title = :anime ORDER BY ep_num ASC");
$q1->bindParam(':anime', $anime, PDO::PARAM_STR);
$q1->execute();
$OLD_ep_title = '';
$OLD_text_title = '';
$OLD_ep_numb = '';
while($a1 = $q1->fetch(PDO::FETCH_ASSOC))
{
$ep_title = $a1["ep_title"];
$text_title = $a1["ep_text_title"];
$ep_numb = $a1["ep_num"];
if($OLD_ep_title === $ep_title && $OLD_text_title === $text_title && $OLD_ep_numb === $ep_numb) { continue; }
$OLD_ep_title = $ep_title;
$OLD_text_title = $text_title;
$OLD_ep_numb = $ep_numb;
$EPISODES_LIST[] = [ 'Episode' => $ep_numb, 'Url' => "$site_link/anime/$anime/$ep_numb" ];
}
$START_COUNT = 0;
$END_COUNT = 0;
$GROUPS_ARRAY = [];
echo '<div class="anime-paginator-new">';
for ($i = 1;$i <= count($EPISODES_LIST);$i++)
{
if(!($i % 50))
{
$START_COUNT = $END_COUNT + 1;
$END_COUNT += 50;
$NR_OF_EPISODES_REM = $END_COUNT;
echo "<div id='btn-$START_COUNT-$END_COUNT' onclick=\"changePagination('$START_COUNT-$END_COUNT');\" class='anime-page-button-new ".($START_COUNT === 1 ? 'active' : '')."'>$START_COUNT-$END_COUNT</div>";
$GROUPS_ARRAY[] = "$START_COUNT-$END_COUNT";
}
}
if(!isset($NR_OF_EPISODES_REM)) $NR_OF_EPISODES_REM = count($EPISODES_LIST);
if(count($EPISODES_LIST) - $NR_OF_EPISODES_REM > 0) { echo "<div id='btn-".($END_COUNT + 1)."-".count($EPISODES_LIST)."' onclick=\"changePagination('".($END_COUNT + 1)."-".count($EPISODES_LIST)."');\" class='anime-page-button-new'>".($END_COUNT + 1)."-".count($EPISODES_LIST)."</div>"; $GROUPS_ARRAY[] = ($END_COUNT + 1) . "-" . count($EPISODES_LIST); }
if(count($EPISODES_LIST) < 50 && count($EPISODES_LIST) >= 1) { echo "<div class='anime-page-button-new active'>1-".count($EPISODES_LIST)."</div>"; }
echo '</div>';
if(count($EPISODES_LIST) === 0) { echo '<div class="anime-episodes-title" style="font-size: 20px">There are no episodes to show.</div>'; }
$LIMIT_REACH = false;
$CLASS_COUNT = 1;
?><div <?=(isset($GROUPS_ARRAY[0]) ? "id='".$GROUPS_ARRAY[0]."'" : "")?> class="anime-episodes-new"><?php
foreach ($EPISODES_LIST as $EP => $EpisodeData)
{
if($LIMIT_REACH)
{
$HAS_ID = isset($GROUPS_ARRAY[$CLASS_COUNT - 1]);
$CLASS_COUNT++;
echo "</div><div " . ($HAS_ID ? "id='".$GROUPS_ARRAY[$CLASS_COUNT - 1]."'" : "") . " class='anime-episodes' " . ($CLASS_COUNT !== 1 ? 'style="display: none;opacity: 0;"' : '') . ">";
$LIMIT_REACH = false;
}
if(!($EpisodeData['Episode'] % 50)) $LIMIT_REACH = true;
?>
<div class="anime-episode-new">
<a class="anime-episode-link-new" href="<?=$EpisodeData['Url']?>">
<div class="anime-ep-cent-new">
<div class="anime-ep-no-new"><?=$EpisodeData['Episode']?></div>
<div class="anime-ep-icn-new"><i class="fas fa-play"></i></div>
</div>
</a>
</div>
<?php
}
?></div><?php
?><script>setGroup(<?=json_encode($GROUPS_ARRAY);?>);</script><?php
?>
<div class="comments">Comments:</div>
<div class="all-comments">
<?php
$comms = $PDOConn->prepare("SELECT * FROM `comments` WHERE `episode` = '0' AND `reply` = '0' AND `anime` = :anm ORDER BY `created_at` DESC");
$comms->bindParam('anm', $animeId, PDO::PARAM_INT);
$comms->execute();
while ($comm = $comms->fetch(PDO::FETCH_ASSOC)) {
$userId = $comm['user'];
$cUser = $PDOConn->prepare('SELECT `username` FROM `users` WHERE `id` = :uid LIMIT 1');
$cUser->bindParam('uid', $userId, PDO::PARAM_INT);
$cUser->execute();
$userName = ($cUser->fetch(PDO::FETCH_ASSOC))['username'];
$date = strtotime($comm['created_at']);
$time = date('h:i A', $date);
$date = date('n/j/Y', $date);
$comId = $comm['id'];
$comRate = $PDOConn->prepare('SELECT * FROM `comments_rate` WHERE `comm_id` = :cid AND `user_id` = :uid LIMIT 1');
$comRate->bindParam('cid', $comId, PDO::PARAM_INT);
$comRate->bindParam('uid', $userIs, PDO::PARAM_INT);
$comRate->execute();
$rate = 0;
if ($comRate->rowCount() > 0) {
$comRateFetch = $comRate->fetch(PDO::FETCH_ASSOC);
$rate = $comRateFetch['rate'];
}
$comRateCountU = $PDOConn->prepare('SELECT * FROM `comments_rate` WHERE `comm_id` = :cid AND `rate` >= \'1\'');
$comRateCountU->bindParam('cid', $comId, PDO::PARAM_INT);
$comRateCountU->execute();
$comRateCountN = $PDOConn->prepare('SELECT * FROM `comments_rate` WHERE `comm_id` = :cid AND `rate` <= \'-1\'');
$comRateCountN->bindParam('cid', $comId, PDO::PARAM_INT);
$comRateCountN->execute();
?>
<div class="comment-item">
<div class="information-comment">
<div class="profile-icon" style="background-image: url('<?=$site_link?>/images/noav.png')"></div>
<a href="<?=$site_link?>\profile\<?=$userName?>" class="name-profile"><?=$userName?></a><div class="date"><?=$date?> ● <?=$time?></div>
</div>
<div class="text-comment"><?=$comm['message']?></div>
<div class="likes">
<a <?php if ($userIs !== $userId) { ?>href="<?=$site_link?>/list.php?anime=<?=$anime?>&cm=<?=$comId?>&rt=<?=($rate >= 1 ? '0' : '1')?>"<?php } ?> class="comm-like clup <?=($rate >= 1 ? 'active' : '')?>"><?=$comRateCountU->rowCount()?><i class="fas fa-thumbs-up cl-icn"></i></a>
<a <?php if ($userIs !== $userId) { ?>href="<?=$site_link?>/list.php?anime=<?=$anime?>&cm=<?=$comId?>&rt=<?=($rate <= -1 ? '0' : '-1')?>"<?php } ?> class="comm-like cldw <?=($rate <= -1 ? 'active' : '')?>"><?=$comRateCountN->rowCount()?><i class="fas fa-thumbs-down cl-icn"></i></a>
<a id="reply-<?=$comId?>" class="comm-reply"><i class="fas fa-reply"></i></a>
<?php if ($userIs === $userId) { ?><a class="comm-reply" href="<?=$site_link?>/list.php?anime=<?=$anime?>&cm=<?=$comId?>&del=<?=($rate <= -1 ? '0' : '-1')?>"><i class="fas fa-trash-alt"></i></a><?php } ?>
<script>
$('#reply-<?=$comId?>').on('click', function () {
let reply = prompt("Reply to comment `<?=$comm['message']?>`", "");
if (reply !== null && reply.trim() !== "") {
$.post(window.location.href, {
sendComment: true,
msg: reply,
reply: parseInt('<?=$comId?>')
}).always(() => {
window.location.replace(window.location.href);
});
}
});
</script>
</div>
</div>
<?php
$reply = $PDOConn->prepare("SELECT * FROM `comments` WHERE `episode` = '0' AND `reply` = :reply ORDER BY `created_at` DESC");
$reply->bindParam('reply', $comId, PDO::PARAM_INT);
$reply->execute();
while ($rep = $reply->fetch(PDO::FETCH_ASSOC)) {
$userId = $rep['user'];
$cUser = $PDOConn->prepare('SELECT `username` FROM `users` WHERE `id` = :uid LIMIT 1');
$cUser->bindParam('uid', $userId, PDO::PARAM_INT);
$cUser->execute();
$userName = ($cUser->fetch(PDO::FETCH_ASSOC))['username'];
$date = strtotime($rep['created_at']);
$time = date('h:i A', $date);
$date = date('n/j/Y', $date);
$comId = $rep['id'];
$comRate = $PDOConn->prepare('SELECT * FROM `comments_rate` WHERE `comm_id` = :cid AND `user_id` = :uid LIMIT 1');
$comRate->bindParam('cid', $comId, PDO::PARAM_INT);
$comRate->bindParam('uid', $userIs, PDO::PARAM_INT);
$comRate->execute();
$rate = 0;
if ($comRate->rowCount() > 0) {
$comRateFetch = $comRate->fetch(PDO::FETCH_ASSOC);
$rate = $comRateFetch['rate'];
}
$comRateCountU = $PDOConn->prepare('SELECT * FROM `comments_rate` WHERE `comm_id` = :cid AND `rate` >= \'1\'');
$comRateCountU->bindParam('cid', $comId, PDO::PARAM_INT);
$comRateCountU->execute();
$comRateCountN = $PDOConn->prepare('SELECT * FROM `comments_rate` WHERE `comm_id` = :cid AND `rate` <= \'-1\'');
$comRateCountN->bindParam('cid', $comId, PDO::PARAM_INT);
$comRateCountN->execute();
?>
<div class="comment-item reply">
<div class="information-comment">
<div class="profile-icon"
style="background-image: url('<?= $site_link ?>/images/noav.png')"></div>
<a href="<?= $site_link ?>\profile\<?= $userName ?>"
class="name-profile"><?= $userName ?></a>
<div class="date"><?= $date ?> ● <?= $time ?></div>
</div>
<div class="text-comment"><?= $rep['message'] ?></div>
<div class="likes">
<a <?php if ($userIs !== $userId) { ?>href="<?= $site_link ?>/list.php?anime=<?= $anime ?>&cm=<?= $comId ?>&rt=<?= ($rate >= 1 ? '0' : '1') ?>"<?php } ?>
class="comm-like clup <?= ($rate >= 1 ? 'active' : '') ?>"><?= $comRateCountU->rowCount() ?>
<i class="fas fa-thumbs-up cl-icn"></i></a>
<a <?php if ($userIs !== $userId) { ?>href="<?= $site_link ?>/list.php?anime=<?= $anime ?>&cm=<?= $comId ?>&rt=<?= ($rate <= -1 ? '0' : '-1') ?>"<?php } ?>
class="comm-like cldw <?= ($rate <= -1 ? 'active' : '') ?>"><?= $comRateCountN->rowCount() ?>
<i class="fas fa-thumbs-down cl-icn"></i></a>
<?php if ($userIs === $userId) { ?><a class="comm-reply"
href="<?= $site_link ?>/list.php?anime=<?= $anime ?>&cm=<?= $comId ?>&del=<?= ($rate <= -1 ? '0' : '-1') ?>">
<i class="fas fa-trash-alt"></i></a><?php } ?>
</div>
</div>
<?php
}
}
?>
<form method="post" action="" class="comm-textarea">
<textarea required minlength="1" maxlength="254" name="msg" placeholder="Comment"></textarea>
<button <?=($userIs > 0 ? '' : 'onclick="alert(\'You are not logged in!\');"')?> type="<?=($userIs > 0 ? 'submit' : 'button')?>" name="sendComment">Send</button>
</form>
</div>
<div style="width: 100%;height: 100px"></div>
<?php require_once("./settings/searchbar.php"); ?>
<script>
$(document).ready(function(){$(".closebox").click(function(){$('.chatbox').css('display','none')})});$.fn.hScroll=function(options)
{function scroll(obj,e)
{var evt=e.originalEvent;var direction=evt.detail?evt.detail*(-120):evt.wheelDelta;if(direction>0)
{direction=$(obj).scrollLeft()-120}
else{direction=$(obj).scrollLeft()+120}
$(obj).scrollLeft(direction);e.preventDefault()}
$(this).width($(this).find('div').width());$(this).bind('DOMMouseScroll mousewheel',function(e)
{scroll(this,e)})}
$(document).ready(function(){$('#episodes').hScroll()})
</script>
</body>
</html>