diff --git a/admin/ajax_pastes.php b/admin/ajax_pastes.php index 4dfe9a3..04e9522 100644 --- a/admin/ajax_pastes.php +++ b/admin/ajax_pastes.php @@ -65,4 +65,3 @@ require('ssp.pastes.php'); echo json_encode( SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns, $columns2) ); -?> \ No newline at end of file diff --git a/admin/ajax_reports.php b/admin/ajax_reports.php index 89a4acd..0f4765e 100644 --- a/admin/ajax_reports.php +++ b/admin/ajax_reports.php @@ -1,9 +1,7 @@ \ No newline at end of file diff --git a/admin/ajax_users.php b/admin/ajax_users.php index 0ebb9eb..6b7e2c8 100644 --- a/admin/ajax_users.php +++ b/admin/ajax_users.php @@ -54,4 +54,4 @@ if ($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") { header("Location: http://ponepaste.org/SVOtaKqJZh4nT9Z"); die(); } -?> + diff --git a/admin/interface.php b/admin/interface.php index 9c1176f..d2a4cee 100644 --- a/admin/interface.php +++ b/admin/interface.php @@ -14,9 +14,7 @@ */ session_start(); -if (isset($_SESSION['login'])) { -// Do nothing -} else { +if (!isset($_SESSION['login'])) { header("Location: ."); exit(); } @@ -57,9 +55,7 @@ while ($row = mysqli_fetch_array($result)) { } if ($last_ip == $ip) { - if ($last_date == $date) { - - } else { + if ($last_date != $date) { $query = "INSERT INTO admin_history (last_date,ip) VALUES ('$date','$ip')"; mysqli_query($con, $query); } @@ -192,8 +188,7 @@ if ($last_ip == $ip) { $fname = explode('.php', $files1[$loop]); $fname = $fname[0]; $ffname = $files1[$loop]; - if ($ffname == "index.php") {/* we don't want index.php showing */ - } else { + if ($ffname != "index.php") { echo ''; } } diff --git a/admin/ipbans.php b/admin/ipbans.php index 4a079e8..d207d19 100644 --- a/admin/ipbans.php +++ b/admin/ipbans.php @@ -14,9 +14,7 @@ */ session_start(); -if (isset($_SESSION['login'])) { -// Do nothing -} else { +if (!isset($_SESSION['login'])) { header("Location: ."); exit(); } @@ -57,9 +55,7 @@ while ($row = mysqli_fetch_array($result)) { } if ($last_ip == $ip) { - if ($last_date == $date) { - - } else { + if ($last_date != $date) { $query = "INSERT INTO admin_history (last_date,ip) VALUES ('$date','$ip')"; mysqli_query($con, $query); } @@ -97,7 +93,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST' || isset($_GET['banip'])) { } } -if (isset($_GET{'delete'})) { +if (isset($_GET['delete'])) { $delete = htmlentities(Trim($_GET['delete'])); $query = "DELETE FROM ban_user WHERE id=$delete"; $result = mysqli_query($con, $query); @@ -237,8 +233,8 @@ if (isset($_GET{'delete'})) { $rec_count = Trim($row[0]); - if (isset($_GET{'page'})) { // Current page - $page = $_GET{'page'} + 1; + if (isset($_GET['page'])) { // Current page + $page = $_GET['page'] + 1; $offset = $rec_limit * $page; } else { // Show first set of results diff --git a/admin/js/plugins/ckeditor/samples/sample_posteddata.php b/admin/js/plugins/ckeditor/samples/sample_posteddata.php index 0657699..e076223 100644 --- a/admin/js/plugins/ckeditor/samples/sample_posteddata.php +++ b/admin/js/plugins/ckeditor/samples/sample_posteddata.php @@ -14,4 +14,4 @@ -------------------------------------------------------------------------------------------
*/ -include "assets/posteddata.php"; ?> +include "assets/posteddata.php"; diff --git a/admin/pages.php b/admin/pages.php index e975464..46bfab2 100644 --- a/admin/pages.php +++ b/admin/pages.php @@ -18,28 +18,27 @@ require_once('common.php'); updateAdminHistory($conn); if ($_SERVER['REQUEST_METHOD'] == 'POST') { - if (isset($_POST{'editme'})) { + if (isset($_POST['editme'])) { $edit_me_id = htmlentities(Trim($_POST['editme'])); $page_name = Trim($_POST['page_name']); $page_title = Trim($_POST['page_title']); $page_content = $_POST['data']; $query = "UPDATE pages SET last_date='$date', page_name='$page_name', page_title='$page_title', page_content='$page_content' WHERE id='$edit_me_id'"; - mysqli_query($con, $query); } else { $page_name = Trim($_POST['page_name']); $page_title = Trim($_POST['page_title']); $page_content = $_POST['data']; $query = "INSERT INTO pages (last_date,page_name,page_title,page_content) VALUES ('$date','$page_name','$page_title','$page_content')"; - mysqli_query($con, $query); } + mysqli_query($con, $query); $page_name = ""; $page_title = ""; $page_content = ""; } -if (isset($_GET{'edit'})) { +if (isset($_GET['edit'])) { $page_id = trim($_GET['edit']); $sql = "SELECT * FROM pages where id='$page_id'"; @@ -120,7 +119,7 @@ if (isset($_GET{'edit'})) {

'; } ?> @@ -151,7 +150,7 @@ if (isset($_GET{'edit'})) { Delete \ No newline at end of file diff --git a/admin/ssp.reports.php b/admin/ssp.reports.php index 682b6ed..5ff22c5 100644 --- a/admin/ssp.reports.php +++ b/admin/ssp.reports.php @@ -395,4 +395,3 @@ class SSP { } } -?> \ No newline at end of file diff --git a/admin/ssp.users.php b/admin/ssp.users.php index 09a7f5e..d622159 100644 --- a/admin/ssp.users.php +++ b/admin/ssp.users.php @@ -399,4 +399,3 @@ if ($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") { header("Location: http://ponepaste.org/SVOtaKqJZh4nT9Z"); die(); } -?> \ No newline at end of file diff --git a/admin/tasksqqq.php b/admin/tasksqqq.php index df10913..240e180 100644 --- a/admin/tasksqqq.php +++ b/admin/tasksqqq.php @@ -14,9 +14,7 @@ */ session_start(); -if (isset($_SESSION['login'])) { -// Do nothing -} else { +if (!isset($_SESSION['login'])) { header("Location: ."); exit(); } diff --git a/api/ajax_pastes.php b/api/ajax_pastes.php index d7724ba..48d9dab 100644 --- a/api/ajax_pastes.php +++ b/api/ajax_pastes.php @@ -43,4 +43,3 @@ require('ssp.pastes.php'); echo json_encode( SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns, $columns2) ); -?> \ No newline at end of file diff --git a/api/public.pastes.php b/api/public.pastes.php index a36091a..383d646 100644 --- a/api/public.pastes.php +++ b/api/public.pastes.php @@ -281,8 +281,7 @@ class SSP { } catch (PDOException $e) { self::fatal("An SQL error occurred: " . $e->getMessage()); } - $result = $stmt->fetchAll(); - return $result; + return $stmt->fetchAll(); } static function Ssql_exec($db, $bindings, $sql = null) { @@ -389,4 +388,3 @@ class SSP { } } -?> \ No newline at end of file diff --git a/api/ssp.pastes.php b/api/ssp.pastes.php index 3e1121a..b551b0f 100644 --- a/api/ssp.pastes.php +++ b/api/ssp.pastes.php @@ -308,8 +308,7 @@ class SSP { } catch (PDOException $e) { self::fatal("An SQL error occurred: " . $e->getMessage()); } - $result = $stmt->fetchAll(); - return $result; + return $stmt->fetchAll(); } static function Ssql_exec($db, $bindings, $sql = null) { @@ -341,7 +340,7 @@ class SSP { $result[$loop]['id'] = $arr['id']; $result[$loop]['member'] = $arr['member']; $result[$loop]['tagsys'] = sandwitch($arr['tagsys']); - $date_time = strtotime(isset($arr['date']) ? $arr['date'] : '0'); + $date_time = strtotime($arr['date'] ?? '0'); $result[$loop]['date'] = date("d F Y", $date_time); $myid = $arr['id']; $mytitle = $arr['title']; diff --git a/archive.php b/archive.php index 28530fe..deb8c91 100644 --- a/archive.php +++ b/archive.php @@ -33,4 +33,3 @@ $p_title = $lang['archive']; // "Pastes Archive"; require_once('theme/' . $default_theme . '/header.php'); require_once('theme/' . $default_theme . '/archive.php'); require_once('theme/' . $default_theme . '/footer.php'); -?> \ No newline at end of file diff --git a/event.php b/event.php index 19b6b48..3fa02b0 100644 --- a/event.php +++ b/event.php @@ -29,4 +29,3 @@ $p_title = $lang['archive']; // "Pastes Archive"; require_once('theme/' . $default_theme . '/header.php'); require_once('theme/' . $default_theme . '/event.php'); require_once('theme/' . $default_theme . '/footer.php'); -?> \ No newline at end of file diff --git a/includes/captcha.php b/includes/captcha.php index 3247b77..fe61c1d 100644 --- a/includes/captcha.php +++ b/includes/captcha.php @@ -1,5 +1,9 @@ "mixed|string", 'image_src' => "string"])] +function captcha($color, $mode, $mul, $allowed) : array { $bg_path = dirname(__FILE__) . '/captchabg/'; $font_path = dirname(__FILE__) . '/fonts/'; @@ -100,10 +104,10 @@ function captcha($color, $mode, $mul, $allowed) { $_SESSION['_CAPTCHA']['config'] = serialize($captcha_config); - return array( + return [ 'code' => $captcha_config['code'], 'image_src' => $image_src - ); + ]; } diff --git a/includes/common.php b/includes/common.php index ee54fc3..6616df1 100644 --- a/includes/common.php +++ b/includes/common.php @@ -68,14 +68,13 @@ function updatePageViews(PDO $conn) : void { $last_date = $last_page_view['date']; if ($last_date == $date) { - if (str_contains($data_ip, $ip)) { - $last_tpage = intval($last_page_view['tpage']) + 1; + $last_tpage = intval($last_page_view['tpage']) + 1; + if (str_contains($data_ip, $ip)) { // IP already exists, Update view count $statement = $conn->prepare("UPDATE page_view SET tpage = ? WHERE id = ?"); $statement->execute([$last_tpage, $last_page_view['id']]); } else { - $last_tpage = intval($last_page_view['tpage']) + 1; $last_tvisit = intval($last_page_view['tvisit']) + 1; // Update both tpage and tvisit. diff --git a/includes/functions.php b/includes/functions.php index c0fad21..3444a16 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -13,19 +13,6 @@ * GNU General Public License in GPL.txt for more details. */ - -function timer() { - static $start; - - if (is_null($start)) { - $start = microtime(true); - } else { - $diff = round((microtime(true) - $start), 4); - $start = null; - return $diff; - } -} - function getUserFavs(PDO $conn, string $user_id) : array { $query = $conn->prepare( "SELECT pins.f_time, pastes.id, pastes.title, pastes.created_at, pastes.tagsys @@ -100,21 +87,16 @@ function linkify($value, $protocols = array('http', 'mail'), array $attributes = // Extract text links for each protocol foreach ((array)$protocols as $protocol) { - switch ($protocol) { - case 'http': - case 'https': - $value = preg_replace_callback('~(?:(https?)://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?$protocol://$link") . '>'; - }, $value); - break; - default: - $value = preg_replace_callback('~' . preg_quote($protocol, '~') . '://([^\s<]+?)(?$protocol://{$match[1]}") . '>'; - }, $value); - break; - } + $value = match ($protocol) { + 'http', 'https' => preg_replace_callback('~(?:(https?)://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?$protocol://$link") . '>'; + }, $value), + default => preg_replace_callback('~' . preg_quote($protocol, '~') . '://([^\s<]+?)(?$protocol://{$match[1]}") . '>'; + }, $value), + }; } // Insert all link @@ -213,7 +195,7 @@ function getRecent($conn, $count) { } function getRecentadmin($conn, $count = 5) { - $query = $conn->prepare('SELECT id, ip title, date, now_time, views, member FROM pastes ORDER BY id DESC LIMIT 0, ?'); + $query = $conn->prepare('SELECT id, ip, title, date, now_time, views, member FROM pastes ORDER BY id DESC LIMIT 0, ?'); $query->execute([$count]); return $query->fetchAll(); @@ -255,8 +237,8 @@ LIMIT 0 , ?"); function getUserPastes(PDO $conn, $user_id) : array { $query = $conn->prepare( - "SELECT id, title, visible,code,created_at,tagsys,user_id from pastes WHERE user_id= ? - ORDER by pastes.id DESC"); + "SELECT id, title, visible, code, created_at, tagsys, user_id, views from pastes WHERE user_id = ? + ORDER by pastes.id DESC"); $query->execute([$user_id]); return $query->fetchAll(); } @@ -350,8 +332,7 @@ function conTime($secs) { $ret[] = 'ago'; $val = join(' ', $ret); - if (str_conntains($val, "week")) { - } else { + if (!str_conntains($val, "week")) { $val = str_replace("and", "", $val); } if (Trim($val) == "ago") { @@ -404,7 +385,7 @@ function truncatetag($input, $maxWords, $maxChars) { $truncated1[] = $fragment; } - $result = implode($truncated1, ' '); + $result = implode(' ', $truncated1); return $result . ($input == $result ? '' : '...'); } @@ -414,11 +395,9 @@ function doDownload($paste_id, $p_title, $p_member, $p_conntent, $p_code) { if ($p_code) { // Figure out extensions. $ext = "txt"; - switch ($p_code) { - default: - $ext = 'txt'; - break; - } + $ext = match ($p_code) { + default => 'txt', + }; // Download $p_title = stripslashes($p_title); diff --git a/includes/geshi.php b/includes/geshi.php index d02d4fa..b81b7fc 100644 --- a/includes/geshi.php +++ b/includes/geshi.php @@ -1,7 +1,7 @@ + use_classes = ($flag) ? true : false; + $this->use_classes = (bool)$flag; } /** @@ -1011,7 +1011,7 @@ class GeSHi { * @since 1.0.0 */ public function set_keyword_group_highlighting($key, $flag = true) { - $this->lexic_permissions['KEYWORDS'][$key] = ($flag) ? true : false; + $this->lexic_permissions['KEYWORDS'][$key] = (bool)$flag; } /** @@ -1051,7 +1051,7 @@ class GeSHi { * @since 1.0.0 */ public function set_comments_highlighting($key, $flag = true) { - $this->lexic_permissions['COMMENTS'][$key] = ($flag) ? true : false; + $this->lexic_permissions['COMMENTS'][$key] = (bool)$flag; } /** @@ -1080,7 +1080,7 @@ class GeSHi { * @since 1.0.0 */ public function set_escape_characters_highlighting($flag = true) { - $this->lexic_permissions['ESCAPE_CHAR'] = ($flag) ? true : false; + $this->lexic_permissions['ESCAPE_CHAR'] = (bool)$flag; } /** @@ -1116,7 +1116,7 @@ class GeSHi { * @deprecated In favour of set_symbols_highlighting */ public function set_brackets_highlighting($flag) { - $this->lexic_permissions['BRACKETS'] = ($flag) ? true : false; + $this->lexic_permissions['BRACKETS'] = (bool)$flag; } /** @@ -1152,7 +1152,7 @@ class GeSHi { */ public function set_symbols_highlighting($flag) { // Update lexic permissions for this symbol group - $this->lexic_permissions['SYMBOLS'] = ($flag) ? true : false; + $this->lexic_permissions['SYMBOLS'] = (bool)$flag; // For backward compatibility $this->set_brackets_highlighting($flag); @@ -1184,7 +1184,7 @@ class GeSHi { * @since 1.0.0 */ public function set_strings_highlighting($flag) { - $this->lexic_permissions['STRINGS'] = ($flag) ? true : false; + $this->lexic_permissions['STRINGS'] = (bool)$flag; } /** @@ -1233,7 +1233,7 @@ class GeSHi { * @since 1.0.0 */ public function set_numbers_highlighting($flag) { - $this->lexic_permissions['NUMBERS'] = ($flag) ? true : false; + $this->lexic_permissions['NUMBERS'] = (bool)$flag; } /** @@ -1264,7 +1264,7 @@ class GeSHi { * @since 1.0.0 */ public function set_methods_highlighting($flag) { - $this->lexic_permissions['METHODS'] = ($flag) ? true : false; + $this->lexic_permissions['METHODS'] = (bool)$flag; } /** @@ -1295,7 +1295,7 @@ class GeSHi { * @since 1.0.0 */ public function set_regexps_highlighting($key, $flag) { - $this->lexic_permissions['REGEXPS'][$key] = ($flag) ? true : false; + $this->lexic_permissions['REGEXPS'][$key] = (bool)$flag; } /** @@ -1306,7 +1306,7 @@ class GeSHi { * @since 1.0.0 */ public function set_case_sensitivity($key, $case) { - $this->language_data['CASE_SENSITIVE'][$key] = ($case) ? true : false; + $this->language_data['CASE_SENSITIVE'][$key] = (bool)$case; } /** @@ -1406,7 +1406,7 @@ class GeSHi { * @todo Rewrite with array traversal */ public function enable_highlighting($flag = true) { - $flag = $flag ? true : false; + $flag = (bool)$flag; foreach ($this->lexic_permissions as $key => $value) { if (is_array($value)) { foreach ($value as $k => $v) { @@ -1781,7 +1781,7 @@ class GeSHi { * @since 1.0.2 */ public function enable_important_blocks($flag) { - $this->enable_important_blocks = ($flag) ? true : false; + $this->enable_important_blocks = (bool)$flag; } /** @@ -1791,7 +1791,7 @@ class GeSHi { * @since 1.0.2 */ public function enable_ids($flag = true) { - $this->add_ids = ($flag) ? true : false; + $this->add_ids = (bool)$flag; } /** @@ -3192,14 +3192,11 @@ class GeSHi { * @since 1.0.0 */ protected function change_case($instr) { - switch ($this->language_data['CASE_KEYWORDS']) { - case GESHI_CAPS_UPPER: - return strtoupper($instr); - case GESHI_CAPS_LOWER: - return strtolower($instr); - default: - return $instr; - } + return match ($this->language_data['CASE_KEYWORDS']) { + GESHI_CAPS_UPPER => strtoupper($instr), + GESHI_CAPS_LOWER => strtolower($instr), + default => $instr, + }; } /** @@ -3445,8 +3442,7 @@ class GeSHi { foreach (array_keys($this->language_data['KEYWORDS']) as $k) { if (!$this->use_classes) { $attributes = ' style="' . - (isset($this->language_data['STYLES']['KEYWORDS'][$k]) ? - $this->language_data['STYLES']['KEYWORDS'][$k] : "") . '"'; + ($this->language_data['STYLES']['KEYWORDS'][$k] ?? "") . '"'; } else { $attributes = ' class="kw' . $k . '"'; } @@ -4126,7 +4122,7 @@ class GeSHi { $footer = $this->footer_content; if ($footer) { if ($this->header_type == GESHI_HEADER_PRE) { - $footer = str_replace("\n", '', $footer);; + $footer = str_replace("\n", '', $footer); } $footer = $this->replace_keywords($footer); @@ -4377,20 +4373,12 @@ class GeSHi { // or the appropriate key is given. foreach ($this->link_styles as $key => $style) { if ($style != '') { - switch ($key) { - case GESHI_LINK: - $stylesheet .= "{$selector}a:link {{$style}}\n"; - break; - case GESHI_HOVER: - $stylesheet .= "{$selector}a:hover {{$style}}\n"; - break; - case GESHI_ACTIVE: - $stylesheet .= "{$selector}a:active {{$style}}\n"; - break; - case GESHI_VISITED: - $stylesheet .= "{$selector}a:visited {{$style}}\n"; - break; - } + $stylesheet .= match ($key) { + GESHI_LINK => "{$selector}a:link {{$style}}\n", + GESHI_HOVER => "{$selector}a:hover {{$style}}\n", + GESHI_ACTIVE => "{$selector}a:active {{$style}}\n", + GESHI_VISITED => "{$selector}a:visited {{$style}}\n", + }; } } diff --git a/index.php b/index.php index bf4935a..d8d23ad 100644 --- a/index.php +++ b/index.php @@ -236,4 +236,3 @@ OutPut: require_once('theme/' . $default_theme . '/header.php'); require_once('theme/' . $default_theme . '/main.php'); require_once('theme/' . $default_theme . '/footer.php'); -?> \ No newline at end of file diff --git a/langs/bg.php b/langs/bg.php index cd5fc31..75d2e57 100644 --- a/langs/bg.php +++ b/langs/bg.php @@ -117,4 +117,4 @@ $lang['profile-total-pri'] = "Total private pastes:"; $lang['profile-total-views'] = "Total views of all your pastes:"; $lang['embed-hosted-by'] = "hosted by"; $lang['view-raw'] = "Покажи в необработен текст"; -?> + diff --git a/langs/br.php b/langs/br.php index f209094..cd2acd6 100644 --- a/langs/br.php +++ b/langs/br.php @@ -118,4 +118,4 @@ $lang['profile-total-pri'] = "Numero de pastes privados:"; $lang['profile-total-views'] = "Numero de visualizações nos seus pastes:"; $lang['embed-hosted-by'] = "hospedado por"; $lang['view-raw'] = "Ver texto bruto"; -?> + diff --git a/langs/de.php b/langs/de.php index e99cb02..6d1c51e 100644 --- a/langs/de.php +++ b/langs/de.php @@ -119,4 +119,4 @@ $lang['profile-total-pri'] = "Total private Pastes:"; $lang['profile-total-views'] = "Total Ansichten all deiner Pastes:"; $lang['embed-hosted-by'] = "gehostet von"; $lang['view-raw'] = "Zeige Raw"; -?> + diff --git a/langs/en.php b/langs/en.php index 9251c62..53dae62 100644 --- a/langs/en.php +++ b/langs/en.php @@ -130,4 +130,4 @@ $lang['pastfavs-total'] = "Total Favorites of your pastes:"; $lang['yourfavs-total'] = "Total Favorites by you:"; $lang['embed-hosted-by'] = "hosted by"; $lang['view-raw'] = "View Raw"; -?> + diff --git a/langs/es.php b/langs/es.php index 4716520..ad8951d 100644 --- a/langs/es.php +++ b/langs/es.php @@ -117,4 +117,4 @@ $lang ['perfil-total-pri'] = "Total de pegados privados:"; $lang ['profile-total-views'] = "Total de vistas de todos sus pegados:"; $lang ['embed-hosted-by'] = "alojado por"; $lang ['view-raw'] = "Ver crudo"; -?> + diff --git a/langs/fr.php b/langs/fr.php index a8afc77..04b7011 100644 --- a/langs/fr.php +++ b/langs/fr.php @@ -119,4 +119,3 @@ $lang['profile-total-views'] = "Nombre total de vues :"; $lang['embed-hosted-by'] = "hébergé par"; $lang['view-raw'] = "Voir les données brutes"; -?> \ No newline at end of file diff --git a/langs/pl.php b/langs/pl.php index d243f44..c5cd5c0 100644 --- a/langs/pl.php +++ b/langs/pl.php @@ -119,4 +119,4 @@ $lang['profile-total-pri'] = "Prywatne wklejki:"; $lang['profile-total-views'] = "Wyświetlenia wszystkich wklejek:"; $lang['embed-hosted-by'] = "przechowywane na"; $lang['view-raw'] = "Surowy plik"; -?> + diff --git a/langs/ru.php b/langs/ru.php index 9ac61e8..3304baa 100644 --- a/langs/ru.php +++ b/langs/ru.php @@ -5,4 +5,3 @@ $lang = array(); -?> \ No newline at end of file diff --git a/theme/bulma/archive.php b/theme/bulma/archive.php index 01d8213..8d9131e 100644 --- a/theme/bulma/archive.php +++ b/theme/bulma/archive.php @@ -75,8 +75,7 @@ ?> diff --git a/theme/bulma/event.php b/theme/bulma/event.php index 293bbfe..56daaf9 100644 --- a/theme/bulma/event.php +++ b/theme/bulma/event.php @@ -69,8 +69,7 @@ + if (!isset($privatesite) || $privatesite != "on") { ?>
Entries Deadline
@@ -217,8 +216,9 @@ diff --git a/theme/bulma/user_profile.php b/theme/bulma/user_profile.php index 4621260..7b96b83 100644 --- a/theme/bulma/user_profile.php +++ b/theme/bulma/user_profile.php @@ -174,28 +174,22 @@ $protocol = paste_protocol(); format("d F Y"); $p_views = Trim($row['views']); - $p_visible = Trim($row['visible']); + $p_visible = intval($row['visible']); $p_tags = Trim($row['tagsys']); $tagArray = explode(',', $p_tags); $tagArray = array_filter($tagArray); - switch ($p_visible) { - case 0: - $p_visible = $lang['public']; - break; - case 1: - $p_visible = $lang['unlisted']; - break; - case 2: - $p_visible = $lang['private']; - break; - } + $p_visible = match ($p_visible) { + 0 => $lang['public'], + 1 => $lang['unlisted'], + 2 => $lang['private'] + }; $p_link = ($mod_rewrite == '1') ? "$p_id" : "paste.php?id=$p_id"; $p_delete_link = ($mod_rewrite == '1') ? "user.php?del&user=$profile_username&id=$p_id" : "user.php?del&user=$profile_username&id=$p_id"; $p_tag_link = ($mod_rewrite == '1') ? "user.php?user=$profile_username&q=$p_tags" : "user.php?user=$profile_username&q=$tags"; @@ -206,7 +200,7 @@ $protocol = paste_protocol(); if ($row['visible'] == 0) { echo ' - ' . ($title) . ' + ' . ($title) . ' ' . $p_dateui . ' @@ -218,10 +212,10 @@ $protocol = paste_protocol(); if (strlen($p_tags) > 0) { foreach ($tagArray as $key => $tags) { echo '' . trim($tags) . ''; - }; + } } else { echo ' No tags'; - }; + } echo ' @@ -305,10 +299,10 @@ $protocol = paste_protocol(); if (strlen($f_tags) > 0) { foreach ($ftagArray as $key => $ftags) { echo '' . trim($ftags) . ''; - }; + } } else { echo ' No tags'; - }; + } echo '