diff --git a/app/Controllers/Api/Images/Upload.php b/app/Controllers/Api/Images/Upload.php index b63208c..fe4ea99 100644 --- a/app/Controllers/Api/Images/Upload.php +++ b/app/Controllers/Api/Images/Upload.php @@ -16,6 +16,10 @@ class Upload static $photourl; static $vidpreview; static $videourl; + static $comments = 'allowed'; + static $rating = 'allowed'; + static $showtop = 'allowed'; + static $subsnotify = 'allowed'; public static function create($postbody, $content, $exif) { @@ -30,7 +34,7 @@ class Upload $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)); - if ($moderated === 1) { + if (($moderated === 1) && (self::$subsnotify != 'disabled')) { $followers = DB::query('SELECT * FROM followers WHERE user_id=:uid', array(':uid' => Auth::userid())); foreach ($followers as $f) { DB::query('INSERT INTO followers_notifications VALUES (\'0\', :uid, :fid, :pid, 0)', array(':uid' => Auth::userid(), ':fid' => $f['follower_id'], ':pid' => DB::query('SELECT * FROM photos ORDER BY id DESC LIMIT 1')[0]['id'])); @@ -130,6 +134,18 @@ class Upload $_POST['lat'] = null; $_POST['lng'] = null; } + if ($_POST['disablecomments'] === 1) { + self::$comments = 'disabled'; + } + if ($_POST['disablerating'] === 1) { + self::$rating = 'disabled'; + } + if ($_POST['disableshowtop'] === 1) { + self::$showtop = 'disabled'; + } + if ($_POST['disablesubsnotify'] === 1) { + self::$subsnotify = 'disabled'; + } if ($upload->getType() !== null) { $content = Json::return( array( @@ -138,7 +154,10 @@ class Upload 'copyright' => $_POST['license'], 'comment' => $_POST['descr'], 'lat' => $_POST['lat'], - 'lng' => $_POST['lng'] + 'lng' => $_POST['lng'], + 'comments' => self::$comments, + 'rating' => self::$rating, + 'showtop' => self::$showtop, ) ); if (explode('/', $type)[0] === 'video') { diff --git a/views/pages/Forum/Index.php b/views/pages/Forum/Index.php new file mode 100644 index 0000000..e69de29 diff --git a/views/pages/Photo.php b/views/pages/Photo.php index b47c06f..31db6fa 100644 --- a/views/pages/Photo.php +++ b/views/pages/Photo.php @@ -225,7 +225,7 @@ if ($photo->i('id') !== null) { - i('moderated') === 1) { ?> + i('moderated') === 1 && json_decode($c['content'], true)['rating'] != 'disabled') { ?>
Комментарии отключены пользователем или по усмотрению Администрации.
Количество ваших фотографий на сайте: =DB::query('SELECT COUNT(*) FROM photos WHERE user_id=:uid AND moderated=1', array(':uid'=>Auth::userid()))[0]['COUNT(*)']?>
+
Всего фотографий в очереди на публикацию: =DB::query('SELECT COUNT(*) FROM photos WHERE moderated=0')[0]['COUNT(*)']?>