diff --git a/app/Controllers/Api/Admin/Images/SetVisibility.php b/app/Controllers/Api/Admin/Images/SetVisibility.php index b442fde..4ef1e16 100644 --- a/app/Controllers/Api/Admin/Images/SetVisibility.php +++ b/app/Controllers/Api/Admin/Images/SetVisibility.php @@ -12,6 +12,7 @@ class SetVisibility { public function __construct() { + $priority = 0; $photo = new Photo($_GET['id']); $data = json_decode($photo->i('content'), true); @@ -21,12 +22,17 @@ class SetVisibility if ($_POST['comment'] != null) { $data['declineComment'] = $_POST['comment']; } - $data['declineReason'] = $_GET['decline_reason']; + if ($_GET['mod'] != 1) { + $data['declineReason'] = $_GET['reason']; + } else { + $priority = $_GET['reason']; + } + $updatedJsonString = json_encode($data); - DB::query('UPDATE photos SET moderated=:mod, timeupload=:time, content=:c WHERE id=:id', array(':id'=>$_GET['id'], ':mod'=>$_GET['mod'], ':time'=>time(), ':c'=>$updatedJsonString)); + DB::query('UPDATE photos SET moderated=:mod, timeupload=:time, priority=:pr, content=:c WHERE id=:id', array(':id'=>$_GET['id'], ':mod'=>$_GET['mod'], ':time'=>time(), ':pr'=>$priority, ':c'=>$updatedJsonString)); $uid = DB::query('SELECT user_id FROM photos WHERE id=:id', array(':id'=>$_GET['id']))[0]['user_id']; if ($_GET['mod'] === 1) { $followers = DB::query('SELECT * FROM followers WHERE user_id=:uid', array(':uid'=>$uid)); diff --git a/app/Controllers/Api/Images/LoadRecent.php b/app/Controllers/Api/Images/LoadRecent.php index 3a55032..1c05f03 100644 --- a/app/Controllers/Api/Images/LoadRecent.php +++ b/app/Controllers/Api/Images/LoadRecent.php @@ -13,7 +13,7 @@ class LoadRecent $response = []; if ($_POST['serverhost'] != 'transphoto.org') { - $photos = DB::query('SELECT * FROM photos WHERE moderated=1 ORDER BY id DESC LIMIT 30'); + $photos = DB::query('SELECT * FROM photos WHERE moderated=1 AND id<:id ORDER BY id DESC LIMIT 30', array(':id'=>$_GET['lastpid'])); foreach ($photos as $p) { @@ -23,7 +23,7 @@ class LoadRecent $date = Date::zmdate($p['posted_at']); } $user = DB::query('SELECT * FROM users WHERE id=:id', array(':id' => $p['user_id']))[0]; - + $comments = DB::query('SELECT COUNT(*) FROM photos_comments WHERE photo_id=:pid', array(':pid'=>$p['id']))[0]['COUNT(*)']; $response[] = [ 'id' => $p['id'], 'place' => htmlspecialchars($p['place']), @@ -31,7 +31,8 @@ class LoadRecent 'user_name' => $user['username'], 'user_id' => $p['user_id'], 'photourl' => $p['photourl'], - 'photourl_small' => 'https://' . $_SERVER['SERVER_NAME'] . '/api/photo/compress?url=' . $p['photourl'] + 'photourl_small' => 'https://' . $_SERVER['SERVER_NAME'] . '/api/photo/compress?url=' . $p['photourl'], + 'ccnt' => $comments ]; } } else { diff --git a/app/Services/KeyTranslation.php b/app/Services/KeyTranslation.php new file mode 100644 index 0000000..00a50e4 --- /dev/null +++ b/app/Services/KeyTranslation.php @@ -0,0 +1,52 @@ + .f { width:115px; } +.pb-photo { padding:5px; } + +.mm-mobile-btn { display:flex; justify-content:center; align-items:center; position:absolute; top:0; right:0; z-index:2002; box-sizing:border-box; width:56px; height:54px; background-color:rgba(0,0,0,0.2); color:#fff; font-size:28px; } +.mm-mobile-btn.active { background-color:rgba(255,255,255,0.2); } +#mm-user-btn { right:57px; } +#mm-bars-btn { right:0; } + +.mm { position:absolute; top:54px; width:100%; z-index:2002; border-bottom:solid 1px var(--theme-bg-color); box-shadow:0 8px 8px #0007; } +.mm-bar ul, .mm-bar { list-style-type:none; padding:0; margin:0; } +.mm-bar ul { display:none; background:linear-gradient(rgba(0,0,0,0.2),rgba(0,0,0,0.2)) var(--theme-bg-color); } +.mm ul { margin:0 10px 7px; } + +.mm-bar-item li { display:flex; flex-direction:column; align-items:center; justify-content:center; position:relative; box-sizing:border-box; border-top:solid 1px var(--theme-bg-color); font-family:var(--narrow-font); font-size:28px; } +.mm-bar-item li div { box-sizing:border-box; width:100%; background-color:#eee; } +.mm-bar-item li div::before { content:'>'; color:#fff; display:block; position:absolute; top:7px; left:10px; z-index:2003; transform:scaleX(0.8); transition:transform .1s ease-out; } +.mm-level-3 > div::before { top:1px; } + +a.mm-item, label.mm-item { color:#fff; } +.mm-item { box-sizing:border-box; width:100%; min-height:50px; padding:5px 0; text-align:center; border:none; } +.mm-level-2 .mm-item { min-height: 42px; font-size: 22px; } +.mm-level-3 .mm-item { min-height: 34px; font-size: 16px; } + +.mm-bar-item label:hover { border:none; } + +.mm-bar-item input[type="checkbox"] { display:none; } +.mm-bar-item input[type="checkbox"]:checked + div > ul { display:flex; flex-direction:column; } +.mm-bar-item input[type="checkbox"]:checked + div::before { transform:scaleY(0.8) rotate(90deg); } + +span.mm-icon, span.mm-right-icon { display:block; position:absolute; z-index:2003; } +.mm-icon { top:7px; left:10px; } +.mm-right-icon { top:5px; right:10px; } + +.mm-notify { position: absolute; right: 7px; bottom: 7px; } +.mm-level-1 .mm-notify { top: 10px; font-size: 16px; line-height: 16px; height: 30px; min-width: 30px; } +.mm-level-2 .mm-notify { top: 9px; font-size: 12px; line-height: 12px; height: 24px; min-width: 24px; } + + +#idx-main { margin-top:5px; } +#idx-column-center { padding:0; } +#idx-column-menu { display:none; position:absolute; top:54px; right:0; padding:5px 10px; background-color:#f7f7f7; width:300px; border-left:solid 1px #ddd; border-bottom:solid 1px #ddd; z-index:2001; } + + +.idx-donate { margin-right:-10px; } +.idx-donate > a { padding-right:15px; } + + +.ix-photos-oneline { width:100vw; min-height:70px; margin:0 -5px 7px; overflow-x:auto; } +.ix-photos-oneline:before, .ix-photos-oneline:after { content:''; width:5px; flex-shrink:0; background-color:var(--theme-main-color); } +.ix-photos-oneline > a { flex-grow:0; flex-shrink:0; flex-basis:auto; width:100px; } + +.ix-photos-multiline { min-height:210px; margin-bottom:10px; } +.ix-photos-multiline > a { flex-basis:100px; } + +.prw-animate, .prw-grid-item { height:70px; } +.prw-animate:hover { animation:none; } + +#morerand { top:4px; } +#loadmore { height:auto; padding-bottom:4px; margin-bottom:7px; } + + +.rtable { box-sizing:border-box; width:100vw; margin:0 -5px; overflow-x:auto; } +.rtable > :first-child { margin:0 5px; } + + +[type="text"], +[type="password"], +[type="color"], +[type="date"], +[type="datetime"], +[type="datetime-local"], +[type="email"], +[type="number"], +[type="search"], +[type="tel"], +[type="time"], +[type="url"], +[type="month"], +[type="week"], +select, +textarea { + box-shadow:none; + -moz-box-shadow:none; + -webkit-box-shadow:none; +} + +.mf-center-block-wide, +.mf-center-block-x-wide { + width:calc(100% + 10px); + margin-left: -5px; + margin-right:-5px; +} + +.cmt-showall { display:block; text-align:center; margin-bottom:-5px; } + +.mark-btn { margin-bottom:7px; } +.mid-btn { margin:7px 0; } +.mark-btn a, .mid-btn a { width:100%; } \ No newline at end of file diff --git a/static/img/cond.png b/static/img/cond.png new file mode 100644 index 0000000..9089d58 Binary files /dev/null and b/static/img/cond.png differ diff --git a/static/js/core_lk.js b/static/js/core_lk.js index b39f228..8bd25bc 100644 --- a/static/js/core_lk.js +++ b/static/js/core_lk.js @@ -318,7 +318,7 @@ document.onclick = function(e) { e = e || window.event; E = e.target || e.srcElement; - if (E.id != 'phint' && E.parentNode.id != 'phint' && E != _getID('mform').place) $('#phint').slideUp(); + if (E.className != 'searchVehiclesBtn' && E.id != 'vlist_table' && E.className != 'num' && $('#vlist').css('display') == 'block') $('#vlist').hide().html(''); @@ -349,6 +349,7 @@ function artClick() + function loadGalleries(cid) { if (cid == gal_cid) return; diff --git a/static/js/index.js b/static/js/index.js index 3146a52..ca0f320 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -121,7 +121,7 @@ function searchVehicles() function AddPhotoToBlock(block, arr, prepend) { - block[prepend ? 'prepend' : 'append']('
' + arr.links + '
' + arr.pdate + '
' + (arr.ccnt != 0 ? '
' + arr.ccnt + '
' : '') + '
'); + block[prepend ? 'prepend' : 'append']('
' + arr.place + '
' + arr.date + '
' + (arr.ccnt != 0 ? '
' + arr.ccnt + '
' : '') + '
'); } @@ -166,19 +166,19 @@ function LoadRecentPhotos() loadmore.prop('disabled', true).addClass('loader-button').val(' '); - $.getJSON('/api.php', { action: 'get-recent-photos', width: width, lastpid: lastpid, hidden: hidden.length }, function(data) + $.getJSON('/api/photo/loadrecent', { lastpid: lastpid }, function(data) { if (data) { - if (lastpid == 0) recent.attr('firstpid', data[0].pid); + if (lastpid == 0) recent.attr('firstpid', data[0].id); hidden.show(); for (var i = 0; i < data.length; i++) AddPhotoToBlock(recent, data[i]); - recent.attr('lastpid', data[i-1].pid); + recent.attr('lastpid', data[i-1].id); } else recent.append('Load error'); - loadmore.prop('disabled', false).removeClass('loader-button').val(_text['IX_LOADMORE']); + loadmore.prop('disabled', false).removeClass('loader-button').val('Загрузить ещё'); }) .fail(function(jx) { if (jx.responseText != '') console.log(jx.responseText); }); } diff --git a/views/components/LoadHead.php b/views/components/LoadHead.php index d01aff9..45c8813 100644 --- a/views/components/LoadHead.php +++ b/views/components/LoadHead.php @@ -16,6 +16,7 @@ + diff --git a/views/pages/Admin/Photo.php b/views/pages/Admin/Photo.php index bd54f80..1a2bc1f 100644 --- a/views/pages/Admin/Photo.php +++ b/views/pages/Admin/Photo.php @@ -35,7 +35,7 @@ use \App\Models\User; } -

Журнал

+

Фотографии



@@ -74,7 +74,7 @@ use \App\Models\User; '; if ($p['moderated'] === 0) { - echo 'Принять + echo 'Принять Отклонить'; } echo ' @@ -84,6 +84,68 @@ use \App\Models\User; } echo ' + +