diff --git a/app/Controllers/Api/Admin/Models/RequestHandler.php b/app/Controllers/Api/Admin/Models/RequestHandler.php new file mode 100644 index 0000000..d4fc54b --- /dev/null +++ b/app/Controllers/Api/Admin/Models/RequestHandler.php @@ -0,0 +1,34 @@ + $id))[0]; + if ($modelrequest) { + if ($type === 'accept') { + DB::query('INSERT INTO entities_data VALUES (\'0\', :title, :createdate, :entityid, NULL, :content)', array(':title' => $modelrequest['title'], ':createdate' => time(), ':entityid' => $modelrequest['entityid'], ':content' => $modelrequest['data'])); + DB::query('UPDATE entities_requests SET status=1 WHERE id=:id', array(':id' => $id)); + } else if ($type === 'decline') { + DB::query('UPDATE entities_requests SET status=2 WHERE id=:id', array(':id' => $id)); + } + } + echo json_encode( + array( + 'errorcode' => '0', + 'error' => 0, + ) + ); + } +} diff --git a/app/Controllers/Api/Admin/CreateNews.php b/app/Controllers/Api/Admin/News/Create.php similarity index 88% rename from app/Controllers/Api/Admin/CreateNews.php rename to app/Controllers/Api/Admin/News/Create.php index b44e5d1..d81b9d9 100644 --- a/app/Controllers/Api/Admin/CreateNews.php +++ b/app/Controllers/Api/Admin/News/Create.php @@ -1,6 +1,6 @@ $postId)); + echo json_encode( + array( + 'errorcode' => 0, + 'error' => 0 + ) + ); + } +} diff --git a/app/Controllers/Api/Admin/LoadNews.php b/app/Controllers/Api/Admin/News/Load.php similarity index 59% rename from app/Controllers/Api/Admin/LoadNews.php rename to app/Controllers/Api/Admin/News/Load.php index 5f00b95..01d20ef 100644 --- a/app/Controllers/Api/Admin/LoadNews.php +++ b/app/Controllers/Api/Admin/News/Load.php @@ -1,6 +1,6 @@
' . Date::zmdate($n['time']) . '
' . $n['body'] . '
'; + $nn = new \App\Models\Admin\News($n['id']); + $nn->view(); } } } diff --git a/app/Controllers/Api/Login.php b/app/Controllers/Api/Login.php index a734807..3d3f889 100644 --- a/app/Controllers/Api/Login.php +++ b/app/Controllers/Api/Login.php @@ -15,10 +15,9 @@ class Login { $username = $_POST['username']; $password = $_POST['password']; - if (DB::query('SELECT email FROM users WHERE email=:username OR username=:username', array(':username' => $username))) { - $email = DB::query('SELECT email FROM users WHERE email=:username OR username=:username', array(':username' => $username))[0]['email']; + if (DB::query('SELECT email FROM users WHERE (LOWER(username) LIKE :username1) OR (LOWER(email) LIKE :username2)', array(':username1' => '%'.$username.'%', ':username2' => '%'.$username.'%'))) { + $email = DB::query('SELECT email FROM users WHERE (LOWER(username) LIKE :username1) OR (LOWER(email) LIKE :username2)', array(':username1' => '%'.$username.'%', ':username2' => '%'.$username.'%'))[0]['email']; if (password_verify($password, DB::query('SELECT password FROM users WHERE email=:username', array(':username' => $email))[0]['password'])) { - $cstrong = True; $token = GenerateRandomStr::gen_uuid(); $user_id = DB::query('SELECT id FROM users WHERE email=:username', array(':username' => $email))[0]['id']; @@ -50,7 +49,7 @@ class Login $iv = openssl_random_pseudo_bytes(16); $encryptedIp = openssl_encrypt($ip, 'AES-256-CBC', $encryptionKey, 0, $iv); $encryptedLoc = openssl_encrypt($loc, 'AES-256-CBC', $encryptionKey, 0, $iv); - DB::query('INSERT INTO login_tokens VALUES (\'0\', :token, :user_id, :device, :os, :ip, :loc, :la, :crd)', array( + DB::query('INSERT INTO login_tokens VALUES (\'0\', :token, :user_id, :device, :os, :ip, :loc, :la, :crd, :iv)', array( ':token' => $token, ':user_id' => $user_id, ':device' => $device, @@ -58,7 +57,8 @@ class Login ':ip' => $encryptedIp, ':loc' => $encryptedLoc, ':la' => time(), - ':crd' => time() + ':crd' => time(), + ':iv' => $iv )); setcookie("NGALLERYSESS", $token, time() + 50 * 50 * 54 * 72, '/', NULL, NULL, TRUE); diff --git a/app/Controllers/ApiController.php b/app/Controllers/ApiController.php index fe64043..ae7c0ca 100644 --- a/app/Controllers/ApiController.php +++ b/app/Controllers/ApiController.php @@ -30,9 +30,11 @@ use \App\Controllers\Api\Users\LoadUser as UserLoad; use \App\Controllers\Api\Users\EmailVerify as EmailVerify; use \App\Controllers\Api\Users\Search as UsersSearch; 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; +use \App\Controllers\Api\Admin\News\Create as AdminCreateNews; +use \App\Controllers\Api\Admin\News\Load as AdminLoadNews; +use \App\Controllers\Api\Admin\News\Delete as AdminDeleteNews; use \App\Controllers\Api\Admin\GetVehicleInputs as AdminGetVehicleInputs; +use \App\Controllers\Api\Admin\Models\RequestHandler as AdminModelsRequestHandler; use \App\Controllers\Api\Admin\GeoDB\Create as AdminGeoDBCreate; use \App\Controllers\Api\Admin\GeoDB\Load as AdminGeoDBLoad; use \App\Controllers\Api\Admin\GeoDB\Delete as AdminGeoDBDelete; @@ -121,6 +123,9 @@ class ApiController public static function admincreatenews() { return new AdminCreateNews(); } + public static function admindeletenews() { + return new AdminDeleteNews(); + } public static function adminloadnews() { return new AdminLoadNews(); } @@ -172,6 +177,9 @@ class ApiController public static function photoloadmap() { return new PhotoLoadMap(); } + public static function adminmodelsrequesthandler() { + return new AdminModelsRequestHandler(); + } } \ No newline at end of file diff --git a/app/Core/Routes.php b/app/Core/Routes.php index e97cea8..467f276 100644 --- a/app/Core/Routes.php +++ b/app/Core/Routes.php @@ -63,7 +63,8 @@ class Routes Router::get('/voting/sendpretend', 'ContestsController@sendpretend'); Router::get('/vehicle/edit', 'VehicleController@iedit'); - Router::get('/vehicle/dbedit', 'VehicleController@dbedit'); + Router::any('/vehicle/dbedit', 'VehicleController@dbedit'); + Router::any('/vehicle/$id', 'VehicleController@i'); Router::post('/api/upload', 'ApiController@upload'); Router::post('/api/profile/update', 'ApiController@updateprofile'); Router::post('/api/photo/comment', 'ApiController@photocomment'); @@ -89,9 +90,11 @@ class Routes if ($user->i('admin') > 0) { Router::any('/admin', 'AdminController@index'); Router::any('/api/admin/images/setvisibility', 'ApiController@adminsetvis'); - Router::any('/api/admin/createnews', 'ApiController@admincreatenews'); + Router::any('/api/admin/news/create', 'ApiController@admincreatenews'); + Router::any('/api/admin/news/$id/delete', 'ApiController@admindeletenews'); Router::any('/api/admin/loadnews', 'ApiController@adminloadnews'); Router::any('/api/admin/getvehicleinputs/$id', 'ApiController@admingetvehicleinputs'); + Router::any('/api/admin/models/requests/$id/$type', 'ApiController@adminmodelsrequesthandler'); Router::any('/api/admin/geodb/create', 'ApiController@admingeodbcreate'); Router::any('/api/admin/geodb/load', 'ApiController@admingeodbload'); Router::any('/api/admin/contests/createtheme', 'ApiController@admincontestscreatetheme'); @@ -103,6 +106,5 @@ class Routes } else { Router::redirect('/login?return='.$_SERVER['HTTP_REFERER']); } - Router::get('/vehicle/$id', 'VehicleController@i'); } } \ No newline at end of file diff --git a/app/Models/Admin/News.php b/app/Models/Admin/News.php new file mode 100644 index 0000000..eb8b9bd --- /dev/null +++ b/app/Models/Admin/News.php @@ -0,0 +1,27 @@ +id = $id; + $result = DB::query("SELECT * FROM news WHERE id=:id", [':id' => $this->id]); + if (!empty($result)) { + $this->table = (object) $result[0]; + } else { + $this->table = (object) []; + } + } + public function i($key) { + return $this->table->$key ?? null; + } + public function view() { + echo '
' + . Date::zmdate($this->table->time) . '
' + . $this->table->body + . '
Удалить
'; + } +} \ No newline at end of file diff --git a/app/Models/Comment.php b/app/Models/Comment.php index 40e9c96..6c4b4b2 100644 --- a/app/Models/Comment.php +++ b/app/Models/Comment.php @@ -150,7 +150,7 @@ class Comment $pinc = 'Закрепить'; echo '
'; if ($photo->i('pinnedcomment_id') === $this->c['id']) { - echo 'Комментарий закреплён'; + echo 'Комментарий закреплён
'; $pinc = 'Открепить'; } echo ' diff --git a/app/Services/Captcha.php b/app/Services/Captcha.php new file mode 100644 index 0000000..9c2cbae --- /dev/null +++ b/app/Services/Captcha.php @@ -0,0 +1,98 @@ +secretKey = $secretKey; + } + + public function setToken(string $token): void + { + $this->token = $token; + } + + public function setRemoteIp(string $ip): void + { + $this->remoteIp = $ip; + } + + public function setExpectedAction(string $action): void + { + $this->expectedAction = $action; + } + + public function setExpectedCdata(string $cdata): void + { + $this->expectedCdata = $cdata; + } + + public function verify(): array + { + if (empty($this->token)) { + throw new Exception('Turnstile token is missing'); + } + + if (empty($this->secretKey)) { + throw new Exception('Secret key is not configured'); + } + + $data = [ + 'secret' => $this->secretKey, + 'response' => $this->token + ]; + + if ($this->remoteIp) { + $data['remoteip'] = $this->remoteIp; + } + + $url = 'https://challenges.cloudflare.com/turnstile/v0/siteverify'; + $options = [ + 'http' => [ + 'header' => "Content-type: application/x-www-form-urlencoded\r\n", + 'method' => 'POST', + 'content' => http_build_query($data) + ] + ]; + + $context = stream_context_create($options); + $response = file_get_contents($url, false, $context); + + if ($response === false) { + throw new Exception('Failed to verify Turnstile token'); + } + + $result = json_decode($response, true); + + if (!is_array($result)) { + throw new Exception('Invalid response from Turnstile server'); + } + + if (!$result['success']) { + $errorCodes = $result['error-codes'] ?? ['unknown-error']; + throw new Exception('Turnstile verification failed: ' . implode(', ', $errorCodes)); + } + + $this->validateAdditionalParameters($result); + + return $result; + } + + private function validateAdditionalParameters(array $response): void + { + if ($this->expectedAction && ($response['action'] ?? '') !== $this->expectedAction) { + throw new Exception("Action mismatch. Expected: {$this->expectedAction}, Received: {$response['action']}"); + } + + if ($this->expectedCdata && ($response['cdata'] ?? '') !== $this->expectedCdata) { + throw new Exception("Cdata mismatch. Expected: {$this->expectedCdata}, Received: {$response['cdata']}"); + } + } +} \ No newline at end of file diff --git a/index.php b/index.php index 3c9b3a7..7a04f6f 100644 --- a/index.php +++ b/index.php @@ -11,7 +11,9 @@ class App { public static function start() { - error_reporting(E_ALL & ~E_WARNING); + ini_set('display_errors', 0); + ini_set('display_startup_errors', 0); + error_reporting(E_ALL); if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/ngallery.yaml')) { define("NGALLERY", Yaml::parse(file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/ngallery.yaml'))['ngallery']); @@ -35,9 +37,8 @@ class App } } catch (PDOException $ex) { echo '
Произошла ошибка MySQL'.nl2br($ex).'
'; - } catch (Exception $ex) { - echo '
Произошла скриптовая ошибка PHP'.nl2br($ex).'
'; + echo '
Произошла скриптовая ошибка PHP

'.nl2br($ex).'
'; } } else { Page::set('Errors/Problems'); diff --git a/ngallery-example.yaml b/ngallery-example.yaml index 9107e4a..b40d367 100644 --- a/ngallery-example.yaml +++ b/ngallery-example.yaml @@ -8,8 +8,11 @@ ngallery: keywords: "" maintenance: false debug: true - alloweddomains: ["nativegallery.loc", "pub-f05d2c8192d549e4b52535d646e5909a.r2.dev"] + alloweddomains: ["example.com"] botkey: '' + logslocation: '/logs' + encryptionkey: '' + footerslogan: 'Aloha, Hawaii!' access: type: 'allow' countries: '' diff --git a/static/css/style.css b/static/css/style.css index 67232fe..cc12ba1 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -915,4 +915,17 @@ input.ml-button { height:22px; } bottom: 0; left: 0; right: 0; +} +.ix-photos.shine { + background-image: linear-gradient(270deg, rgba(100, 181, 239, 0) 48.44%, #adadad 75.52%, rgba(100, 181, 239, 0) 100%); + background-repeat: no-repeat; + animation: bg-move linear 2s infinite; +} +@-webkit-keyframes bg-move { + 0% { background-position: -500px 0; } + 100% { background-position: 1000px 0; } +} +@keyframes bg-move { + 0% { background-position: -500px 0; } + 100% { background-position: 1000px 0; } } \ No newline at end of file diff --git a/static/js/act.js b/static/js/act.js index 582bf9d..a64e69c 100644 --- a/static/js/act.js +++ b/static/js/act.js @@ -1,200 +1,272 @@ function createModal(id, type, value, modalid) { - if (type === 'EDIT_COMMENT') { - var modal = ` -
+
+
' . Date::zmdate($n['time']) . '
' . $n['body'] . '
'; + $nn = new \App\Models\Admin\News($n['id']); + $nn->view(); } ?> - - - \ No newline at end of file + \ No newline at end of file diff --git a/views/pages/Admin/Photo.php b/views/pages/Admin/Photo.php index 0923e24..f594123 100644 --- a/views/pages/Admin/Photo.php +++ b/views/pages/Admin/Photo.php @@ -39,10 +39,10 @@ use \App\Models\User;
-
+ Ожидают модерации diff --git a/views/pages/Admin/Settings.php b/views/pages/Admin/Settings.php index 06502bf..b6d6d2d 100644 --- a/views/pages/Admin/Settings.php +++ b/views/pages/Admin/Settings.php @@ -130,7 +130,8 @@ function renderInputs($data, $prefix = '') '.$nt['id'].' @@ -139,6 +140,8 @@ function renderInputs($data, $prefix = '') Запустить Остановить '; + } + } diff --git a/views/pages/Admin/UserEdit.php b/views/pages/Admin/UserEdit.php index 50b970b..3b957d6 100644 --- a/views/pages/Admin/UserEdit.php +++ b/views/pages/Admin/UserEdit.php @@ -1,12 +1,15 @@ i('id') === null) { die('Пользователь не найден'); } -function updateJson($data, $key, $value) { +function updateJson($data, $key, $value) +{ $data[$key] = $value; return $data; } @@ -25,65 +28,75 @@ if (isset($_POST['subbtn'])) { $updatedJson = updateJson($currentJson, 'premoderation', $premoderation); $updatedJsonString = json_encode($updatedJson, JSON_PRETTY_PRINT); - if (($admin === 1 && Auth::userid() === 1) || ($admin != 1 && Auth::userid() != 1)) { - DB::query("UPDATE users SET status = ?, admin = ?, content = ? WHERE id = ?", [ - $accountstatus, - $admin, - $updatedJsonString, - $userId - ]); - echo "Данные успешно обновлены."; - } else { - echo 'Не удалось обновить данные'; - } - + DB::query("UPDATE users SET status = ?, admin = ?, content = ? WHERE id = ?", [ + $accountstatus, + $admin, + $updatedJsonString, + $userId + ]); - + $alert = [ + 'type' => 'success', + 'code' => 'Данные успешно обновлены' + ]; } else { echo "Ошибка: JSON данные не найдены."; } } +if ($alert != null) { + echo ''; +} ?> -
+ -

i('username')?>

+

i('username') ?>

Был в сети: i('online')) ?> i('online')) { ?>(online)

-

Ссылка на профиль: https:///author/

+

Ссылка на профиль: https:///author/

-

Настройки

+

Настройки

Прямая загрузка
- -
Статус аккаунта
- -
Статус аккаунта
- - + +
Статус аккаунта
+ +
Статус аккаунта
+
-
-

Операции

- - - - -
- -
+
\ No newline at end of file diff --git a/views/pages/Main.php b/views/pages/Main.php index 2c8480a..9c03ab0 100644 --- a/views/pages/Main.php +++ b/views/pages/Main.php @@ -214,7 +214,7 @@ LIMIT 10;'); $first_id = $photos[0]['id']; $last_id = end($photos)['id']; ?> -
+
diff --git a/views/pages/MapMedia.php b/views/pages/MapMedia.php index b9f16ff..676db9b 100644 --- a/views/pages/MapMedia.php +++ b/views/pages/MapMedia.php @@ -108,7 +108,7 @@ use \App\Models\{Vehicle, User}; - + @@ -110,7 +112,7 @@ if ($photo->i('id') !== null) {
i('id') !== null) { .autocomplete { position: absolute; - background: white; + background: #fff; border: 1px solid #ddd; - max-height: 200px; + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); + min-width: 200px; + max-height: 300px; overflow-y: auto; - z-index: 1001; - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); + z-index: 10000; + transform: translateY(2px);/ } .autocomplete-item { @@ -861,67 +865,67 @@ if ($photo->i('id') !== null) {
+ $('#err').html(content); + $('#err .p20').slideDown(500); + } +
diff --git a/views/pages/Profile/Index.php b/views/pages/Profile/Index.php index 8889a11..3a51c7d 100644 --- a/views/pages/Profile/Index.php +++ b/views/pages/Profile/Index.php @@ -30,259 +30,269 @@ $birthdate = json_decode($userprofile->i('content'), true)['aboutbirthday']['val - + i('id') === (int)explode('/', $_SERVER['REQUEST_URI'])[2]) || $usercttc === True) { ?> -

i('username')) ?>i('admin') === 1) { echo ''; } ?>

- - Профиль на transphoto.org
Пользователь не зарегистрирован на сервере '.NGALLERY['root']['title'].'. Информация может быть неполной.
Открыть на transphoto.org
'; - } - if ($userprofile->i('admin') === 1) { - echo 'Администратор сервера'; - } else if ($userprofile->i('admin') === 2) { - echo 'Фотомодератор'; - } - - if ($userprofile->i('id') === Auth::userid()) { ?> -

Редактировать мой профиль

- -
- - - content('badge') !== null) { ?> -
content('badge'))?>

+

i('username')) ?>i('admin') === 1) { + echo ''; + } ?>

+ + Профиль на transphoto.org
Пользователь не зарегистрирован на сервере ' . NGALLERY['root']['title'] . '. Информация может быть неполной.
Открыть на transphoto.org'; + } + if ($userprofile->i('admin') === 1) { + echo 'Администратор сервера'; + } else if ($userprofile->i('admin') === 2) { + echo 'Фотомодератор'; + } + + if ($userprofile->i('id') === Auth::userid()) { ?> +

Редактировать мой профиль

-
+ +
- - - - - - - - - - - - - - - - - - -
Откуда:
День рождения:
+
+ + + content('badge') !== null) { ?> +
content('badge')) ?>

+ +
- - - -
- - - i('content'), true)['aboutlangs']['value'] != null) { ?> + + - - + + - - i('content'), true)['abouttelegram']['value'] != null) { ?> - - + + - - i('content'), true)['aboutvk']['value'] != null) { ?> - - - - - - i('content'), true)['abouttwitter']['value'] != null) { ?> - - - - - - i('content'), true)['aboutyoutube']['value'] != null) { ?> - - - - - - i('content'), true)['aboutemail']['value'] != null) { ?> - - - - - - i('content'), true)['aboutinstagram']['value'] != null) { ?> - - - - - - i('content'), true)['abouttransphoto']['value'] != null) { ?> - - - - - - i('content'), true)['aboutwebsite']['value'] != null) { ?> - - - - - +
Владение языками:i('content'), true)['aboutlangs']['value']) ?>Дата регистрации:
Telegram:i('content'), true)['abouttelegram']['value']) ?>Был на сайте:i('online')) ?> i('online')) { ?>(online)
ВКонтакте:i('content'), true)['aboutvk']['value']) ?>
Twitter/X:i('content'), true)['abouttwitter']['value']) ?>
YouTube:i('content'), true)['aboutyoutube']['value']) ?>
Почта:i('content'), true)['aboutemail']['value']) ?>
Instagram:i('content'), true)['aboutinstagram']['value']) ?>
TransPhoto:i('content'), true)['abouttransphoto']['value']) ?>
Личный сайт:i('content'), true)['aboutwebsite']['value']) ?>
+ i('content'), true)['aboutlangs']['value'] != null) { ?> - - - i('content'), true)['aboutfavs_trains']['value'] != null) { ?> - - - - - - i('content'), true)['aboutfavs_countries']['value'] != null) { ?> - - - - - - i('content'), true)['aboutfavs_cities']['value'] != null) { ?> - - - - + + + + + + + + + + + + + + + + + i('content'), true)['aboutlangs']['value'] != null) { ?> + + + + + + +
Любимые модели поездов:i('content'), true)['aboutfavs_trains']['value']) ?>
Любимые страны:i('content'), true)['aboutfavs_countries']['value']) ?>
Любимые города:i('content'), true)['aboutfavs_cities']['value']) ?>
Откуда:
День рождения:
Владение языками:i('content'), true)['aboutlangs']['value']) ?>
+ + + + + i('content'), true)['abouttelegram']['value'] != null) { ?> + + + + + + i('content'), true)['aboutvk']['value'] != null) { ?> + + + + + + i('content'), true)['abouttwitter']['value'] != null) { ?> + + + + + + i('content'), true)['aboutyoutube']['value'] != null) { ?> + + + + + + i('content'), true)['aboutemail']['value'] != null) { ?> + + + + + + i('content'), true)['aboutinstagram']['value'] != null) { ?> + + + + + + i('content'), true)['abouttransphoto']['value'] != null) { ?> + + + + + + i('content'), true)['aboutwebsite']['value'] != null) { ?> + + + + + +
Telegram:i('content'), true)['abouttelegram']['value']) ?>
ВКонтакте:i('content'), true)['aboutvk']['value']) ?>
Twitter/X:i('content'), true)['abouttwitter']['value']) ?>
YouTube:i('content'), true)['aboutyoutube']['value']) ?>
Почта:i('content'), true)['aboutemail']['value']) ?>
Instagram:i('content'), true)['aboutinstagram']['value']) ?>
TransPhoto:i('content'), true)['abouttransphoto']['value']) ?>
Личный сайт:i('content'), true)['aboutwebsite']['value']) ?>
+ + + + + i('content'), true)['aboutfavs_trains']['value'] != null) { ?> + + + + + + i('content'), true)['aboutfavs_countries']['value'] != null) { ?> + + + + + + i('content'), true)['aboutfavs_cities']['value'] != null) { ?> + + + + +
Любимые модели поездов:i('content'), true)['aboutfavs_trains']['value']) ?>
Любимые страны:i('content'), true)['aboutfavs_countries']['value']) ?>
Любимые города:i('content'), true)['aboutfavs_cities']['value']) ?>
- - - - - - - - - - -
Дата регистрации:
Был на сайте:i('online')) ?> i('online')) { ?>(online)
-
-
-
- + function showUserPhoto() { + _getID('userphoto_big_img').src = 'i('photourl') ?>'; + _getID('userphoto_big_div').style.top = '' + (getBodyScrollTop() + 10) + 'px'; + _getID('userphoto_big_div').style.display = 'block'; + } - + function hideUserPhoto() { + _getID('userphoto_big_div').style.display = 'none'; + } - -
-
- + + + + +
+
+ -
-

О себе

- -
- +

О себе

+ +
+ -
Найти все фотографии, сделанные этим пользователем
- - i('id') != Auth::userid()) { ?> - - $userprofile->i('id'), ':followerid' => Auth::userid()))) { -$class = 'on'; - } - ?> -
 
+ $.get('/api/subscribe', { + action: 'subscribe', + id: i('id') ?>, + subj: 'a' + }, function(r) { + if (r != 0 && r != 1) { + toggle.toggleClass('on'); + alert(r); + } else toggle.attr('class', (r == 1) ? 'toggle on' : 'toggle'); + }); + }); + }); + + $userprofile->i('id'), ':followerid' => Auth::userid()))) { + $class = 'on'; + } + ?> +
+
+
+
  +
+ +
Пользователей, подписанных на мои фотографии: $userprofile->i('id')))[0]['COUNT(*)']; ?>
+ -
Пользователей, подписанных на мои фотографии: $userprofile->i('id')))[0]['COUNT(*)'];?>
- - -

Пользователь не найден

+
+

Пользователь не найден

+
- - + + diff --git a/views/pages/Profile/LK/Profile.php b/views/pages/Profile/LK/Profile.php index 0d90242..89d0cba 100644 --- a/views/pages/Profile/LK/Profile.php +++ b/views/pages/Profile/LK/Profile.php @@ -24,7 +24,7 @@ $user = new User(Auth::userid());
diff --git a/views/pages/Profile/LK/Profile/Personalization.php b/views/pages/Profile/LK/Profile/Personalization.php index ad307c8..d684e62 100644 --- a/views/pages/Profile/LK/Profile/Personalization.php +++ b/views/pages/Profile/LK/Profile/Personalization.php @@ -8,11 +8,12 @@ $themeManager = new ThemeManager(); $themeManager->loadThemes(); $themesList = $themeManager->getAllThemes(); -var_dump($_SESSION); +$selectedTheme = $_SESSION['selected_theme']; + if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['theme_id'])) { try { $themeManager->saveThemeToProfile($_POST['theme_id']); - header('Location: ' . $_SERVER['REQUEST_URI']); + die(''); exit; } catch (Exception $e) { error_log($e->getMessage()); diff --git a/views/pages/Rules.php b/views/pages/Rules.php index b9a0c05..c170dd4 100644 --- a/views/pages/Rules.php +++ b/views/pages/Rules.php @@ -1,288 +1,44 @@ $value) { - if (strpos($key, 'rsn__') === 0) { - $id = substr($key, 5); - $filteredIds[] = $id; - } - } - - if (!empty($filteredIds)) { - foreach ($filteredIds as $id) { - $val = ((int)$_POST['rsn__' . $id] === 0) ? 1 : 2; - DB::query('UPDATE tasks SET checked=:c WHERE id=:id', [':id' => $id, ':c' => $val]); - } - } -} - -if (isset($_POST['approve'])) { - saveTasks(); - DB::query('UPDATE applications_details SET checked=:ch WHERE category_id=:id AND user_id=:uid', - [':ch' => 1, ':id' => $_GET['id'], ':uid' => $_GET['uid']]); -} elseif (isset($_POST['decline'])) { - saveTasks(); - DB::query('UPDATE applications_details SET checked=:ch WHERE category_id=:id AND user_id=:uid', - [':ch' => 2, ':id' => $_GET['id'], ':uid' => $_GET['uid']]); -} - -$categoryTitle = htmlspecialchars(DB::query('SELECT title FROM categories_sub WHERE id=:id', [':id' => $_GET['id']])[0]['title']); -$isAdmin = (int)($_GET['adm'] ?? 0) === 1; -$userId = $isAdmin ? $_GET['uid'] : isLoggedIn(); -$subs = DB::query('SELECT * FROM tasks WHERE category_id=:id AND user_id=:uid', [':id' => $_GET['id'], ':uid' => $userId]); - -$appDetails = DB::query('SELECT * FROM applications_details WHERE user_id = :uid AND category_id = :cid', - [':uid' => $userId, ':cid' => $_GET['id']]); -$formData = $appDetails[0] ?? [ - 'experience' => '', - 'work_days' => '[]', - 'work_time_from' => '', - 'work_time_to' => '', - 'description' => '', - 'myself' => 0 -]; -$workDays = json_decode($formData['work_days'], true); ?> - + + - - - -
-
- + - -
-

