mirror of
https://github.com/claradex/nativegallery.git
synced 2025-07-06 15:59:43 +03:00
Compare commits
No commits in common. "f4cb133e467db53e223f254ed71fa5c57b566e93" and "e82faca5219eccf1b59b1356e8436f1f0c6dd9d2" have entirely different histories.
f4cb133e46
...
e82faca521
3 changed files with 10 additions and 19 deletions
|
@ -105,9 +105,7 @@ $(document).ready(function()
|
||||||
<?php
|
<?php
|
||||||
$contest = DB::query('SELECT * FROM contests WHERE status=2')[0];
|
$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']));
|
$photos_contest = DB::query('SELECT * FROM photos WHERE on_contest=2 AND contest_id=:id', array(':id'=>$contest['id']));
|
||||||
|
|
||||||
foreach ($photos_contest as $pc) {
|
foreach ($photos_contest as $pc) {
|
||||||
$user = new User($pc['user_id']);
|
|
||||||
$class = '';
|
$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']) {
|
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';
|
$class = ' voted';
|
||||||
|
@ -119,7 +117,7 @@ $(document).ready(function()
|
||||||
<td><a href="#" pid="'.$pc['id'].'" class="contestBtn'.$class.'"></a></td>
|
<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 КБ">
|
<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="hpshade">
|
||||||
<div class="eye-icon">'.DB::query('SELECT COUNT(*) FROM photos_views WHERE photo_id=:id', array(':id'=>$pc['id']))[0]['COUNT(*)'].'</div>
|
<div class="eye-icon">'.DB::query('SELECT COUNT(*) FROM photos_views WHERE photo_id=:id', array(':id'=>$p['id']))[0]['COUNT(*)'].'</div>
|
||||||
</div>
|
</div>
|
||||||
</a></td>
|
</a></td>
|
||||||
<td class="pb_descr">
|
<td class="pb_descr">
|
||||||
|
|
|
@ -31,21 +31,14 @@ use \App\Models\{User, VoteContest, Vote};
|
||||||
<?php
|
<?php
|
||||||
if (DB::query('SELECT status FROM contests WHERE status=1')[0]['status'] === 1) {
|
if (DB::query('SELECT status FROM contests WHERE status=1')[0]['status'] === 1) {
|
||||||
$contest = DB::query('SELECT * FROM contests WHERE status=1')[0];
|
$contest = DB::query('SELECT * FROM contests WHERE status=1')[0];
|
||||||
$photos_contest = DB::query('SELECT p.*, COUNT(prc.photo_id) AS rates_count
|
$photos_contest = DB::query('SELECT p.*, COUNT(prc.photo_id) AS rates_count
|
||||||
FROM photos p
|
FROM photos p
|
||||||
LEFT JOIN photos_rates_contest prc ON p.id = prc.photo_id
|
LEFT JOIN photos_rates_contest prc ON p.id = prc.photo_id
|
||||||
WHERE p.on_contest = 1 AND p.contest_id = :id
|
WHERE p.on_contest = 1 AND p.contest_id = :id
|
||||||
GROUP BY p.id
|
GROUP BY p.id
|
||||||
ORDER BY rates_count DESC;
|
ORDER BY rates_count DESC;
|
||||||
', array(':id'=>$contest['id']));
|
', 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) {
|
foreach ($photos_contest as $pc) {
|
||||||
$user = new User($pc['user_id']);
|
$user = new User($pc['user_id']);
|
||||||
if (VoteContest::photo(Auth::userid(), $pc['id'], $contest['id']) === 1) {
|
if (VoteContest::photo(Auth::userid(), $pc['id'], $contest['id']) === 1) {
|
||||||
|
|
|
@ -225,7 +225,7 @@ $birthdate = json_decode($userprofile->i('content'), true)['aboutbirthday']['val
|
||||||
<div class="p20" style="margin-top: 8px; background-color: white !important;">
|
<div class="p20" style="margin-top: 8px; background-color: white !important;">
|
||||||
<h4>О себе</h4>
|
<h4>О себе</h4>
|
||||||
<?=
|
<?=
|
||||||
htmlspecialchars($about)
|
$about
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?php } else if ($usercttc === True) {
|
<?php } else if ($usercttc === True) {
|
||||||
|
|
Loading…
Reference in a new issue