mirror of
https://github.com/claradex/nativegallery.git
synced 2024-11-15 03:31:10 +03:00
if server setting premoderation = true, or user don't has direct upload, send photo to moderation
This commit is contained in:
parent
9c2d9c622e
commit
ef1aa4b9c2
2 changed files with 17 additions and 2 deletions
|
@ -17,7 +17,17 @@ class Upload
|
|||
|
||||
public static function create($postbody, $content, $exif)
|
||||
{
|
||||
DB::query('INSERT INTO photos VALUES (\'0\', :userid, :postbody, :photourl, :time, :timeup, :exif, 0, :place, :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()));
|
||||
$user = new \App\Models\User(Auth::userid());
|
||||
if (NGALLERY['root']['photo']['upload']['premoderation'] === true) {
|
||||
if ($user->content('premoderation') === true) {
|
||||
$moderated = 1;
|
||||
} else {
|
||||
$moderated = 0;
|
||||
}
|
||||
} else {
|
||||
$moderated = 1;
|
||||
}
|
||||
DB::query('INSERT INTO photos VALUES (\'0\', :userid, :postbody, :photourl, :time, :timeup, :exif, 0, :moderated, :place, :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));
|
||||
echo json_encode(
|
||||
array(
|
||||
'id' => DB::query('SELECT id FROM photos ORDER BY id DESC LIMIT 1')[0]['id'],
|
||||
|
|
|
@ -47,8 +47,13 @@ use \App\Models\User;
|
|||
<?php
|
||||
$photos = DB::query('SELECT * FROM photos WHERE user_id=:uid ORDER BY id DESC', array(':uid'=>Auth::userid()));
|
||||
foreach ($photos as $p) {
|
||||
if ($p['moderated'] === 0) {
|
||||
$color = 's0';
|
||||
} else {
|
||||
$color = 's12';
|
||||
}
|
||||
$author = new User($p['user_id']);
|
||||
echo ' <tr class="s12">
|
||||
echo ' <tr class="'.$color.'">
|
||||
<td class="pb-photo pb_photo">
|
||||
<a href="/photo/'.$p['id'].'/" target="_blank" class="prw">
|
||||
<img src="'.$p['photourl'].'" class="f">
|
||||
|
|
Loading…
Reference in a new issue