A propos de la spécialisation

- - -
- Ваши данные на модерации -
- -
- - -
+ + - - - -
- - -
- - - -
-
-
- - - - - - - + \ No newline at end of file diff --git a/views/pages/Search/Index.php b/views/pages/Search/Index.php index 8c9ddea..e85b326 100644 --- a/views/pages/Search/Index.php +++ b/views/pages/Search/Index.php @@ -6,508 +6,52 @@ use App\Services\{Router, Auth, DB, Date}; - + -
- - - -
-

Результаты поиска

-
Найдено изображений: $_GET['id']))[0]['COUNT(*)']?>  ·  Новый поиск

- $_GET['id'])); - foreach ($photos as $p) { - echo '
+
+ + + + - - -
+

Результаты поиска

+
Найдено изображений: $_GET['id']))[0]['COUNT(*)'] ?>  ·  Новый поиск

+ $_GET['id'])); + foreach ($photos as $p) { + echo ''; - } - ?> -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Условия, относящиеся к ТС:

Страна: - -
-
Город ТС: - -
-
Вид транспорта: -
Локация: - -
Депо/Парк: - -
Система: - -
-
Назначение: -
Номер:
Госномер:
Модель: - -
  - -
Шасси: - -
  - -

Условия, относящиеся к галереям:

