diff --git a/app/Controllers/Api/Admin/GetVehicleInputs.php b/app/Controllers/Api/Admin/GetVehicleInputs.php index 459e8a5..69b5081 100644 --- a/app/Controllers/Api/Admin/GetVehicleInputs.php +++ b/app/Controllers/Api/Admin/GetVehicleInputs.php @@ -15,15 +15,19 @@ class GetVehicleInputs $id = explode('/', $_SERVER['REQUEST_URI'])[4]; $vehicle = DB::query('SELECT * FROM entities WHERE id=:id', array(':id' => $id))[0]; $data = json_decode($vehicle['sampledata'], true); + $count = 1; foreach ($data as $d) { + if ($d['important'] === "1") { $imp = 'required'; } echo ' -
+
- +
'; + $count++; } + } } diff --git a/app/Controllers/Api/Images/Upload.php b/app/Controllers/Api/Images/Upload.php index c6b1eef..f3e974a 100644 --- a/app/Controllers/Api/Images/Upload.php +++ b/app/Controllers/Api/Images/Upload.php @@ -21,6 +21,9 @@ class Upload static $showtop = 'allowed'; static $subsnotify = 'allowed'; static $exif = 'exif'; + static $entitydata_id = 0; + static $entityroute = NULL; + static $entitycomment = NULL; public static function create($postbody, $content, $exif) { @@ -34,7 +37,7 @@ class Upload } else { $moderated = 1; } - DB::query('INSERT INTO photos VALUES (\'0\', :userid, :postbody, :photourl, :time, :timeup, :exif, 0, :moderated, :place, 0, :gallery, :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, ':gallery'=>$_POST['gallery'])); + DB::query('INSERT INTO photos VALUES (\'0\', :userid, :postbody, :photourl, :time, :timeup, :exif, 0, :moderated, :place, 0, :gallery, :entityid, :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, ':gallery'=>$_POST['gallery'], ':entityid'=>self::$entitydata_id)); if (($moderated === 1) && (self::$subsnotify != 'disabled')) { $followers = DB::query('SELECT * FROM followers WHERE user_id=:uid', array(':uid' => Auth::userid())); foreach ($followers as $f) { @@ -150,6 +153,15 @@ class Upload if ((int)$_POST['disableexif'] === 1) { self::$exif = 'disabled'; } + if ((int)$_POST['nid'] >= 1) { + if (DB::query('SELECT id FROM entities_data WHERE id=:id', array(':id'=>$_POST['nid']))[0]['id']) { + self::$entitydata_id = $_POST['nid']; + self::$entityroute = $_POST["route[".$_POST['nid']."]"]; + self::$entitycomment = $_POST["notes[".$_POST['nid']."]"]; + } else { + return; + } + } if ($upload->getType() !== null) { $content = Json::return( array( @@ -162,6 +174,8 @@ class Upload 'comments' => self::$comments, 'rating' => self::$rating, 'showtop' => self::$showtop, + 'entityroute' => self::$entityroute, + 'entitycomment' => self::$entitycomment ) ); if (explode('/', $type)[0] === 'video') { diff --git a/app/Controllers/Api/Vehicles/Load.php b/app/Controllers/Api/Vehicles/Load.php index 3fcebd5..7df5ea3 100644 --- a/app/Controllers/Api/Vehicles/Load.php +++ b/app/Controllers/Api/Vehicles/Load.php @@ -27,7 +27,7 @@ class Load '.$e['id'].' - hhhhh + '.$e['title'].' '.$e['comment'].' diff --git a/app/Models/Vehicle.php b/app/Models/Vehicle.php index e3d0fe4..4257cb9 100644 --- a/app/Models/Vehicle.php +++ b/app/Models/Vehicle.php @@ -9,7 +9,7 @@ class Vehicle { $this->userid = $user_id; } public function i($table) { - return DB::query("SELECT * FROM entities_data WHERE id=:id", array(':id'=>$this->userid))[0][$table]; + return DB::query("SELECT * FROM entities WHERE id=:id", array(':id'=>$this->userid))[0][$table]; } public function getvehicle($table) { return DB::query("SELECT * FROM entities WHERE id=:id", array(':id'=>self::i('entityid')))[0][$table]; diff --git a/app/Services/Upload.php b/app/Services/Upload.php index 3ba72c5..24ae352 100644 --- a/app/Services/Upload.php +++ b/app/Services/Upload.php @@ -77,26 +77,18 @@ class Upload } else { - echo $tmpname; - $location = "your-location"; // Название локации - $folder = "{$location}/" . basename($tmpname); // Создаем корректное имя для папки с файлом + $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); - // Перемещение файла - if (move_uploaded_file($tmpname, $destination)) { - echo "Файл успешно перемещен!"; - } else { - echo "Ошибка при перемещении файла."; - } + $this->type = $type; $this->src = "/uploads/{$folder}"; diff --git a/static/js/core_lk.js b/static/js/core_lk.js index 56eeae1..b39f228 100644 --- a/static/js/core_lk.js +++ b/static/js/core_lk.js @@ -121,10 +121,10 @@ $(document).ready(function() var html = '\n'; html += '\n'; - html += '' + $('.num', this).html() + '\n'; + html += '' + $('.num', this).html() + '\n'; html += '' + $('.mname', this).html() + '\n'; html += '' + _text['UP_ROUTE'] + ':\n'; - html += ', \n'; + html += ', \n'; html += '×\n'; html += '\n'; diff --git a/views/pages/Admin/ModelsCreate.php b/views/pages/Admin/ModelsCreate.php index 290b63a..f502a17 100644 --- a/views/pages/Admin/ModelsCreate.php +++ b/views/pages/Admin/ModelsCreate.php @@ -7,51 +7,66 @@ use \App\Models\{User, Vehicle}; $vehicle = DB::query('SELECT * FROM entities WHERE id=:id', array(':id' => $_GET['id']))[0]; if (isset($_POST['create'])) { - $postData = $_POST; - $result = []; + $inputs = $_POST; - foreach ($postData as $key => $value) { - if (strpos($key, 'variable') === 0) { - preg_match('/_(\d+)$/', $key, $matches); - if (isset($matches[1])) { - $index = $matches[1]; - - if (!isset($result[$index])) { - $result[$index] = []; - } - $newKey = preg_replace('/^variable/', '', $key); - $newKey = preg_replace('/_\d+$/', '', $newKey); - - $result[$index][$newKey] = $value; - } + $filteredInputs = []; + foreach ($inputs as $key => $value) { + if (strpos($key, 'modelinput_') === 0) { + $filteredInputs[$key] = $value; } } - - $jsonResult = json_encode($result, JSON_PRETTY_PRINT); - - DB::query('INSERT INTO entities VALUES (\'0\', :title, :createdate, :sampledata, :color)', array(':title' => $_POST['title'], ':createdate' => time(), ':sampledata' => $jsonResult, ':color' => $_POST['color'])); - header('Location: /admin?type=Entities'); + 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_data VALUES (\'0\', :title, :createdate, :entityid, :comment, :content)', array(':title' => $_POST['title'], ':createdate'=>time(), ':entityid' => $_POST['entityid'], ':content' => $jsonResult, ':comment' => $_POST['comment'])); + header('Location: /admin?type=Models'); } ?>

Создание модели

- - + + ' . $d['title'] . ''; + } + ?> - -
+ + +
+ + +
+
+ + +
+
+
+ +
- - + @@ -68,10 +83,10 @@ if (isset($_POST['create'])) { xhr.onreadystatechange = function() { if (xhr.readyState === XMLHttpRequest.DONE) { if (xhr.status === 200) { - document.getElementById('form').innerHTML = ''; - document.getElementById('form').innerHTML = ''; + document.getElementById('mainContent').innerHTML = ''; + document.getElementById('mainContent').innerHTML = ''; - document.getElementById('form').insertAdjacentHTML('afterbegin', xhr.responseText); + document.getElementById('mainContent').insertAdjacentHTML('afterbegin', xhr.responseText); } else { console.error('Ошибка при загрузке данных:', xhr.statusText); diff --git a/views/pages/Photo.php b/views/pages/Photo.php index 04d35f7..a3bb441 100644 --- a/views/pages/Photo.php +++ b/views/pages/Photo.php @@ -1,7 +1,7 @@ i('id') !== null) { } $photouser = new \App\Models\User($photo->i('user_id')); $user = new \App\Models\User(Auth::userid()); + if ($photo->i('entitydata_id') >= 1) { + $entitydata = DB::query('SELECT * FROM entities_data WHERE id=:id', array(':id' => $photo->i('entitydata_id')))[0]; + $vehicle = new Vehicle($entitydata['entityid']); + } if ($photo->i('moderated') === 0) { if ($photo->i('user_id') === Auth::userid() || $user->i('admin') > 0) { $moderated = true; @@ -181,6 +185,16 @@ if ($photo->i('id') !== null) { ?> + i('entitydata_id') >= 1) { ?> + + + + +  —  маршрут content('entityroute') ?> + + +
content('comment') != null) { ?> @@ -194,7 +208,7 @@ if ($photo->i('id') !== null) { $date = Date::zmdate($photo->i('posted_at')); } ?> -
Прислал i('username') ?>          Дата:
+
Автор: i('username') ?>          Дата:
'; - } + } ?> @@ -493,6 +540,7 @@ if ($photo->i('id') !== null) { + content('lat') != null && $photo->content('lng') != null) { ?>
diff --git a/views/pages/Top30.php b/views/pages/Top30.php index 4e1631b..3a25639 100644 --- a/views/pages/Top30.php +++ b/views/pages/Top30.php @@ -39,7 +39,7 @@ foreach ($photos as $pd) {
- getvehicle('sampledata'), true); + $vehiclevariables = json_decode($vehicle->i('sampledata'), true); $num = 1; foreach ($vehiclevariables as $vb) { echo ''; @@ -44,6 +44,28 @@ $vehicledatavariables = json_decode($data['content'], true);
@@ -241,8 +255,8 @@ if ($photo->i('id') !== null) { Мне не нравится - Красиво, на конкурс! - Неконкурсное фото +
@@ -304,9 +318,41 @@ if ($photo->i('id') !== null) { }
+ i('entitydata_id') >= 1) { ?> +
+
+

+
+ + + + + + i('sampledata'), true); + $vehicledatavariables = json_decode($vehicle->i('content'), true); + $num = 1; + foreach ($vehiclevariables as $vb) { + echo ' + + + '; + + $num++; + } + ?> + + + +
' . $vb['name'] . ':' . $vehicledatavariables[$num]['value'] . '
+
+
+
+
content('type') != 'none') && (json_decode($photo->i('exif'), true)['type'] != 'none') && ($photo->content('rating') != 'disabled')) { + if (($photo->content('type') != 'none') && (json_decode($photo->i('exif'), true)['type'] != 'none') && ($photo->content('rating') != 'disabled') && ($photo->i('exif') != NULL)) { ?>
@@ -369,7 +415,8 @@ if ($photo->i('id') !== null) { 'GPS.GPSTimeStamp' => 'Время GPS', 'GPS.GPSDateStamp' => 'Дата GPS' ]; - function translate_flash_value($flash_value) { + function translate_flash_value($flash_value) + { $flash_descriptions = [ 0 => 'Выключена', 1 => 'Включена', @@ -379,112 +426,112 @@ if ($photo->i('id') !== null) { 5 => 'Автоматический режим', 6 => 'Автоматический режим' ]; - + return $flash_descriptions[$flash_value] ?? 'Неизвестное значение вспышки'; } - function translate_orientation($orientation) - { - $orientation_descriptions = [ - 1 => '0° (По умолчанию)', - 3 => '180°', - 6 => '90° по часовой стрелке', - 8 => '270° по часовой стрелке' - ]; + function translate_orientation($orientation) + { + $orientation_descriptions = [ + 1 => '0° (По умолчанию)', + 3 => '180°', + 6 => '90° по часовой стрелке', + 8 => '270° по часовой стрелке' + ]; - return $orientation_descriptions[$orientation] ?? 'Не определена'; - } + return $orientation_descriptions[$orientation] ?? 'Не определена'; + } - function translate_resolution_unit($unit) - { - $resolution_units = [ - 1 => 'Дюймы', - 2 => 'Сантиметры' - ]; + function translate_resolution_unit($unit) + { + $resolution_units = [ + 1 => 'Дюймы', + 2 => 'Сантиметры' + ]; - return $resolution_units[$unit] ?? 'Неизвестная единица'; - } + return $resolution_units[$unit] ?? 'Неизвестная единица'; + } - function translate_light_source($source) - { - $light_sources = [ - 0 => 'Неизвестный источник', - 1 => 'Дневной свет', - 2 => 'Лампа накаливания', - 3 => 'Лампа флуоресцентная', - 4 => 'Лампа с высоким давлением', - 5 => 'Лампа с низким давлением', - 255 => 'Другой источник' - ]; + function translate_light_source($source) + { + $light_sources = [ + 0 => 'Неизвестный источник', + 1 => 'Дневной свет', + 2 => 'Лампа накаливания', + 3 => 'Лампа флуоресцентная', + 4 => 'Лампа с высоким давлением', + 5 => 'Лампа с низким давлением', + 255 => 'Другой источник' + ]; - return $light_sources[$source] ?? 'Неизвестный источник света'; - } + return $light_sources[$source] ?? 'Неизвестный источник света'; + } - function translate_white_balance($balance) - { - $white_balances = [ - 0 => 'Автоматический', - 1 => 'Ручной' - ]; + function translate_white_balance($balance) + { + $white_balances = [ + 0 => 'Автоматический', + 1 => 'Ручной' + ]; - return $white_balances[$balance] ?? 'Неизвестный баланс белого'; - } + return $white_balances[$balance] ?? 'Неизвестный баланс белого'; + } - function translate_color_space($space) - { - $color_spaces = [ - 1 => 'sRGB', - 2 => 'Adobe RGB', - 3 => 'Uncalibrated' - ]; + function translate_color_space($space) + { + $color_spaces = [ + 1 => 'sRGB', + 2 => 'Adobe RGB', + 3 => 'Uncalibrated' + ]; - return $color_spaces[$space] ?? 'Неизвестное цветовое пространство'; - } + return $color_spaces[$space] ?? 'Неизвестное цветовое пространство'; + } - function translate_scene_type($type) - { - $scene_types = [ - 0 => 'Неизвестный тип', - 1 => 'Сцена с обычным светом', - 2 => 'Сцена с высоким контрастом', - 3 => 'Сцена с низким контрастом', - 4 => 'Сцена с движением' - ]; + function translate_scene_type($type) + { + $scene_types = [ + 0 => 'Неизвестный тип', + 1 => 'Сцена с обычным светом', + 2 => 'Сцена с высоким контрастом', + 3 => 'Сцена с низким контрастом', + 4 => 'Сцена с движением' + ]; - return $scene_types[$type] ?? 'Неизвестный тип съёмки'; - } - foreach ($data as $key => $value) { - if ($key === 'EXIF.Flash') { - $value = translate_flash_value($value); - } elseif ($key === 'IFD0.Orientation') { - $value = translate_orientation($value); - } elseif ($key === 'IFD0.ResolutionUnit') { - $value = translate_resolution_unit($value); - } elseif ($key === 'EXIF.WhiteBalance') { - $value = translate_white_balance($value); - } elseif ($key === 'IFD0.LightSource') { - $value = translate_light_source((int)$value); - } elseif ($key === 'EXIF.ColorSpace') { - $value = translate_color_space($value); - } elseif ($key === 'EXIF.SceneType') { - $value = translate_scene_type($value); - } - if (!isset($exif_translations[$key])) { - continue; - } - if (is_array($value)) { - $value = implode(', ', $value); - } - $key = $exif_translations[$key] ?? $key; + return $scene_types[$type] ?? 'Неизвестный тип съёмки'; + } + foreach ($data as $key => $value) { + if ($key === 'EXIF.Flash') { + $value = translate_flash_value($value); + } elseif ($key === 'IFD0.Orientation') { + $value = translate_orientation($value); + } elseif ($key === 'IFD0.ResolutionUnit') { + $value = translate_resolution_unit($value); + } elseif ($key === 'EXIF.WhiteBalance') { + $value = translate_white_balance($value); + } elseif ($key === 'IFD0.LightSource') { + $value = translate_light_source((int)$value); + } elseif ($key === 'EXIF.ColorSpace') { + $value = translate_color_space($value); + } elseif ($key === 'EXIF.SceneType') { + $value = translate_scene_type($value); + } + if (!isset($exif_translations[$key])) { + continue; + } + if (is_array($value)) { + $value = implode(', ', $value); + } + $key = $exif_translations[$key] ?? $key; - echo ' + echo '
' . htmlspecialchars($key) . ': ' . htmlspecialchars($value) . '
'.$top.'

Новых просмотров:
+'.$pd['view_count'].'

347 КБ + 347 КБ diff --git a/views/pages/Vehicle.php b/views/pages/Vehicle.php index d763505..6597ed9 100644 --- a/views/pages/Vehicle.php +++ b/views/pages/Vehicle.php @@ -1,7 +1,7 @@ $id))[0]; @@ -34,7 +34,7 @@ $vehicledatavariables = json_decode($data['content'], true);
' . $vb['name'] . ':' . $vehicledatavariables[$num]['value'] . '

+ $id)); + foreach ($photos as $p) { + $author = new User($p['user_id']); + echo '
+ + +
678 КБ +
'; + if (DB::query('SELECT COUNT(*) FROM photos_comments WHERE photo_id=:id', array(':id'=>$p['id']))[0]['COUNT(*)'] >= 1) { + echo '
'.DB::query('SELECT COUNT(*) FROM photos_comments WHERE photo_id=:id', array(':id'=>$p['id']))[0]['COUNT(*)'].'
'; + } + echo ' +
'.DB::query('SELECT COUNT(*) FROM photos_views WHERE photo_id=:id', array(':id'=>$p['id']))[0]['COUNT(*)'].'
+ +
+

'.htmlspecialchars($p['place']).'

+ '.htmlspecialchars($p['postbody']).' +

'.Date::zmdate($p['timeupload']).'
Автор: '.htmlspecialchars($author->i('username')).'

+
'; + } + ?> diff --git a/views/pages/t.php b/views/pages/t.php index 564d20f..7f386f2 100644 --- a/views/pages/t.php +++ b/views/pages/t.php @@ -1,90 +1,95 @@ + + + - + - Face Detection with TensorFlow.js + Таймер обратного отсчета + -

Face Detection using TensorFlow.js

- -

- -

-
-
- - +
+

+
00:00:00
+ +