mirror of
https://github.com/claradex/nativegallery.git
synced 2025-03-29 04:38:32 +03:00
Compare commits
3 commits
release-1.
...
main
Author | SHA1 | Date | |
---|---|---|---|
|
f4cb133e46 | ||
|
540e643e9a | ||
|
e82faca521 |
6 changed files with 41 additions and 18 deletions
|
@ -12,11 +12,20 @@ class SendPretend
|
|||
{
|
||||
public function __construct()
|
||||
{
|
||||
if (DB::query('SELECT contest_id FROM photos WHERE user_id=:uid', array(':uid' => Auth::userid()))[0]['contest_id'] != $_POST['cid']) {
|
||||
DB::query('UPDATE photos SET on_contest=1, contest_id=:id WHERE id=:idd', array(':id' => $_POST['cid'], ':idd' => $_POST['photo_id']));
|
||||
if (isset($_POST['cid'])) {
|
||||
if (DB::query('SELECT contest_id FROM photos WHERE user_id=:uid', array(':uid' => Auth::userid()))[0]['contest_id'] != $_POST['cid']) {
|
||||
DB::query('UPDATE photos SET on_contest=1, contest_id=:id WHERE id=:idd', array(':id' => $_POST['cid'], ':idd' => $_POST['photo_id']));
|
||||
echo json_encode(
|
||||
array(
|
||||
'errorcode' => 0,
|
||||
'error' => 0
|
||||
)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
echo json_encode(
|
||||
array(
|
||||
'errorcode' => 0,
|
||||
'errorcode' => 1,
|
||||
'error' => 0
|
||||
)
|
||||
);
|
||||
|
|
|
@ -129,10 +129,12 @@ if (!$task->isTaskExists("ExecContests", "php ".$_SERVER['DOCUMENT_ROOT'].$task-
|
|||
<div class="mb-3">
|
||||
<label for="exampleFormControlTextarea1" class="form-label">Тематика</label>
|
||||
<select name="themeid" class="form-select" aria-label="Default select example">
|
||||
<option selected>Open this select menu</option>
|
||||
<option value="1">One</option>
|
||||
<option value="2">Two</option>
|
||||
<option value="3">Three</option>
|
||||
<?php
|
||||
$themes = DB::query('SELECT * FROM contests_themes');
|
||||
foreach ($themes as $t) {
|
||||
echo '<option value="'.$t['id'].'">'.$t['title'].'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -116,7 +116,7 @@ function convertUnixToRussianDateTime($unixTime)
|
|||
$photos = DB::query('SELECT * FROM photos WHERE user_id=:uid AND on_contest=0', array(':uid' => Auth::userid()));
|
||||
foreach ($photos as $p) {
|
||||
$content = json_decode($p['content'], true);
|
||||
if ($content['video'] === null) {
|
||||
if (($content['video'] === null || $content['type'] === 'image') && $p['moderated'] === 1) {
|
||||
echo '<option photourl="/api/photo/compress?url=' . $p['photourl'] . '" value="' . $p['id'] . '">[ID: ' . $p['id'] . '] ' . $p['place'] . '</option>';
|
||||
}
|
||||
}
|
||||
|
@ -153,6 +153,8 @@ function convertUnixToRussianDateTime($unixTime)
|
|||
var jsonData = JSON.parse(response);
|
||||
if (jsonData.errorcode === 0) {
|
||||
alert('Фотография успешно отправлена на претенденты на Фотоконкурс');
|
||||
} else {
|
||||
alert('Пожалуйста, выберите Фотоконкурс на который вы хотите отправить фотографию!');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,13 +31,21 @@ use \App\Models\{User, VoteContest, Vote};
|
|||
<?php
|
||||
if (DB::query('SELECT status FROM contests WHERE status=1')[0]['status'] === 1) {
|
||||
$contest = DB::query('SELECT * FROM contests WHERE status=1')[0];
|
||||
$photos_contest = DB::query('SELECT p.*, COUNT(prc.photo_id) AS rates_count
|
||||
FROM photos p
|
||||
LEFT JOIN photos_rates_contest prc ON p.id = prc.photo_id
|
||||
WHERE p.on_contest = 1 AND p.contest_id = :id
|
||||
GROUP BY p.id
|
||||
ORDER BY rates_count DESC;
|
||||
', array(':id'=>$contest['id']));
|
||||
$photos_contest = DB::query('SELECT p.*, COUNT(prc.photo_id) AS rates_count
|
||||
FROM photos p
|
||||
LEFT JOIN photos_rates_contest prc ON p.id = prc.photo_id
|
||||
WHERE p.on_contest = 1 AND p.contest_id = :id
|
||||
GROUP BY p.id
|
||||
ORDER BY rates_count DESC;
|
||||
', array(':id'=>$contest['id']));
|
||||
|
||||
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) {
|
||||
|
@ -64,7 +72,7 @@ ORDER BY rates_count DESC;
|
|||
</td>
|
||||
<td class="pb_photo" id="p2072294"><a href="/photo/'.$pc['id'].'" target="_blank" class="prw"><img class="f" src="/api/photo/compress?url='.$pc['photourl'].'" alt="597 КБ" style="display: inline;">
|
||||
<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">
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue