Style improvement and lone question page

This commit is contained in:
Pòsweg 2020-08-16 17:22:31 +02:00
parent fa7c6d1533
commit 82c840ce4a
6 changed files with 104 additions and 6 deletions

View File

@ -10,7 +10,8 @@
- Twitter post publication - Twitter post publication
- Toggle Twitter posting - Toggle Twitter posting
- Mastodon login - Mastodon login
- Add various language support. - Add various language support
- Make unanswered questions not show on the profile
- Config panel to change: - Config panel to change:
- Bio - Bio

View File

@ -20,7 +20,7 @@ else{
} }
else{ else{
$db->exec("DELETE FROM questions WHERE id = " . $question["id"] . ";"); $db->exec("DELETE FROM questions WHERE id = " . $question["id"] . ";");
if($pretty_urls){ if($fancy_urls){
header("Location: /user/" . $db->querySingle("SELECT username FROM users WHERE id = " . $question["user"] . ";")); header("Location: /user/" . $db->querySingle("SELECT username FROM users WHERE id = " . $question["user"] . ";"));
die(); die();
} }

View File

@ -58,7 +58,7 @@ else{
$tweet = $question["question"] . $separator . $question["answer"]; $tweet = $question["question"] . $separator . $question["answer"];
} }
} }
$tweet = $tweet . " https://ask.fai.su/user/" . $user["username"]; $tweet = $tweet . " https://" . $_SERVER['HTTP_HOST'] . "/user/" . $user["username"] . "?p=" . $question["id"];
// echo strlen($tweet) . " - " . strlen($question["answer"]) . "<br/><br/>\n"; // echo strlen($tweet) . " - " . strlen($question["answer"]) . "<br/><br/>\n";
// echo $tweet; // echo $tweet;
@ -68,7 +68,7 @@ else{
post_tweet(htmlspecialchars_decode($tweet, ENT_QUOTES)); post_tweet(htmlspecialchars_decode($tweet, ENT_QUOTES));
} }
if($pretty_urls){ if($fancy_urls){
header("Location: /user/" . $db->querySingle("SELECT username FROM users WHERE id = " . $question["user"] . ";")); header("Location: /user/" . $db->querySingle("SELECT username FROM users WHERE id = " . $question["user"] . ";"));
die(); die();
} }

View File

@ -3,5 +3,6 @@ $color_main = "#353942";
$color_bg = "#282b32"; $color_bg = "#282b32";
$color_2 = "#464c58"; $color_2 = "#464c58";
$color_3 = "#5a6271"; $color_3 = "#5a6271";
$color_4 = "#aab9cb";
?> ?>

View File

