diff --git a/app/Controllers/Api/Images/Comments/Create.php b/app/Controllers/Api/Images/Comments/Create.php index b0c45fd..89bebb2 100644 --- a/app/Controllers/Api/Images/Comments/Create.php +++ b/app/Controllers/Api/Images/Comments/Create.php @@ -4,15 +4,15 @@ namespace App\Controllers\Api\Images\Comments; use App\Services\{Auth, Router, GenerateRandomStr, DB, Json, Files, Shell}; use App\Models\Notification; - +use App\Services\Upload as Upload; class Create { - + static $filesrc; private static function create($content, $id) { - DB::query('INSERT INTO photos_comments VALUES (\'0\', :userid, :postid, :postbody, :time, :content)', array('postid' => $_POST['id'], ':postbody' => $_POST['wtext'], ':userid' => Auth::userid(), ':time' => time(), ':content'=>'')); + DB::query('INSERT INTO photos_comments VALUES (\'0\', :userid, :postid, :postbody, :time, :content)', array('postid' => $_POST['id'], ':postbody' => $_POST['wtext'], ':userid' => Auth::userid(), ':time' => time(), ':content'=>$content)); } public function __construct() { @@ -21,15 +21,54 @@ class Create if ((int)$id === DB::query('SELECT id FROM photos WHERE id=:id', array(':id' => $id))[0]['id']) { - $content = Json::return( - array( - 'type' => 'none', - 'by' => 'user' - ) - ); + if ($_FILES['filebody']['error'] != 4) { + $finfo = finfo_open(FILEINFO_MIME_TYPE); + $mime = finfo_file($finfo, $_FILES['filebody']['tmp_name']); + finfo_close($finfo); + $filename = GenerateRandomStr::gen_uuid(); + if (preg_match('/^image\//', $mime)) { + $info = getimagesize($_FILES['filebody']['tmp_name']); - if (strlen($postbody) < 4096 || strlen($postbody) > 1) { - if (trim($postbody) != '') { + if ($info['mime'] == 'image/jpeg') + $image = imagecreatefromjpeg($_FILES['filebody']['tmp_name']); + elseif ($info['mime'] == 'image/gif') + $image = imagecreatefromgif($_FILES['filebody']['tmp_name']); + elseif ($info['mime'] == 'image/png') + $image = imagecreatefrompng($_FILES['filebody']['tmp_name']); + $type = 'img'; + $destination = '/cdn/temp/'.$filename.'.jpg'; + imagejpeg($image, $_SERVER['DOCUMENT_ROOT'].$destination, 60); + + } else if (preg_match('/^audio\//', $mime)) { + return "Аудио"; + } else if (preg_match('/^video\//', $mime)) { + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + $ffmpeg = \FFMpeg\FFMpeg::create(array( + 'ffmpeg.binaries' => $_SERVER['DOCUMENT_ROOT'] . '/app/Controllers/Exec/ffmpeg.exe', + 'ffprobe.binaries' => $_SERVER['DOCUMENT_ROOT'] . '/app/Controllers/Exec/ffprobe.exe', + 'timeout' => 3600, // The timeout for the underlying process + 'ffmpeg.threads' => 12, // The number of threads that FFMpeg should use + ), $logger); + } else { + $ffmpeg = \FFMpeg\FFMpeg::create(); + } + $video = $ffmpeg->open($_FILES['filebody']['tmp_name']); + $video->save(new \FFMpeg\Format\Video\X264(), $_SERVER['DOCUMENT_ROOT'] . "/cdn/temp/" . $filename . '.mp4'); + $video->frame(\FFMpeg\Coordinate\TimeCode::fromSeconds(1))->save($_SERVER['DOCUMENT_ROOT'] . "/cdn/temp/VIDPRV_" . $filename . '.jpg'); + $type = 'video'; + $destination = '/cdn/temp/'.$filename.'.mp4'; + $destination_vidprv = '/cdn/temp/VIDPRV'.$filename.'.jpg'; + } else { + return "Неизвестный тип файла"; + } + + $upload = new Upload($_SERVER['DOCUMENT_ROOT'].$destination, 'cdn/'.$type.'/'); + self::$filesrc = $upload->getSrc(); + } + + + if ((strlen($postbody) < 4096 || strlen($postbody) > 1) || $_FILES['filebody']['error'] != 4) { + if (trim($postbody) != '' || $_FILES['filebody']['error'] != 4) { $postbody = ltrim($postbody); echo json_encode( array( @@ -48,17 +87,24 @@ class Create } else { die(json_encode( array( - 'errorcode' => '1', + 'errorcode' => '2', 'error' => 1 ) )); } - + $content = Json::return( + array( + 'type' => 'none', + 'by' => 'user', + 'filetype' => $type, + 'src' => self::$filesrc + ) + ); self::create($content, $id); } else { die(json_encode( array( - 'errorcode' => '1', + 'errorcode' => '3', 'error' => 1 ) )); diff --git a/app/Controllers/Api/Images/Rate.php b/app/Controllers/Api/Images/Rate.php index 377fbd8..3730ebd 100644 --- a/app/Controllers/Api/Images/Rate.php +++ b/app/Controllers/Api/Images/Rate.php @@ -15,7 +15,7 @@ class Rate if (isset($_GET['vote']) && isset($_GET['pid'])) { if (Vote::photo(Auth::userid(), $_GET['pid']) === -1) { - DB::query('INSERT INTO photos_rates VALUES (\'0\', :id, :pid, :type)', array(':id'=>Auth::userid(), ':pid' => $_GET['pid'], ':type'=>$_GET['vote'])); + DB::query('INSERT INTO photos_rates VALUES (\'0\', :id, :pid, :type, 0)', array(':id'=>Auth::userid(), ':pid' => $_GET['pid'], ':type'=>$_GET['vote'])); if (Vote::photo(Auth::userid(), $_GET['pid']) != $_GET['vote']) { DB::query('DELETE FROM photos_rates WHERE user_id=:id AND photo_id=:pid AND type=:type', array(':id'=>Auth::userid(), ':pid' => $_GET['pid'], ':type'=>Vote::photo(Auth::userid(), $_GET['pid']))); } diff --git a/app/Controllers/Api/Register.php b/app/Controllers/Api/Register.php index aa960b3..a7eb17d 100644 --- a/app/Controllers/Api/Register.php +++ b/app/Controllers/Api/Register.php @@ -7,7 +7,9 @@ use \App\Controllers\ExceptionRegister; use \App\Core\Page; use donatj\UserAgent\UserAgentParser; - +use PHPMailer\PHPMailer\PHPMailer; +use PHPMailer\PHPMailer\Exception; +use Beeyev\DisposableEmailFilter\DisposableEmailFilter; class Register { @@ -294,6 +296,7 @@ class Register $password = $_POST['password']; $email = $_POST['email']; $forbusernames = explode(',', NGALLERY['root']['registration']['prohibited_usernames']); + $status = 0; if (!self::checkforb($_POST['username'], $forbusernames)) { if (!strcasecmp(DB::query('SELECT username FROM users WHERE (LOWER(username) LIKE :username)', array(':username' => '%' . $username . '%'))[0]['username'], $username) === false) { @@ -315,11 +318,107 @@ class Register 'regdate' => time() ) ); + if (NGALLERY['root']['registration']['emailverify'] == 'true') { + $status === 3; + } + DB::query('INSERT INTO users VALUES (\'0\', :username, :email, :password, :photourl, 5, :online, 0, :status, :content)', array(':username' => ltrim($username), ':password' => password_hash(ltrim($password), PASSWORD_BCRYPT), ':photourl' => '/static/img/avatar.png', ':email' => $email, ':content' => $content, ':online' => time(), ':status'=>$status)); + if (NGALLERY['root']['registration']['emailverify'] == 'true') { + $disposableEmailFilter = new DisposableEmailFilter(); + if ($disposableEmailFilter->isDisposableEmailAddress($_POST['email'])) { + echo json_encode( + array( + 'errorcode' => '9', + 'errortitle' => 'Почта запрещена для регистрации', + 'error' => 1 + ) + ); + die(); + } + $token = GenerateRandomStr::gen_uuid(); + $user_id = DB::query('SELECT id FROM users WHERE username=:username', array(':username' => $username))[0]['id']; + $key = GenerateRandomStr::gen_uuid(); + $content = Json::return( + array( + 'user_id' => $user_id + ) + ); + $mail = new PHPMailer(true); + DB::query('INSERT INTO servicekeys VALUES (\'0\', :token, :type, 1, :content)', array(':token'=>$key, ':type'=>'EMAILVERIFY', ':content'=>$content)); + try { + $mail->isSMTP(); + $mail->Host = NGALLERY['root']['email']['credentials']['host']; + $mail->SMTPAuth = true; + $mail->CharSet = "UTF-8"; + $mail->Username = NGALLERY['root']['email']['credentials']['username']; + $mail->Password = NGALLERY['root']['email']['credentials']['password']; + $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; + $mail->Port = NGALLERY['root']['email']['credentials']['port']; - DB::query('INSERT INTO users VALUES (\'0\', :username, :email, :password, :photourl, 5, :online, 0, 0, :content)', array(':username' => ltrim($username), ':password' => password_hash(ltrim($password), PASSWORD_BCRYPT), ':photourl' => '/static/img/avatar.png', ':email' => $email, ':content' => $content, ':online' => time())); - $cstrong = True; - $token = GenerateRandomStr::gen_uuid(); - $user_id = DB::query('SELECT id FROM users WHERE username=:username', array(':username' => $username))[0]['id']; + $mail->setFrom(NGALLERY['root']['email']['from']['address'], NGALLERY['root']['title']); + $mail->addAddress($_POST['email']); + + $mail->isHTML(true); + $mail->Subject = 'Подтверждение регистрации | '.NGALLERY['root']['title']; + + $mail->Body = ' + + + + + + + + +
+

Подтверждение регистрации

+

Это письмо было отправлено на ваш почтовый ящик, так как оно было указано при регистрации на '.NGALLERY['root']['title'].' ('.$_SERVER['HTTP_HOST'].')
Если вы его не запрашивали, проигнорируйте его.



Ссылка для подтверждения адреса: https://'.$_SERVER['HTTP_HOST'].'/api/users/emailverify?token='.$key.' +
+ + '; + + + $mail->send(); + } catch (Exception $e) { + echo json_encode( + array( + 'errorcode' => '8', + 'errortitle' => 'Не удалось отправить письмо: '.$mail->ErrorInfo, + 'error' => 1, + ) + ); + die(); + } + } + if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; @@ -328,19 +427,11 @@ class Register } else { $ip = $_SERVER['REMOTE_ADDR']; } - - $parser = new UserAgentParser(); - - $ua = $parser->parse(); - $ua = $parser(); - - $servicekey = GenerateRandomStr::gen_uuid(); $url = 'http://ip-api.com/json/' . $ip; $response = file_get_contents($url); $data = json_decode($response, true); - $loc = $data['country'] . ', ' . $data['city']; DB::query('INSERT INTO login_tokens VALUES (\'0\', :token, :user_id)', array( ':token' => $token, ':user_id' => $user_id, @@ -350,7 +441,6 @@ class Register setcookie("NGALLERYSESS", $token, time() + 120 * 180 * 240 * 720, '/', NULL, NULL, TRUE); setcookie("NGALLERYSESS_", '1', time() + 120 * 180 * 240 * 360, '/', NULL, NULL, TRUE); setcookie("NGALLERYID", $user_id, time() + 10 * 10 * 24 * 72, '/', NULL, NULL, TRUE); - echo json_encode( array( 'errorcode' => '0', diff --git a/app/Controllers/Api/Users/EmailVerify.php b/app/Controllers/Api/Users/EmailVerify.php new file mode 100644 index 0000000..e8ac8c2 --- /dev/null +++ b/app/Controllers/Api/Users/EmailVerify.php @@ -0,0 +1,25 @@ +$_GET['token']))[0]; + $user_id = json_decode($data['content'], true)['user_id']; + if ($data['status'] != 0) { + DB::query('UPDATE users SET status=0 WHERE id=:id', [':id' => $user_id]); + DB::query('UPDATE servicekeys SET status=0 WHERE token=:id', [':id' => $_GET['token']]); + Page::set('System/EmailVerify'); + } + } + } +} diff --git a/app/Controllers/ApiController.php b/app/Controllers/ApiController.php index 1963702..05e4220 100644 --- a/app/Controllers/ApiController.php +++ b/app/Controllers/ApiController.php @@ -21,6 +21,7 @@ use \App\Controllers\Api\Images\Comments\Rate as PhotoCommentVote; use \App\Controllers\Api\Vehicles\Load as VehiclesLoad; use \App\Controllers\Api\Profile\Update as ProfileUpdate; use \App\Controllers\Api\Users\LoadUser as UserLoad; +use \App\Controllers\Api\Users\EmailVerify as EmailVerify; use \App\Controllers\Api\Admin\Images\SetVisibility as AdminPhotoSetVisibility; use \App\Controllers\Api\Admin\CreateNews as AdminCreateNews; use \App\Controllers\Api\Admin\LoadNews as AdminLoadNews; @@ -38,6 +39,9 @@ class ApiController public static function upload() { return new Upload(); } + public static function emailverify() { + return new EmailVerify(); + } public static function photovote() { return new PhotoVote(); } diff --git a/app/Controllers/Exec/RenderVideo.ps1 b/app/Controllers/Exec/RenderVideo.ps1 new file mode 100644 index 0000000..aed7411 --- /dev/null +++ b/app/Controllers/Exec/RenderVideo.ps1 @@ -0,0 +1,27 @@ + +$tempfile = $args[0] +$weburl = $args[1] +$id = $args[2] + +#$tempfile = 'G:\video.mp4' +#$weburl = 'kandle.loc' +#$id = '40' + +$hash = -join (((48..57)+(65..90)+(97..122)) * 80 |Get-Random -Count 32 |%{[char]$_}) +$hashT = -join (((48..57)+(65..90)+(97..122)) * 80 |Get-Random -Count 222 |%{[char]$_}) +$temp = [System.IO.Path]::GetTempFileName() + +$shell = Get-WmiObject Win32_process -filter "ProcessId = $PID" +$shell.SetPriority(16384) + +Copy-Item $tempfile E:\$hash + +E:\Maksim\kandle\app\Controllers\Video\Exec\ffmpeg.exe -i E:\$hash -c:v libx264 -q:v 7 -c:a libmp3lame -q:a 4 -tune zerolatency -y C:\kandletemp\$hashT.mp4 + +$uri = 'http://'+$weburl+'/api/video/exec/upload?file=C:\kandletemp\'+$hashT+'.mp4&videoid='+$id + +Invoke-WebRequest -Uri $uri + +Remove-Item C:\kandletemp\$hashT.mp4 + + diff --git a/app/Controllers/Exec/RenderVideo.sh b/app/Controllers/Exec/RenderVideo.sh new file mode 100644 index 0000000..f55b272 --- /dev/null +++ b/app/Controllers/Exec/RenderVideo.sh @@ -0,0 +1,14 @@ +tmpfile="$RANDOM-$(date +%s%N)" +copyfile="$0" +weburl="$1" +videoid="$2" + +#copyfile='/var/www/fastuser/data/www/kandle.cats.ovh/video.mp4' +#weburl='kandle.loc' +#videoid='1' + +cp $1 "/tmp/vid_$tmpfile.bin" + +nice -n 20 ffmpeg -i "/tmp/vid_$tmpfile.bin" -c:v libx264 -q:v 7 -c:a libmp3lame -q:a 4 -tune zerolatency -y "$4/cdn/temp/ffmOi$tmpfile.mp4" + +curl "http://$2/api/video/exec/upload?file=$4/cdn/temp/ffmOi$tmpfile.mp4&videoid=$3" diff --git a/app/Controllers/Exec/ffmpeg.exe b/app/Controllers/Exec/ffmpeg.exe new file mode 100644 index 0000000..af99a49 Binary files /dev/null and b/app/Controllers/Exec/ffmpeg.exe differ diff --git a/app/Controllers/Exec/ffprobe.exe b/app/Controllers/Exec/ffprobe.exe new file mode 100644 index 0000000..8ddd77c Binary files /dev/null and b/app/Controllers/Exec/ffprobe.exe differ diff --git a/app/Controllers/MainController.php b/app/Controllers/MainController.php index 146f5df..d61b707 100644 --- a/app/Controllers/MainController.php +++ b/app/Controllers/MainController.php @@ -72,6 +72,16 @@ class MainController { Page::set('FavAuthors'); + } + public static function emailverify() + { + Page::set('Errors/EmailVerify'); + + } + public static function tour() + { + Page::set('Tour'); + } public static function robots() { echo 'User-Agent: * diff --git a/app/Core/Routes.php b/app/Core/Routes.php index 427427c..fac02d8 100644 --- a/app/Core/Routes.php +++ b/app/Core/Routes.php @@ -27,12 +27,14 @@ class Routes Router::get('/rules/photo', 'MainController@photoRules'); Router::get('/rules/video', 'MainController@videoRules'); Router::get('/feed', 'MainController@feed'); + Router::get('/tour', 'MainController@tour'); Router::get('/update', 'MainController@update'); Router::get('/top30', 'MainController@top30'); Router::get('/photoext', 'PhotoController@photoext'); Router::get('/api/photo/compress', 'ApiController@photocompress'); Router::get('/api/photo/loadrecent', 'ApiController@recentphotos'); Router::get('/api/users/load/$id', 'ApiController@loaduser'); + Router::get('/api/users/emailverify', 'ApiController@emailverify'); Router::get('/article/$id', 'MainController@gallery'); @@ -43,7 +45,6 @@ class Routes Router::get('/lk/history', 'ProfileController@lkhistory'); Router::get('/lk/profile', 'ProfileController@lkprofile'); Router::get('/lk/pday', 'ProfileController@photoindexhistory'); - Router::get('/fav_authors', 'MainController@favauthors'); Router::get('/search', 'SearchController@i'); diff --git a/app/Models/Comment.php b/app/Models/Comment.php index 1d66ff1..99298cf 100644 --- a/app/Models/Comment.php +++ b/app/Models/Comment.php @@ -1,68 +1,83 @@ c = $user_id; } - public function class($class) { + public function class($class) + { $this->class = $class; } - public function content($table) { + public function content($table) + { $content = json_decode($this->c['content'], true); return $content[$table]; } - public function i() { + public function i() + { $user = new User($this->c['user_id']); $content = json_decode($this->c['content'], true); - echo '
+ echo '
- '.Date::zmdate($this->c['posted_at']).'
+ ' . Date::zmdate($this->c['posted_at']) . '
Цитировать · - Ссылка + Ссылка '; - - echo ' + + echo '
-
'.htmlspecialchars($user->i('username')).' · +
' . htmlspecialchars($user->i('username')) . ' · '; - if (json_decode($user->i('content'), true)['aboutrid']['value'] != null) { - echo ''; - } - if (json_decode($user->i('content'), true)['aboutlive']['value'] != null) { - echo ' '.htmlspecialchars(json_decode($user->i('content'), true)['aboutlive']['value']); - } - if ($content['edited'] === 'true') { - echo '
(отредактировано)'; - } - if ($user->i('admin') === 1) { - $admintype = ' · Администратор сервера'; - } else if ($user->i('admin') === 2) { - $admintype = ' · Фотомодератор'; - } - if ((int)Vote::countcommrates($this->c['id'], -1) >= 1) { - $commclass = 'pro'; - $symb = '+'; - } else if ((int)Vote::countcommrates($this->c['id'], -1) < 0) { - $commclass = 'con'; - $symb = ''; - } else if ((int)Vote::countcommrates($this->c['id'], -1) === 0) { - $commclass = ''; - } - echo '
-
Фото: '.Photo::fetchAll($this->c['user_id']).' '.$admintype.'
-
'.preg_replace("~(?:[\p{M}]{1})([\p{M}])+?~uis","", htmlspecialchars($this->c['body'])).'
+ if (json_decode($user->i('content'), true)['aboutrid']['value'] != null) { + echo ''; + } + if (json_decode($user->i('content'), true)['aboutlive']['value'] != null) { + echo ' ' . htmlspecialchars(json_decode($user->i('content'), true)['aboutlive']['value']); + } + if ($content['edited'] === 'true') { + echo '
(отредактировано)'; + } + if ($user->i('admin') === 1) { + $admintype = ' · Администратор сервера'; + } else if ($user->i('admin') === 2) { + $admintype = ' · Фотомодератор'; + } + if ((int)Vote::countcommrates($this->c['id'], -1) >= 1) { + $commclass = 'pro'; + $symb = '+'; + } else if ((int)Vote::countcommrates($this->c['id'], -1) < 0) { + $commclass = 'con'; + $symb = ''; + } else if ((int)Vote::countcommrates($this->c['id'], -1) === 0) { + $commclass = ''; + } + echo '
+
Фото: ' . Photo::fetchAll($this->c['user_id']) . ' ' . $admintype . '
+
' . preg_replace("~(?:[\p{M}]{1})([\p{M}])+?~uis", "", htmlspecialchars($this->c['body'])) . '
+ '; + if ($content['filetype'] === 'img') { + echo '
'; + } + if ($content['filetype'] === 'video') { + echo '
'; + } + echo '
'; - echo ''; - if ($this->c['user_id'] === Auth::userid()) { - echo ' + if ($this->c['user_id'] === Auth::userid()) { + echo ' '; } - - - -} \ No newline at end of file +} diff --git a/app/Services/Upload.php b/app/Services/Upload.php index 24ae352..c38dcfc 100644 --- a/app/Services/Upload.php +++ b/app/Services/Upload.php @@ -28,7 +28,7 @@ class Upload $tmpname = $file['tmp_name']; $type = explode('/', $file['type'])[0]; $name = $file['name']; - $fileext = pathinfo($file['name']); + $fileext = pathinfo($file['name'], PATHINFO_EXTENSION); } else { $tmpname = $file; $type = filetype($file); @@ -64,7 +64,7 @@ class Upload ], 'endpoint' => NGALLERY['root']['storage']['s3']['domains']['gateway'], ]); - + $s3->putObject([ 'Bucket' => NGALLERY['root']['storage']['s3']['credentials']['bucket'], 'Key' => $location.$filecdn, @@ -77,18 +77,16 @@ class Upload } else { - $location = "your-location"; + $location = "your-location"; $folder = "{$location}/" . basename($tmpname); - - $uploadDir = "{$_SERVER['DOCUMENT_ROOT']}/uploads/{$location}"; + + $uploadDir = "{$_SERVER['DOCUMENT_ROOT']}/uploads/{$location}"; if (!is_dir($uploadDir)) { mkdir($uploadDir, 0777, true); } $destination = "{$uploadDir}/" . basename($tmpname); - - $this->type = $type; $this->src = "/uploads/{$folder}"; diff --git a/composer.json b/composer.json index 2ee63e3..d242dae 100644 --- a/composer.json +++ b/composer.json @@ -20,6 +20,8 @@ "donatj/phpuseragentparser": "^1.8", "php-ffmpeg/php-ffmpeg": "^1.2", "chriskonnertz/bbcode": "^1.1", - "paquettg/php-html-parser": "^2.2" + "paquettg/php-html-parser": "^2.2", + "phpmailer/phpmailer": "^6.9", + "beeyev/disposable-email-filter-php": "^1.3" } } diff --git a/composer.lock b/composer.lock index 7297290..a21058d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "31de33165b326f2edef27c1fc9ae5b08", + "content-hash": "ec83690d34b55f6ada188bcfc6a299db", "packages": [ { "name": "aws/aws-crt-php", @@ -155,6 +155,77 @@ }, "time": "2024-07-03T18:12:51+00:00" }, + { + "name": "beeyev/disposable-email-filter-php", + "version": "v1.3.83", + "source": { + "type": "git", + "url": "https://github.com/beeyev/disposable-email-filter-php.git", + "reference": "9ee8422c390d0ce0fff25ff5616a4b9654f73bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/beeyev/disposable-email-filter-php/zipball/9ee8422c390d0ce0fff25ff5616a4b9654f73bb0", + "reference": "9ee8422c390d0ce0fff25ff5616a4b9654f73bb0", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "ext-json": "*", + "friendsofphp/php-cs-fixer": "^3.4", + "kubawerlos/php-cs-fixer-custom-fixers": "^3.7", + "phpstan/phpstan": "^1.11", + "phpstan/phpstan-phpunit": "^1.3", + "phpstan/phpstan-strict-rules": "^1.5", + "phpunit/phpunit": "^8.5 || ^9", + "symplify/phpstan-rules": "^12.3" + }, + "type": "library", + "extra": { + "laravel": { + "aliases": { + "DisposableEmail": "Beeyev\\DisposableEmailFilter\\Adapters\\Laravel\\Facades\\DisposableEmail" + }, + "providers": [ + "Beeyev\\DisposableEmailFilter\\Adapters\\Laravel\\DisposableEmailFilterServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Beeyev\\DisposableEmailFilter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alexander Tebiev", + "email": "alexander.tebiev@gmail.com", + "homepage": "https://github.com/beeyev/" + } + ], + "description": "Disposable (temporary/throwaway/fake) email detection library. Automatically updated every week.", + "homepage": "https://github.com/beeyev/disposable-email-filter-php", + "keywords": [ + "disposable", + "email", + "fake", + "temporary", + "throwaway" + ], + "support": { + "docs": "https://github.com/beeyev/disposable-email-filter-php/", + "issues": "https://github.com/beeyev/disposable-email-filter-php/issues", + "rss": "https://github.com/beeyev/disposable-email-filter-php/releases.atom", + "source": "https://github.com/beeyev/disposable-email-filter-php.git" + }, + "time": "2025-02-05T14:49:14+00:00" + }, { "name": "chriskonnertz/bbcode", "version": "v1.1.2", @@ -913,6 +984,87 @@ }, "time": "2024-01-02T10:37:01+00:00" }, + { + "name": "phpmailer/phpmailer", + "version": "v6.9.3", + "source": { + "type": "git", + "url": "https://github.com/PHPMailer/PHPMailer.git", + "reference": "2f5c94fe7493efc213f643c23b1b1c249d40f47e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/2f5c94fe7493efc213f643c23b1b1c249d40f47e", + "reference": "2f5c94fe7493efc213f643c23b1b1c249d40f47e", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-filter": "*", + "ext-hash": "*", + "php": ">=5.5.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "doctrine/annotations": "^1.2.6 || ^1.13.3", + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcompatibility/php-compatibility": "^9.3.5", + "roave/security-advisories": "dev-latest", + "squizlabs/php_codesniffer": "^3.7.2", + "yoast/phpunit-polyfills": "^1.0.4" + }, + "suggest": { + "decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication", + "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses", + "ext-openssl": "Needed for secure SMTP sending and DKIM signing", + "greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication", + "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", + "league/oauth2-google": "Needed for Google XOAUTH2 authentication", + "psr/log": "For optional PSR-3 debug logging", + "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)", + "thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPMailer\\PHPMailer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1-only" + ], + "authors": [ + { + "name": "Marcus Bointon", + "email": "phpmailer@synchromedia.co.uk" + }, + { + "name": "Jim Jagielski", + "email": "jimjag@gmail.com" + }, + { + "name": "Andy Prevost", + "email": "codeworxtech@users.sourceforge.net" + }, + { + "name": "Brent R. Matzelle" + } + ], + "description": "PHPMailer is a full-featured email creation and transfer class for PHP", + "support": { + "issues": "https://github.com/PHPMailer/PHPMailer/issues", + "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.9.3" + }, + "funding": [ + { + "url": "https://github.com/Synchro", + "type": "github" + } + ], + "time": "2024-11-24T18:04:13+00:00" + }, { "name": "psr/cache", "version": "3.0.0", @@ -2099,10 +2251,10 @@ "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, - "platform": [], - "platform-dev": [], + "platform": {}, + "platform-dev": {}, "plugin-api-version": "2.6.0" } diff --git a/index.php b/index.php index d9f7cb5..a9a57c9 100644 --- a/index.php +++ b/index.php @@ -37,4 +37,4 @@ class App } } -App::start(); +App::start(); \ No newline at end of file diff --git a/ngallery-example.yaml b/ngallery-example.yaml index 9c95862..e80dfac 100644 --- a/ngallery-example.yaml +++ b/ngallery-example.yaml @@ -13,6 +13,14 @@ ngallery: type: 'allow' countries: '' cloudflare-caching: false + email: + credentials: + host: 'example@mail.com' + username: '' + password: '' + port: 465 + from: + address: db: name: '' host: '' @@ -40,6 +48,7 @@ ngallery: proxy: true percent: 50 registration: + emailverify: false prohibited_usernames: '' access: public: true @@ -59,5 +68,3 @@ ngallery: allowgif: true comments: premoderation: false - - \ No newline at end of file diff --git a/sqlcore/base.sql b/sqlcore/base.sql index fa29881..b0db757 100644 --- a/sqlcore/base.sql +++ b/sqlcore/base.sql @@ -57,7 +57,7 @@ CREATE TABLE `login_tokens` ( `id` int NOT NULL, `token` text NOT NULL, `user_id` int NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- @@ -90,7 +90,7 @@ CREATE TABLE `photos` ( `place` text NOT NULL, `endmoderation` int NOT NULL DEFAULT '0', `content` text NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- @@ -104,7 +104,7 @@ CREATE TABLE `photos_comments` ( `photo_id` int NOT NULL, `body` text NOT NULL, `posted_at` int NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- @@ -117,7 +117,7 @@ CREATE TABLE `photos_comments_rates` ( `user_id` int NOT NULL, `comment_id` int NOT NULL, `type` int NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- @@ -130,7 +130,7 @@ CREATE TABLE `photos_rates` ( `user_id` int NOT NULL, `photo_id` int NOT NULL, `type` int NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -------------------------------------------------------- @@ -162,7 +162,7 @@ CREATE TABLE `users` ( `admin` int NOT NULL DEFAULT '0', `status` int NOT NULL DEFAULT '0', `content` text NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Индексы сохранённых таблиц diff --git a/sqlcore/sql_0001.sql b/sqlcore/sql_0001.sql index b08ea91..764b44f 100644 --- a/sqlcore/sql_0001.sql +++ b/sqlcore/sql_0001.sql @@ -7,7 +7,7 @@ CREATE TABLE IF NOT EXISTS `entities` ( `sampledata` text NOT NULL, `color` text NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; CREATE TABLE IF NOT EXISTS `entities_data` ( `id` int NOT NULL AUTO_INCREMENT, @@ -17,21 +17,21 @@ CREATE TABLE IF NOT EXISTS `entities_data` ( `comment` text NOT NULL, `content` text NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; CREATE TABLE IF NOT EXISTS `galleries` ( `id` int NOT NULL AUTO_INCREMENT, `title` text NOT NULL, `opened` int NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; CREATE TABLE IF NOT EXISTS `photos_favorite` ( `id` int NOT NULL AUTO_INCREMENT, `photo_id` int NOT NULL, `user_id` int NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; CREATE TABLE IF NOT EXISTS `uploadindex_history` ( `id` int NOT NULL AUTO_INCREMENT, @@ -42,7 +42,7 @@ CREATE TABLE IF NOT EXISTS `uploadindex_history` ( `type` int NOT NULL, `photo_id` int NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Изменение существующих таблиц @@ -61,7 +61,7 @@ MODIFY COLUMN `online` int NOT NULL DEFAULT '0', MODIFY COLUMN `admin` int NOT NULL; -- Обновление кодировки для таблиц, использующих utf8 -ALTER TABLE `followers` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci; -ALTER TABLE `followers_notifications` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci; -ALTER TABLE `news` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci; -ALTER TABLE `photos_views` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci; \ No newline at end of file +ALTER TABLE `followers` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE `followers_notifications` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE `news` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +ALTER TABLE `photos_views` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; \ No newline at end of file diff --git a/static/img/tour1.png b/static/img/tour1.png new file mode 100644 index 0000000..2b56208 Binary files /dev/null and b/static/img/tour1.png differ diff --git a/static/img/tour2.png b/static/img/tour2.png new file mode 100644 index 0000000..5973e71 Binary files /dev/null and b/static/img/tour2.png differ diff --git a/static/img/tour3.png b/static/img/tour3.png new file mode 100644 index 0000000..798173a Binary files /dev/null and b/static/img/tour3.png differ diff --git a/static/kolya.mp3 b/static/kolya.mp3 new file mode 100644 index 0000000..6c6e90f Binary files /dev/null and b/static/kolya.mp3 differ diff --git a/views/components/LoadHead.php b/views/components/LoadHead.php index 0bf9bc7..c853c61 100644 --- a/views/components/LoadHead.php +++ b/views/components/LoadHead.php @@ -27,6 +27,7 @@ +
diff --git a/views/components/Navbar.php b/views/components/Navbar.php index 6172f2e..f57ab3e 100644 --- a/views/components/Navbar.php +++ b/views/components/Navbar.php @@ -28,6 +28,12 @@ if ($noncheckedimgs > 0) { ?> +i('status') === 3) { ?> +
+

Пожалуйста, подтвердите свою почту

+
Так мы сможем убедиться, что Вы настоящий человек. После подтверждения, Вам будет доступен полностью функционал сайта.

Письмо с ссылкой для подтверждения почты была отправлена на Ваш ящик, указанный при регистрации.
+ @@ -100,8 +106,10 @@ if ($noncheckedimgs > 0) { ?>
  • Admin
  • - + i('status') != 3) { ?>
  • Предложить медиа
  • +
  • Журнал
  • Конкурс
  • Правка БД
  • diff --git a/views/pages/Errors/StreamsNotAllowed.php b/views/pages/Errors/StreamsNotAllowed.php deleted file mode 100644 index 79252d7..0000000 --- a/views/pages/Errors/StreamsNotAllowed.php +++ /dev/null @@ -1,46 +0,0 @@ - - - - - Resource Busy - - -
    - Error -

    Вы не участвуете в программе тестирования Birux Streams

    - К сожалению, мы уже набрали достаточное количество участников. Следующая волна заявок будет скоро — следите в Telegram-канале - Birux - -
    - - - - - diff --git a/views/pages/Errors/StreamsNotYour.php b/views/pages/Errors/StreamsNotYour.php deleted file mode 100644 index fa29b9a..0000000 --- a/views/pages/Errors/StreamsNotYour.php +++ /dev/null @@ -1,44 +0,0 @@ - - - - - Resource Busy - - -
    - Error -

    Доступ запрещён!

    - Такие дела. Эфир не принадлежит вам. -
    - - - - - diff --git a/views/pages/Photo.php b/views/pages/Photo.php index a3bb441..8980087 100644 --- a/views/pages/Photo.php +++ b/views/pages/Photo.php @@ -247,7 +247,7 @@ if ($photo->i('id') !== null) {
    Рейтинг:
    0) { ?> + if (Auth::userid() > 0 && (NGALLERY['root']['registration']['emailverify'] != true || $user->i('status') != 3)) { ?>
    @@ -616,21 +617,100 @@ if ($photo->i('id') !== null) {

    Ваш комментарий

    +
    -
    + 0) { + if (NGALLERY['root']['registration']['emailverify'] != true || $user->i('status') != 3) { ?> +
    +
    -
      Ctrl + Enter +
    +
    + + +
    +
    +
    @@ -663,67 +743,64 @@ if ($photo->i('id') !== null) { + i('status') === 3) { + die('Чтобы публиковать Фотографии и Видео, нужно подтвердить почту.'); + } ?>

    Предложить медиа на публикацию

    Ваш текущий индекс загрузки: i('uploadindex') ?>

    diff --git a/views/pages/Register.php b/views/pages/Register.php index 0df48c0..8efe318 100644 --- a/views/pages/Register.php +++ b/views/pages/Register.php @@ -98,6 +98,7 @@ if (Auth::userid() > 0) {

    Регистрируясь на сервере , вы принимаете его правила.

    +

    Вы можете пройти экскурсию по сайту.




    diff --git a/views/pages/System/EmailVerify.php b/views/pages/System/EmailVerify.php new file mode 100644 index 0000000..5edada3 --- /dev/null +++ b/views/pages/System/EmailVerify.php @@ -0,0 +1,36 @@ + + + + + + + + + + + + +
    + + + + + + + + + +
    +

    Спасибо, ваша почта подтверждена.

    + +
    + + + + \ No newline at end of file diff --git a/views/pages/Tour.php b/views/pages/Tour.php new file mode 100644 index 0000000..b6ec6e5 --- /dev/null +++ b/views/pages/Tour.php @@ -0,0 +1,843 @@ + + + + + + + + + + + + +
    + + +
    + + + + + + + +
    +
    + +
    + Неизвестен — Tele 2 - X_й дозвонишься.mp3 +
    +
    + +
    +
    + 00:00 / 00:06 +
    + + + +
    +
    +
    +
    + + + +
    + + + +
    +

    Экскурсия по сайту

    + + + + + + +
    + + +
    +

    С чего начать?

    +
      +
    • Регистрация аккаунта является самым первым и основным этапом в начале вашего пути на данном сайте.
    • +
    • Для регистрации вам потребуется ввести Логин, E-mail и пароль.
    • +
    • В качестве логина для входа на сайт, Вы можете использовать свой E-mail или никнейм, указанный при регистрации.
    • +
    + +

    Регистрируясь на сайте, вы соглашаетесь с правилами сайта

    +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    + + + + + \ No newline at end of file diff --git a/views/pages/t.php b/views/pages/t.php index 7f386f2..5a56cc1 100644 --- a/views/pages/t.php +++ b/views/pages/t.php @@ -1,95 +1,69 @@ - - - - - + - Таймер обратного отсчета + Mini Vidéoplayer -
    -

    -
    00:00:00
    - +
    + +
    + + + +
    +
    +
    +
    +
    -