diff --git a/app/Controllers/Api/Users/LoadUser.php b/app/Controllers/Api/Users/LoadUser.php index b04d8e6..a2f7076 100644 --- a/app/Controllers/Api/Users/LoadUser.php +++ b/app/Controllers/Api/Users/LoadUser.php @@ -81,10 +81,6 @@ class LoadUser $languages = $xpath->query('.//tr[td[contains(text(),"Владение языками:")]]/td[2]/span', $mainNode)->item(0)->textContent; - - - - $response[] = [ 'id' => $id, diff --git a/app/Models/UserCTTC.php b/app/Models/UserCTTC.php new file mode 100644 index 0000000..d5b1134 --- /dev/null +++ b/app/Models/UserCTTC.php @@ -0,0 +1,83 @@ +userid = $user_id; + $url = "https://transphoto.org/author/".$user_id; + + $dataarray = []; + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_HTTPHEADER, array( + 'Cookie: '.NGALLERY['transphoto']['cookie'] + )); + + + $html = curl_exec($ch); + curl_close($ch); + + $dom = new DOMDocument(); + libxml_use_internal_errors(true); + $dom->loadHTML($html); + libxml_clear_errors(); + + $xpath = new DOMXPath($dom); + $mainNode = $xpath->query('//td[@class="main"]')->item(0); + + if ($mainNode) { + + + $titleNode = $xpath->query('.//h1', $mainNode)->item(0); + $title = $titleNode ? $titleNode->textContent : 'Не найдено'; + + $realNameNode = $xpath->query('.//tr[td[contains(text(),"Реальное имя:")]]/td[2]/b', $mainNode)->item(0); + $realName = $realNameNode ? $realNameNode->textContent : 'Не найдено'; + + // Откуда + $city = $xpath->query('.//tr[td[contains(text(),"Откуда:")]]/td[2]', $mainNode)->item(0)->textContent; + + // Дата рождения + $birthDate = $xpath->query('.//tr[td[contains(text(),"Дата рождения:")]]/td[2]', $mainNode)->item(0)->textContent; + + // Дата регистрации + $regDate = $xpath->query('.//tr[td[contains(text(),"Дата регистрации:")]]/td[2]/span', $mainNode)->item(0)->textContent; + + // Рейтинг + $rating = $xpath->query('.//tr[td[contains(text(),"Рейтинг:")]]/td[2]/span', $mainNode)->item(0)->textContent; + + // Пол + $gender = $xpath->query('.//tr[td[contains(text(),"Пол:")]]/td[2]/span', $mainNode)->item(0)->textContent; + + // Владение языками + $languages = $xpath->query('.//tr[td[contains(text(),"Владение языками:")]]/td[2]/span', $mainNode)->item(0)->textContent; + + + + $dataarray['username'] = $title; + $dataarray['city'] = $city; + $dataarray['regdate'] = $regDate; + $dataarray['photourl'] = "https://transphoto.org/_update_temp/userphotos/".$user_id.".jpg"; + + $this->dataarray = $dataarray; + } + + + } + public function i($table) { + return $this->dataarray[$table]; + } + public function content($table) { + + + + + } + +} \ No newline at end of file diff --git a/views/pages/Profile/Index.php b/views/pages/Profile/Index.php index 8b6ee89..d160281 100644 --- a/views/pages/Profile/Index.php +++ b/views/pages/Profile/Index.php @@ -1,9 +1,23 @@ i('content'), true)['aboutlive']['value']); + $regdate = $userprofile->i('regdate'); + $photourl = $userprofile->i('photourl'); +} else { + $userprofile = new User(explode('/', $_SERVER['REQUEST_URI'])[2]); + $usercttc = False; + $city = htmlspecialchars(json_decode($userprofile->i('content'), true)['aboutlive']['value']); + $photourl = $userprofile->i('photourl'); + $regdate = Date::zmdate($userprofile->content('regdate')); +} ?> @@ -21,15 +35,22 @@ $userprofile = new User(explode('/', $_SERVER['REQUEST_URI'])[2]); + i('id') === (int)explode('/', $_SERVER['REQUEST_URI'])[2]) { ?> + + if (((int)$userprofile->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()) { ?>

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

@@ -44,18 +65,12 @@ $userprofile = new User(explode('/', $_SERVER['REQUEST_URI'])[2]); + content('location') !== null) { ?> + if ($city != null) { ?> Откуда: - content('location')) ?> - - - i('content'), true)['aboutlive']['value'] != null) { ?> - - Откуда: - i('content'), true)['aboutlive']['value']) ?> + Дата регистрации: - content('regdate')) ?> + Был на сайте: @@ -203,7 +218,7 @@ $userprofile = new User(explode('/', $_SERVER['REQUEST_URI'])[2]);
закрыть
- +