fixes admin & upload

This commit is contained in:
themohooks 2024-10-09 21:59:15 +03:00
parent 9d9b47309a
commit e65d3402d2
4 changed files with 26 additions and 16 deletions

View file

@ -33,7 +33,7 @@ class Upload
} else {
$moderated = 1;
}
DB::query('INSERT INTO photos VALUES (\'0\', :userid, :postbody, :photourl, :time, :timeup, :exif, 0, :moderated, :place, 0, :content)', array(':postbody' => $postbody, ':userid' => Auth::userid(), ':time' => mktime(0, 0, 0, $_POST['month'], $_POST['day'], $_POST['year']), ':content' => $content, ':photourl' => self::$photourl, ':exif' => $exif, ':place' => $_POST['place'], ':timeup' => time(), ':moderated' => $moderated));
DB::query('INSERT INTO photos VALUES (\'0\', :userid, :postbody, :photourl, :time, :timeup, :exif, 0, :moderated, :place, 0, :gallery, :content)', array(':postbody' => $postbody, ':userid' => Auth::userid(), ':time' => mktime(0, 0, 0, $_POST['month'], $_POST['day'], $_POST['year']), ':content' => $content, ':photourl' => self::$photourl, ':exif' => $exif, ':place' => $_POST['place'], ':timeup' => time(), ':moderated' => $moderated, ':gallery'=>$_POST['gallery']));
if (($moderated === 1) && (self::$subsnotify != 'disabled')) {
$followers = DB::query('SELECT * FROM followers WHERE user_id=:uid', array(':uid' => Auth::userid()));
foreach ($followers as $f) {
@ -134,16 +134,16 @@ class Upload
$_POST['lat'] = null;
$_POST['lng'] = null;
}
if ($_POST['disablecomments'] === 1) {
if ((int)$_POST['disablecomments'] === 1) {
self::$comments = 'disabled';
}
if ($_POST['disablerating'] === 1) {
if ((int)$_POST['disablerating'] === 1) {
self::$rating = 'disabled';
}
if ($_POST['disableshowtop'] === 1) {
if ((int)$_POST['disableshowtop'] === 1) {
self::$showtop = 'disabled';
}
if ($_POST['disablesubsnotify'] === 1) {
if ((int)$_POST['disablesubsnotify'] === 1) {
self::$subsnotify = 'disabled';
}
if ($upload->getType() !== null) {

View file

@ -68,10 +68,10 @@ if (isset($_POST['subbtn'])) {
</select>
<div style="margin-bottom:3px; margin-top:5px">Статус аккаунта</div>
<select name="admin" style="width:100%">
<option value="0" <?php if ($user->i('admin') === 0) { echo 'selected'; } ?>>Пользователь</option>
<option value="1" <?php if ($user->i('admin') === 1) { echo 'selected'; } if (Auth::userid() != 1) { echo 'disabled'; } ?>>Администратор</option>
<option value="2" <?php if ($user->i('admin') === 2) { echo 'selected'; } ?>>Фотомодератор</option>
<option value="3" <?php if ($user->i('admin') === 3) { echo 'selected'; } ?>>Модератор</option>
<option value="0" <?php if ((int)$user->i('admin') === 0) { echo 'selected'; } ?>>Пользователь</option>
<option value="1" <?php if ((int)$user->i('admin') === 1) { echo 'selected'; } if (Auth::userid() === 1) { echo 'disabled'; } ?>>Администратор</option>
<option value="2" <?php if ((int)$user->i('admin') === 2) { echo 'selected'; } ?>>Фотомодератор</option>
<option value="3" <?php if ((int)$user->i('admin') === 3) { echo 'selected'; } ?>>Модератор</option>
</select>
</div>

View file

@ -225,7 +225,7 @@ if ($photo->i('id') !== null) {
</div>
</div>
</div>
<?php if ($photo->i('moderated') === 1 && json_decode($c['content'], true)['rating'] != 'disabled') { ?>
<?php if ($photo->i('moderated') === 1 && $photo->content('rating') != 'disabled') { ?>
<div class="p20a" id="pp-item-vote">
<h4 class="pp-item-header">Оценка</h4>
<div class="sm">
@ -369,7 +369,7 @@ if ($photo->i('id') !== null) {
$commcount++;
}
}
if (json_decode($c['content'], true)['comments'] != 'disabled') { ?>
if ($photo->content('comments') != 'disabled') { ?>
<div class="p0" id="pp-item-comments">
<?php
if ($commcount > 0) { ?>

View file

@ -493,7 +493,17 @@ $user = new User(Auth::userid());
</tr>
<tr class="lnk-gallery">
<td class="lcol">Галерея:</td>
<td style="padding-right:15px"><select name="search_gid" id="search_gid"></select></td>
<td style="padding-right:15px">
<select name="gallery" id="search_gid">
<option value="0">Общая</option>
<?php
$galleries = DB::query('SELECT * FROM galleries');
foreach ($galleries as $g) {
echo '<option value="'.$g['id'].'">'.$g['title'].'</option>';
}
?>
</select>
</td>
</tr>
<tr class="lnk-gallery" style="display:none">
<td></td>
@ -860,7 +870,7 @@ $user = new User(Auth::userid());
<tr>
<td class="lcol"></td>
<td style="padding:7px 2px">
<input type="checkbox" name="disablecomments" id="nomap" value="1" onclick="switchMap()"> <label for="nomap">Отключить комментарии</label>
<input type="checkbox" name="disablecomments" id="disablecomments" value="1"> <label for="disablecomments">Отключить комментарии</label>
</td>
</tr>
@ -873,7 +883,7 @@ $user = new User(Auth::userid());
<tr>
<td class="lcol"></td>
<td style="padding:7px 2px">
<input type="checkbox" name="disablerating" id="nomap" value="1" onclick="switchMap()"> <label for="nomap">Отключить оценку фотографии</label>
<input type="checkbox" name="disablerating" id="disablerating" value="1"> <label for="disablerating">Отключить оценку фотографии</label>
</td>
</tr>
@ -885,7 +895,7 @@ $user = new User(Auth::userid());
<tr>
<td class="lcol"></td>
<td style="padding:7px 2px">
<input type="checkbox" name="disableshowtop" id="nomap" value="1" onclick="switchMap()"> <label for="nomap">Не продвигать в общем топе</label>
<input type="checkbox" name="disableshowtop" id="disableshowtop" value="1"> <label for="disableshowtop">Не продвигать в общем топе</label>
</td>
</tr>
@ -897,7 +907,7 @@ $user = new User(Auth::userid());
<tr>
<td class="lcol"></td>
<td style="padding:7px 2px">
<input type="checkbox" name="disablesubsnotify" id="nomap" value="1" onclick="switchMap()"> <label for="nomap">Не уведомлять подписчиков о новом медиа</label>
<input type="checkbox" name="disablesubsnotify" id="disablesubsnotify" value="1"> <label for="disablesubsnotify">Не уведомлять подписчиков о новом медиа</label>
</td>
</tr>
<tr>