From 24b3ef972671a893d51f527ffec6ddd7393aaf0d Mon Sep 17 00:00:00 2001
From: themohooks <81331307+themohooks@users.noreply.github.com>
Date: Thu, 3 Oct 2024 21:34:50 +0300
Subject: [PATCH] fix
---
app/Models/UserCTTC.php | 18 +++++-
composer.json | 3 +-
composer.lock | 110 +++++++++++++++++++++++++++++++++-
views/pages/Profile/Index.php | 28 +++++----
4 files changed, 144 insertions(+), 15 deletions(-)
diff --git a/app/Models/UserCTTC.php b/app/Models/UserCTTC.php
index d5b1134..b50678e 100644
--- a/app/Models/UserCTTC.php
+++ b/app/Models/UserCTTC.php
@@ -2,6 +2,7 @@
namespace App\Models;
use \App\Services\DB;
use DOMDocument, DOMXPath;
+use PHPHtmlParser\Dom;
class UserCTTC {
@@ -10,13 +11,12 @@ class UserCTTC {
function __construct(int $user_id) {
$this->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']
+ 'Cookie: '.NGALLERY['transphotoapi']['cookie']
));
@@ -31,6 +31,10 @@ class UserCTTC {
$xpath = new DOMXPath($dom);
$mainNode = $xpath->query('//td[@class="main"]')->item(0);
+ $dom = new Dom;
+ $dom->loadStr($html);
+ $contents = $dom->find('.p20');
+
if ($mainNode) {
@@ -60,14 +64,24 @@ class UserCTTC {
+
+
+
+
+
$dataarray['username'] = $title;
+ $dataarray['realname'] = $realName;
+ $dataarray['birthdate'] = $birthDate;
$dataarray['city'] = $city;
$dataarray['regdate'] = $regDate;
$dataarray['photourl'] = "https://transphoto.org/_update_temp/userphotos/".$user_id.".jpg";
+ $dataarray['about'] = $contents[1];
$this->dataarray = $dataarray;
}
+
+
}
public function i($table) {
diff --git a/composer.json b/composer.json
index 3042664..2ee63e3 100644
--- a/composer.json
+++ b/composer.json
@@ -19,6 +19,7 @@
"symfony/yaml": "^7.1",
"donatj/phpuseragentparser": "^1.8",
"php-ffmpeg/php-ffmpeg": "^1.2",
- "chriskonnertz/bbcode": "^1.1"
+ "chriskonnertz/bbcode": "^1.1",
+ "paquettg/php-html-parser": "^2.2"
}
}
diff --git a/composer.lock b/composer.lock
index 606798d..7297290 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": "a512719e60bd14a5a6c28c6f0ea14e46",
+ "content-hash": "31de33165b326f2edef27c1fc9ae5b08",
"packages": [
{
"name": "aws/aws-crt-php",
@@ -716,6 +716,114 @@
},
"time": "2023-08-25T10:54:48+00:00"
},
+ {
+ "name": "paquettg/php-html-parser",
+ "version": "2.2.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/paquettg/php-html-parser.git",
+ "reference": "668c770fc5724ea3f15b8791435f054835be8d5e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/paquettg/php-html-parser/zipball/668c770fc5724ea3f15b8791435f054835be8d5e",
+ "reference": "668c770fc5724ea3f15b8791435f054835be8d5e",
+ "shasum": ""
+ },
+ "require": {
+ "ext-curl": "*",
+ "ext-mbstring": "*",
+ "ext-zlib": "*",
+ "paquettg/string-encode": "~1.0.0",
+ "php": ">=7.1"
+ },
+ "require-dev": {
+ "infection/infection": "^0.13.4",
+ "mockery/mockery": "^1.2",
+ "phan/phan": "^2.4",
+ "php-coveralls/php-coveralls": "^2.1",
+ "phpunit/phpunit": "^7.5.1"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "PHPHtmlParser\\": "src/PHPHtmlParser"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Gilles Paquette",
+ "email": "paquettg@gmail.com",
+ "homepage": "http://gillespaquette.ca"
+ }
+ ],
+ "description": "An HTML DOM parser. It allows you to manipulate HTML. Find tags on an HTML page with selectors just like jQuery.",
+ "homepage": "https://github.com/paquettg/php-html-parser",
+ "keywords": [
+ "dom",
+ "html",
+ "parser"
+ ],
+ "support": {
+ "issues": "https://github.com/paquettg/php-html-parser/issues",
+ "source": "https://github.com/paquettg/php-html-parser/tree/2.2.1"
+ },
+ "time": "2020-01-20T12:59:15+00:00"
+ },
+ {
+ "name": "paquettg/string-encode",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/paquettg/string-encoder.git",
+ "reference": "a8708e9fac9d5ddfc8fc2aac6004e2cd05d80fee"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/paquettg/string-encoder/zipball/a8708e9fac9d5ddfc8fc2aac6004e2cd05d80fee",
+ "reference": "a8708e9fac9d5ddfc8fc2aac6004e2cd05d80fee",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^7.5.1"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-0": {
+ "stringEncode": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Gilles Paquette",
+ "email": "paquettg@gmail.com",
+ "homepage": "http://gillespaquette.ca"
+ }
+ ],
+ "description": "Facilitating the process of altering string encoding in PHP.",
+ "homepage": "https://github.com/paquettg/string-encoder",
+ "keywords": [
+ "charset",
+ "encoding",
+ "string"
+ ],
+ "support": {
+ "issues": "https://github.com/paquettg/string-encoder/issues",
+ "source": "https://github.com/paquettg/string-encoder/tree/1.0.1"
+ },
+ "time": "2018-12-21T02:25:09+00:00"
+ },
{
"name": "php-ffmpeg/php-ffmpeg",
"version": "v1.2.0",
diff --git a/views/pages/Profile/Index.php b/views/pages/Profile/Index.php
index d160281..ba7b428 100644
--- a/views/pages/Profile/Index.php
+++ b/views/pages/Profile/Index.php
@@ -8,15 +8,19 @@ use \App\Models\{User, UserCTTC};
if (explode('@', $_SERVER['REQUEST_URI'])[1] === 'transphoto.org') {
$userprofile = new UserCTTC((int)explode('/', explode('@', $_SERVER['REQUEST_URI'])[0])[2]);
$usercttc = True;
- $city = htmlspecialchars(json_decode($userprofile->i('content'), true)['aboutlive']['value']);
+ $city = $userprofile->i('city');
$regdate = $userprofile->i('regdate');
$photourl = $userprofile->i('photourl');
+ $about = $userprofile->i('about');
+ $birthdate = $userprofile->i('birthdate');
} 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'));
+ $about = json_decode($userprofile->i('content'), true)['aboutmemo']['value'];
+ $birthdate = json_decode($userprofile->i('content'), true)['aboutbirthday']['value'];
}
?>
@@ -43,7 +47,7 @@ if (explode('@', $_SERVER['REQUEST_URI'])[1] === 'transphoto.org') {
Профиль на transphoto.org
Пользователь не зарегистрирован на сервере '.NGALLERY['root']['title'].'. Информация может быть неполной.
Открыть на transphoto.org';
+ echo '