mirror of
https://github.com/Neetpone/ponepaste.git
synced 2025-03-12 06:30:07 +01:00
created new function for userpage
username needed to added to url within tags.
This commit is contained in:
parent
259e4132ed
commit
cef0d39f18
1 changed files with 24 additions and 0 deletions
|
@ -76,6 +76,30 @@ function tagsToHtml(string | array $tags) : string {
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function tagsToHtmlUser(string | array $tags, $profile_username) : string {
|
||||||
|
$output = "";
|
||||||
|
if (is_array($tags)) {
|
||||||
|
$tagsSplit = array_map(function($tag) { return $tag['name']; }, $tags);
|
||||||
|
} else {
|
||||||
|
$tagsSplit = explode(",", $tags);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($tagsSplit as $tag) {
|
||||||
|
if (stripos($tag, 'nsfw') !== false) {
|
||||||
|
$tag = strtoupper($tag);
|
||||||
|
$tagcolor = "tag is-danger";
|
||||||
|
} elseif (stripos($tag, 'SAFE') !== false) {
|
||||||
|
$tag = strtoupper($tag);
|
||||||
|
$tagcolor = "tag is-success";
|
||||||
|
} elseif (str_contains($tag, '/')) {
|
||||||
|
$tagcolor = "tag is-primary";
|
||||||
|
} else {
|
||||||
|
$tagcolor = "tag is-info";
|
||||||
|
}
|
||||||
|
$output .= '<a href="/user.php?user=' . $profile_username . '&q=' . urlencode($tag) . '"><span class="' . $tagcolor . '">' . pp_html_escape(ucfirst($tag)) . '</span></a>';
|
||||||
|
}
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
function getevent($conn, $event_name, $count) {
|
function getevent($conn, $event_name, $count) {
|
||||||
$query = $conn->prepare("SELECT id, visible, title, date, now_time, views, member FROM pastes WHERE visible='1' AND tagsys LIKE '%?%'
|
$query = $conn->prepare("SELECT id, visible, title, date, now_time, views, member FROM pastes WHERE visible='1' AND tagsys LIKE '%?%'
|
||||||
|
|
Loading…
Add table
Reference in a new issue