Город галереи: - -
-
Вид транспорта: -
Раздел: -
Галерея: - -

Условия, относящиеся к фото:

Вид транспорта:
Страна: - -
-
Система: - -
-
Город съёмки: - -
-
Место съёмки: -

-
- -
Маршрут:
Примечание:
Описание:
Конкурсное:
Ракурс: - - - -
-
-
+
diff --git a/views/pages/Vehicle/DBEdit.php b/views/pages/Vehicle/DBEdit.php index fa4218c..50023c5 100644 --- a/views/pages/Vehicle/DBEdit.php +++ b/views/pages/Vehicle/DBEdit.php @@ -1,13 +1,57 @@ $_GET['type']))[0]; +$lastRequestUnix = DB::query('SELECT created_at FROM entities_requests WHERE user_id=:id ORDER BY id DESC LIMIT 1', array(':id' => Auth::userid()))[0]['created_at']; +$secondsDifference = time() - $lastRequestUnix; +$hoursDifference = floor($secondsDifference / 3600); +if (isset($_POST['create'])) { + if ($hoursDifference >= 23) { + try { + if (NGALLERY['root']['security']['captcha'] === true) { + $turnstile = new Captcha(NGALLERY['root']['security']['cloudflareturnstile-keys']['server']); + $turnstile->setToken($_POST['cf-turnstile-response']); + $turnstile->setRemoteIp($_SERVER['REMOTE_ADDR']); + $result = $turnstile->verify(); + } + $inputs = $_POST; + + $filteredInputs = []; + foreach ($inputs as $key => $value) { + if (strpos($key, 'modelinput_') === 0) { + $filteredInputs[$key] = $value; + } + } + ksort($filteredInputs); + $result = []; + + $counter = 1; + + foreach ($filteredInputs as $key => $value) { + $result[$counter] = [ + 'value' => $value + ]; + $counter++; + } + $jsonResult = json_encode($result, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT); + + DB::query('INSERT INTO entities_requests VALUES (\'0\', :user_id, :createdate, :entityid, :content, 0)', array(':user_id' => Auth::userid(), ':createdate' => time(), ':entityid' => $_GET['type'], ':content' => $jsonResult)); + $success = 1; + } catch (Exception $e) { + die("Error: " . $e->getMessage()); + } + } +} ?> + @@ -23,104 +67,10 @@ use \App\Models\{Vehicle, User};

Внесение изменений в БД

- - - - -
- - - - -

Какую запись вы хотите уточнить?

@@ -136,17 +86,17 @@ use \App\Models\{Vehicle, User}; Никакую, я хочу добавить новое ТС $_GET['num'], ':id'=>$_GET['type'])); + $entities = DB::query('SELECT * FROM entities_data WHERE entityid=:id AND (LOWER(title) LIKE :title)', array(':title' => $_GET['num'], ':id' => $_GET['type'])); foreach ($entities as $e) { echo ' - - '.$e['id'].' - '.$e['title'].' + + ' . $e['id'] . ' + ' . $e['title'] . ' '; } ?> - +
@@ -161,95 +111,49 @@ use \App\Models\{Vehicle, User}; $data = json_decode($vehicle['sampledata'], true); $count = 1; foreach ($data as $d) { - + if ($d['important'] === "1") { $imp = 'required'; } echo ' ' . $d['name'] . ' - + '; - $count++; + $count++; } ?> - - + + + + +
+
+ + +
- +
+ Заявки можно отправлять раз в 24 часа'; + } + ?> -
Вернуться назад

Правила заполнения формы