diff --git a/app/Controllers/Api/Profile/Update.php b/app/Controllers/Api/Profile/Update.php
new file mode 100644
index 0000000..3e18ce1
--- /dev/null
+++ b/app/Controllers/Api/Profile/Update.php
@@ -0,0 +1,56 @@
+ $value) {
+ if (strpos($key, 'about') === 0) {
+ $paramKey = $key;
+
+ if (!isset($dataArray[$paramKey])) {
+ $dataArray[$paramKey] = [];
+ }
+
+ if (strpos($key, 'OnMain') === false) {
+ $dataArray[$paramKey]['value'] = $value;
+ }
+ }
+ }
+
+ $user = new \App\Models\User(Auth::userid());
+ $content = json_decode($user->i('content'), true);
+ $existingArray = array_replace_recursive($content, $dataArray);
+
+ $newJson = json_encode($existingArray, JSON_PRETTY_PRINT);
+
+ if (isset($_FILES['userphoto'])) {
+ $upload = new UploadPhoto($_FILES['userphoto'], 'cdn/img/');
+ if ($upload->getType() !== null) {
+ $this->photourl = $upload->getSrc();
+ } else {
+ $this->photourl = $user->i('photourl');
+ }
+ } else {
+ $this->photourl = $user->i('photourl');
+ }
+
+ DB::query('UPDATE users SET content=:c, photourl=:ph WHERE id=:id', [':id' => Auth::userid(), ':c' => $newJson, ':ph'=>$this->photourl]);
+
+
+ }
+}
diff --git a/app/Controllers/ApiController.php b/app/Controllers/ApiController.php
index 9146f13..921150a 100644
--- a/app/Controllers/ApiController.php
+++ b/app/Controllers/ApiController.php
@@ -9,6 +9,7 @@ use \App\Controllers\Api\Images\{Upload};
use \App\Controllers\Api\Images\Rate as PhotoVote;
use \App\Controllers\Api\Images\Comment as PhotoComment;
use \App\Controllers\Api\Images\CommentsLoad as PhotoCommentLoad;
+use \App\Controllers\Api\Profile\Update as ProfileUpdate;
class ApiController
{
@@ -31,6 +32,9 @@ class ApiController
public static function photocommentload() {
return new PhotoCommentLoad();
}
+ public static function updateprofile() {
+ return new ProfileUpdate();
+ }
}
\ No newline at end of file
diff --git a/app/Controllers/ProfileController.php b/app/Controllers/ProfileController.php
index e7f05af..91eb4c5 100644
--- a/app/Controllers/ProfileController.php
+++ b/app/Controllers/ProfileController.php
@@ -25,6 +25,10 @@ class ProfileController
{
Page::set('Profile/LK/History');
}
+ public static function lkprofile()
+ {
+ Page::set('Profile/LK/Profile');
+ }
}
\ No newline at end of file
diff --git a/app/Core/Routes.php b/app/Core/Routes.php
index 8d64dc0..fa9556b 100644
--- a/app/Core/Routes.php
+++ b/app/Core/Routes.php
@@ -29,7 +29,9 @@ class Routes
Router::get('/lk', 'ProfileController@lk');
Router::get('/lk/upload', 'ProfileController@upload');
Router::get('/lk/history', 'ProfileController@lkhistory');
+ Router::get('/lk/profile', 'ProfileController@lkprofile');
Router::post('/api/upload', 'ApiController@upload');
+ Router::post('/api/profile/update', 'ApiController@updateprofile');
Router::post('/api/photo/comment', 'ApiController@photocomment');
Router::post('/api/photo/getcomments/$id', 'ApiController@photocommentload');
} else {
diff --git a/app/Models/Comment.php b/app/Models/Comment.php
index 5507faf..26d6427 100644
--- a/app/Models/Comment.php
+++ b/app/Models/Comment.php
@@ -17,7 +17,15 @@ class Comment {
-
О себе
+=nl2br(json_decode($userprofile->i('content'), true)['aboutmemo']['value'])?> +Ссылка на публичный профиль: =$user->i('username')?>
+ + +