@ -22,7 +22,6 @@
/* user profile styling */ /* user profile styling */
#user-container{ #user-container{
/*background-color: black;*/
text-align: center; text-align: center;
background-color: <?= $color_3 ?>; background-color: <?= $color_3 ?>;
padding: 30px; padding: 30px;
@ -56,6 +55,39 @@
background-color: <?= $color_main ?> background-color: <?= $color_main ?>
} }
/* Highlighted post (?p=id) */
.highlighted-post{
background-color: <?= $color_2 ?>;
padding: 10px;
margin-bottom: 50px;
}
.highlighted-post .question-body{
margin: 30px;
}
.highlighted-post .question-date{
margin-top: 40px;
float: none;
}
.highlighted-post .question-text{
margin: 15px;
}
.highlighted-post .answer{
background-color: <?= $color_main ?>;
margin: 0px;
padding: 30px;
}
.highlighted-post .answer .title{
font-weight: bold;
margin-bottom: 15px;
}
.highlighted-post .answer-text{
padding: 15px;
}
.highlighted-post .answer-date{
color: <?= $color_4 ?>;
}
/* Questions */ /* Questions */
.question-container{ .question-container{
padding: 10px; padding: 10px;
@ -63,7 +95,7 @@
} }
.question{ .question{
margin: 20px; margin: 20px;
margin-bottom: 10px; margin-bottom: 40px;
} }
.question-username{ .question-username{
font-size: 20px; font-size: 20px;
@ -78,6 +110,12 @@
float: right; float: right;
margin-bottom: 20px; margin-bottom: 20px;
} }
.question-footer, .question-footer a{
color: <?= $color_4 ?>
}
.question-footer a:hover{
color: white;
}
.answer{ .answer{
clear: both; clear: both;

View File

@ -47,6 +47,62 @@ if(isset($_SESSION["uid"])){
} }
?> ?>
</div> </div>
<?php
if(isset($_GET["p"])){
$h_question = $db->query("SELECT * FROM questions WHERE id = " . $_GET["p"] . ";")->fetchArray(SQLITE3_ASSOC);
$h_user = $db->query("SELECT * FROM users WHERE id = " . $h_question["by"] . ";")->fetchArray(SQLITE3_ASSOC);
if($p_user["id"] == $h_question["user"]){
echo('<div class="highlighted-post">');
echo('<div class="question-body">');
$time = new DateTime("@0");
echo("<p class='question-username'>");
if($h_user["id"] == 0){
echo($h_user["name"]);
}
else if($fancy_urls){
echo("<a href='/user/" . $h_user["name"] . "'>" . $h_user["name"] ."</a>");
}
else{
echo("<a href='/user.php?q=" . $h_user["name"] . "'>" . $h_user["name"] ."</a>");
}
echo(" asked:</p>");
echo("\t<p class='question-text'>". $h_question["question"] ."</p>\n");
if($is_h_question_user){
echo("\t<a href='/action/reply.php?q=".$h_question["id"]."'>reply</a> ");
echo("\t<a href='/action/delete-question.php?q=".$h_question["id"]."'>delete</a> ");
echo("fav ignore ");
}
// Time
$time->settimestamp($h_question["q_date"]);
echo('<p class="question-date">');
echo('<a href="?p=' . $h_question["id"] . '">' . $time->format('Y-m-d h:i:s') . '</a>');
echo('</p>');
echo('</div>'); // question-body
if($h_question["answer"]){
echo("<div class='answer'>");
echo('<p class="title">' . $p_user["name"] . ' answered:');
echo("<p class='answer-text'>" . $h_question["answer"] . "</p>");
$time->settimestamp($h_question["a_date"]);
echo("<p class='answer-date'>" . $time->format("Y-m-d h:i:s") . "</p>");
echo("</div>");
}
echo("\n\n");
echo('</div>');
}
}
?>
<div class="columns-container"> <div class="columns-container">
<div class="column form-column"> <div class="column form-column">
@ -78,6 +134,7 @@ if(isset($_SESSION["uid"])){
else echo("<p class='question-username'><a href='/user.php?q=" . $q_user["name"] . "'>" . $q_user["name"] ."</a></p>\n"); else echo("<p class='question-username'><a href='/user.php?q=" . $q_user["name"] . "'>" . $q_user["name"] ."</a></p>\n");
echo("\t<p class='question-text'>". $current["question"] ."</p>\n"); echo("\t<p class='question-text'>". $current["question"] ."</p>\n");
echo('<div class="question-footer">');
if($is_current_user){ if($is_current_user){
echo("\t<a href='/action/reply.php?q=".$current["id"]."'>reply</a> "); echo("\t<a href='/action/reply.php?q=".$current["id"]."'>reply</a> ");
echo("\t<a href='/action/delete-question.php?q=".$current["id"]."'>delete</a> "); echo("\t<a href='/action/delete-question.php?q=".$current["id"]."'>delete</a> ");
@ -89,6 +146,7 @@ if(isset($_SESSION["uid"])){
echo('<a href="?p=' . $current["id"] . '">'); echo('<a href="?p=' . $current["id"] . '">');
echo("<p class='question-date'>" . $time->format("Y-m-d h:i:s") . "</p>"); echo("<p class='question-date'>" . $time->format("Y-m-d h:i:s") . "</p>");
echo("</a>"); echo("</a>");
echo('</div>');
if($current["answer"]){ if($current["answer"]){
echo("<div class='answer'>"); echo("<div class='answer'>");