mirror of
https://github.com/claradex/nativegallery.git
synced 2024-12-22 16:41:04 +03:00
fix
This commit is contained in:
parent
545af281eb
commit
24b3ef9726
4 changed files with 144 additions and 15 deletions
|
@ -2,6 +2,7 @@
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
use \App\Services\DB;
|
use \App\Services\DB;
|
||||||
use DOMDocument, DOMXPath;
|
use DOMDocument, DOMXPath;
|
||||||
|
use PHPHtmlParser\Dom;
|
||||||
|
|
||||||
class UserCTTC {
|
class UserCTTC {
|
||||||
|
|
||||||
|
@ -10,13 +11,12 @@ class UserCTTC {
|
||||||
function __construct(int $user_id) {
|
function __construct(int $user_id) {
|
||||||
$this->userid = $user_id;
|
$this->userid = $user_id;
|
||||||
$url = "https://transphoto.org/author/".$user_id;
|
$url = "https://transphoto.org/author/".$user_id;
|
||||||
|
|
||||||
$dataarray = [];
|
$dataarray = [];
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||||||
'Cookie: '.NGALLERY['transphoto']['cookie']
|
'Cookie: '.NGALLERY['transphotoapi']['cookie']
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,6 +31,10 @@ class UserCTTC {
|
||||||
$xpath = new DOMXPath($dom);
|
$xpath = new DOMXPath($dom);
|
||||||
$mainNode = $xpath->query('//td[@class="main"]')->item(0);
|
$mainNode = $xpath->query('//td[@class="main"]')->item(0);
|
||||||
|
|
||||||
|
$dom = new Dom;
|
||||||
|
$dom->loadStr($html);
|
||||||
|
$contents = $dom->find('.p20');
|
||||||
|
|
||||||
if ($mainNode) {
|
if ($mainNode) {
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,14 +64,24 @@ class UserCTTC {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$dataarray['username'] = $title;
|
$dataarray['username'] = $title;
|
||||||
|
$dataarray['realname'] = $realName;
|
||||||
|
$dataarray['birthdate'] = $birthDate;
|
||||||
$dataarray['city'] = $city;
|
$dataarray['city'] = $city;
|
||||||
$dataarray['regdate'] = $regDate;
|
$dataarray['regdate'] = $regDate;
|
||||||
$dataarray['photourl'] = "https://transphoto.org/_update_temp/userphotos/".$user_id.".jpg";
|
$dataarray['photourl'] = "https://transphoto.org/_update_temp/userphotos/".$user_id.".jpg";
|
||||||
|
$dataarray['about'] = $contents[1];
|
||||||
|
|
||||||
$this->dataarray = $dataarray;
|
$this->dataarray = $dataarray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public function i($table) {
|
public function i($table) {
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
"symfony/yaml": "^7.1",
|
"symfony/yaml": "^7.1",
|
||||||
"donatj/phpuseragentparser": "^1.8",
|
"donatj/phpuseragentparser": "^1.8",
|
||||||
"php-ffmpeg/php-ffmpeg": "^1.2",
|
"php-ffmpeg/php-ffmpeg": "^1.2",
|
||||||
"chriskonnertz/bbcode": "^1.1"
|
"chriskonnertz/bbcode": "^1.1",
|
||||||
|
"paquettg/php-html-parser": "^2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
110
composer.lock
generated
110
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "a512719e60bd14a5a6c28c6f0ea14e46",
|
"content-hash": "31de33165b326f2edef27c1fc9ae5b08",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "aws/aws-crt-php",
|
"name": "aws/aws-crt-php",
|
||||||
|
@ -716,6 +716,114 @@
|
||||||
},
|
},
|
||||||
"time": "2023-08-25T10:54:48+00:00"
|
"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",
|
"name": "php-ffmpeg/php-ffmpeg",
|
||||||
"version": "v1.2.0",
|
"version": "v1.2.0",
|
||||||
|
|
|
@ -8,15 +8,19 @@ use \App\Models\{User, UserCTTC};
|
||||||
if (explode('@', $_SERVER['REQUEST_URI'])[1] === 'transphoto.org') {
|
if (explode('@', $_SERVER['REQUEST_URI'])[1] === 'transphoto.org') {
|
||||||
$userprofile = new UserCTTC((int)explode('/', explode('@', $_SERVER['REQUEST_URI'])[0])[2]);
|
$userprofile = new UserCTTC((int)explode('/', explode('@', $_SERVER['REQUEST_URI'])[0])[2]);
|
||||||
$usercttc = True;
|
$usercttc = True;
|
||||||
$city = htmlspecialchars(json_decode($userprofile->i('content'), true)['aboutlive']['value']);
|
$city = $userprofile->i('city');
|
||||||
$regdate = $userprofile->i('regdate');
|
$regdate = $userprofile->i('regdate');
|
||||||
$photourl = $userprofile->i('photourl');
|
$photourl = $userprofile->i('photourl');
|
||||||
|
$about = $userprofile->i('about');
|
||||||
|
$birthdate = $userprofile->i('birthdate');
|
||||||
} else {
|
} else {
|
||||||
$userprofile = new User(explode('/', $_SERVER['REQUEST_URI'])[2]);
|
$userprofile = new User(explode('/', $_SERVER['REQUEST_URI'])[2]);
|
||||||
$usercttc = False;
|
$usercttc = False;
|
||||||
$city = htmlspecialchars(json_decode($userprofile->i('content'), true)['aboutlive']['value']);
|
$city = htmlspecialchars(json_decode($userprofile->i('content'), true)['aboutlive']['value']);
|
||||||
$photourl = $userprofile->i('photourl');
|
$photourl = $userprofile->i('photourl');
|
||||||
$regdate = Date::zmdate($userprofile->content('regdate'));
|
$regdate = Date::zmdate($userprofile->content('regdate'));
|
||||||
|
$about = json_decode($userprofile->i('content'), true)['aboutmemo']['value'];
|
||||||
|
$birthdate = json_decode($userprofile->i('content'), true)['aboutbirthday']['value'];
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
@ -43,7 +47,7 @@ if (explode('@', $_SERVER['REQUEST_URI'])[1] === 'transphoto.org') {
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ($usercttc === True) {
|
if ($usercttc === True) {
|
||||||
echo '<div style="float:left; border:solid 1px #3b7dc1; padding:6px 10px 7px; margin-bottom:13px; background-color:#0199ff44"><b>Профиль на transphoto.org</b><br>Пользователь не зарегистрирован на сервере '.NGALLERY['root']['title'].'. Информация может быть неполной.<br><a href="https://transphoto.org/author/'.$id.'" target="_blank">Открыть на transphoto.org</a></div>';
|
echo '<div style="float:left; border:solid 1px #3b7dc1; padding:6px 10px 7px; margin-bottom:13px; background-color:#0199ff44"><b>Профиль на transphoto.org</b><br>Пользователь не зарегистрирован на сервере '.NGALLERY['root']['title'].'. Информация может быть неполной.<br><a href="https://transphoto.org/author/'.(int)explode('/', explode('@', $_SERVER['REQUEST_URI'])[0])[2].'" target="_blank">Открыть на transphoto.org</a></div>';
|
||||||
}
|
}
|
||||||
if ($userprofile->i('admin') === 1) {
|
if ($userprofile->i('admin') === 1) {
|
||||||
echo 'Администратор сервера';
|
echo 'Администратор сервера';
|
||||||
|
@ -73,11 +77,12 @@ if (explode('@', $_SERVER['REQUEST_URI'])[1] === 'transphoto.org') {
|
||||||
<td><?= $city ?></td>
|
<td><?= $city ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (json_decode($userprofile->i('content'), true)['aboutbirthday']['value'] != null) { ?>
|
if ($birthdate != null) { ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="sm" style="padding:3px 10px 3px 0">День рождения:</td>
|
<td class="sm" style="padding:3px 10px 3px 0">День рождения:</td>
|
||||||
<td><?= htmlspecialchars(json_decode($userprofile->i('content'), true)['aboutbirthday']['value']) ?></td>
|
<td><?= $birthdate ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</col></table>
|
</col></table>
|
||||||
|
@ -224,17 +229,18 @@ if (explode('@', $_SERVER['REQUEST_URI'])[1] === 'transphoto.org') {
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
if (json_decode($userprofile->i('content'), true)['aboutmemo']['value'] != null) { ?>
|
|
||||||
|
if (($about != null) && $usercttc === False) { ?>
|
||||||
<div class="p20" style="margin-top: 8px; background-color: white !important;">
|
<div class="p20" style="margin-top: 8px; background-color: white !important;">
|
||||||
<h4>О себе</h4>
|
<h4>О себе</h4>
|
||||||
<?php
|
<?=
|
||||||
$bbcode= new ChrisKonnertz\BBCode\BBCode();
|
$about
|
||||||
|
|
||||||
$rendered = $bbcode->render(nl2br(htmlspecialchars(json_decode($userprofile->i('content'), true)['aboutmemo']['value'])));
|
|
||||||
echo $rendered;
|
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } else if ($usercttc === True) {
|
||||||
|
echo $about;
|
||||||
|
} ?>
|
||||||
|
|
||||||
|
|
||||||
<div style="margin-top: 25px;"><b><a href="/search?id=<?=$userprofile->i('id')?>">Найти все фотографии, сделанные этим пользователем</a></b></div>
|
<div style="margin-top: 25px;"><b><a href="/search?id=<?=$userprofile->i('id')?>">Найти все фотографии, сделанные этим пользователем</a></b></div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue