X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fprofile.php;h=0aa42cf4462df9e29eb6f1d398978eb78016035a;hb=956fe99591311f49652750fa17b1e4487df35a5c;hp=f2df82849edf650fcc6ab608743e65021a879fd9;hpb=2f28c2ebbfd8f66093d7081d40b1d48f65fcff20;p=friendica.git diff --git a/mod/profile.php b/mod/profile.php index f2df82849e..0aa42cf446 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -24,6 +24,8 @@ use Friendica\Protocol\ActivityPub; use Friendica\Protocol\DFRN; use Friendica\Util\DateTimeFormat; use Friendica\Util\Security; +use Friendica\Util\Strings; +use Friendica\Util\XML; function profile_init(App $a) { @@ -57,8 +59,8 @@ function profile_init(App $a) $user = DBA::selectFirst('user', ['uid'], ['nickname' => $which]); if (DBA::isResult($user)) { $data = ActivityPub\Transmitter::getProfile($user['uid']); - echo json_encode($data); header('Content-Type: application/activity+json'); + echo json_encode($data); exit(); } } @@ -90,7 +92,7 @@ function profile_init(App $a) } $a->page['htmlhead'] .= '' . "\r\n"; - $a->page['htmlhead'] .= '' . "\r\n"; + $a->page['htmlhead'] .= '' . "\r\n"; $a->page['htmlhead'] .= '' . "\r\n"; $a->page['htmlhead'] .= '' . "\r\n"; $a->page['htmlhead'] .= '' . "\r\n"; @@ -113,9 +115,9 @@ function profile_content(App $a, $update = 0) for ($x = 2; $x < $a->argc; $x ++) { if (is_a_date_arg($a->argv[$x])) { if ($datequery) { - $datequery2 = escape_tags($a->argv[$x]); + $datequery2 = Strings::escapeHtml($a->argv[$x]); } else { - $datequery = escape_tags($a->argv[$x]); + $datequery = Strings::escapeHtml($a->argv[$x]); } } else { $category = $a->argv[$x]; @@ -192,7 +194,7 @@ function profile_content(App $a, $update = 0) if (!$update) { $tab = false; if (!empty($_GET['tab'])) { - $tab = notags(trim($_GET['tab'])); + $tab = Strings::escapeTags(trim($_GET['tab'])); } $o .= Profile::getTabs($a, $is_owner, $a->profile['nickname']); @@ -209,7 +211,7 @@ function profile_content(App $a, $update = 0) $commvisitor = $commpage && $remote_contact; $a->page['aside'] .= posted_date_widget(System::baseUrl(true) . '/profile/' . $a->profile['nickname'], $a->profile['profile_uid'], true); - $a->page['aside'] .= Widget::categories(System::baseUrl(true) . '/profile/' . $a->profile['nickname'], (!empty($category) ? xmlify($category) : '')); + $a->page['aside'] .= Widget::categories(System::baseUrl(true) . '/profile/' . $a->profile['nickname'], (!empty($category) ? XML::escape($category) : '')); $a->page['aside'] .= Widget::tagCloud(); if (Security::canWriteToUserWall($a->profile['profile_uid'])) { @@ -266,24 +268,26 @@ function profile_content(App $a, $update = 0) if (!DBA::isResult($items)) { return ''; } + + $pager = new Pager($a->query_string); } else { $sql_post_table = ""; if (!empty($category)) { $sql_post_table = sprintf("INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ", - DBA::escape(protect_sprintf($category)), intval(TERM_OBJ_POST), intval(TERM_CATEGORY), intval($a->profile['profile_uid'])); + DBA::escape(Strings::protectSprintf($category)), intval(TERM_OBJ_POST), intval(TERM_CATEGORY), intval($a->profile['profile_uid'])); } if (!empty($hashtags)) { $sql_post_table .= sprintf("INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ", - DBA::escape(protect_sprintf($hashtags)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG), intval($a->profile['profile_uid'])); + DBA::escape(Strings::protectSprintf($hashtags)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG), intval($a->profile['profile_uid'])); } if (!empty($datequery)) { - $sql_extra2 .= protect_sprintf(sprintf(" AND `thread`.`created` <= '%s' ", DBA::escape(DateTimeFormat::convert($datequery, 'UTC', date_default_timezone_get())))); + $sql_extra2 .= Strings::protectSprintf(sprintf(" AND `thread`.`created` <= '%s' ", DBA::escape(DateTimeFormat::convert($datequery, 'UTC', date_default_timezone_get())))); } if (!empty($datequery2)) { - $sql_extra2 .= protect_sprintf(sprintf(" AND `thread`.`created` >= '%s' ", DBA::escape(DateTimeFormat::convert($datequery2, 'UTC', date_default_timezone_get())))); + $sql_extra2 .= Strings::protectSprintf(sprintf(" AND `thread`.`created` >= '%s' ", DBA::escape(DateTimeFormat::convert($datequery2, 'UTC', date_default_timezone_get())))); } // Does the profile page belong to a forum?