Compare commits

...

2 commits

Author SHA1 Message Date
themohooks
f4cb133e46 fixes 2025-02-21 23:55:20 +03:00
themohooks
540e643e9a Update Index.php 2025-02-21 23:30:47 +03:00
3 changed files with 19 additions and 10 deletions

View file

@ -105,7 +105,9 @@ $(document).ready(function()
<?php
$contest = DB::query('SELECT * FROM contests WHERE status=2')[0];
$photos_contest = DB::query('SELECT * FROM photos WHERE on_contest=2 AND contest_id=:id', array(':id'=>$contest['id']));
foreach ($photos_contest as $pc) {
$user = new User($pc['user_id']);
$class = '';
if ((int)DB::query('SELECT photo_id FROM contests_rates WHERE photo_id=:pid AND user_id=:uid AND contest_id=:cid', array(':uid' => Auth::userid(), ':pid' => $pc['id'], ':cid' => $contest['id']))[0]['photo_id'] === (int)$pc['id']) {
$class = ' voted';
@ -117,7 +119,7 @@ $(document).ready(function()
<td><a href="#" pid="'.$pc['id'].'" class="contestBtn'.$class.'"></a></td>
<td class="pb_photo" id="p2068176"><a href="/photo/'.$pc['id'].'/" target="_blank" class="prw"><img class="f" src="/api/photo/compress?url='.$pc['photourl'].'" data-src="/api/photo/compress?url='.$pc['photourl'].'" alt="630 КБ">
<div class="hpshade">
<div class="eye-icon">'.DB::query('SELECT COUNT(*) FROM photos_views WHERE photo_id=:id', array(':id'=>$p['id']))[0]['COUNT(*)'].'</div>
<div class="eye-icon">'.DB::query('SELECT COUNT(*) FROM photos_views WHERE photo_id=:id', array(':id'=>$pc['id']))[0]['COUNT(*)'].'</div>
</div>
</a></td>
<td class="pb_descr">

View file

@ -38,7 +38,14 @@ WHERE p.on_contest = 1 AND p.contest_id = :id
GROUP BY p.id
ORDER BY rates_count DESC;
', array(':id'=>$contest['id']));
var_dump($photos_contest);
foreach ($photos_contest as &$photo) {
$photo['votes'] = VoteContest::count($pc['id'], $contest['id']);
}
usort($photos_contest, function ($a, $b) {
return $b['votes'] <=> $a['votes'];
});
foreach ($photos_contest as $pc) {
$user = new User($pc['user_id']);
if (VoteContest::photo(Auth::userid(), $pc['id'], $contest['id']) === 1) {

View file

@ -225,7 +225,7 @@ $birthdate = json_decode($userprofile->i('content'), true)['aboutbirthday']['val
<div class="p20" style="margin-top: 8px; background-color: white !important;">
<h4>О себе</h4>
<?=
$about
htmlspecialchars($about)
?>
</div>
<?php } else if ($usercttc === True) {