Add missing fucntions file and adopt new redirect system
Ooops, it seems like i forgot to git add that file and i figure that out just now. Oopsies. Well, I've converted all the crucial stuff to the new system and it works wonders
This commit is contained in:
parent
7dec683bc4
commit
25e06f9ece
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
include("settings.php");
|
||||
|
||||
function redirect($base, $get, $force_unfancy = false){
|
||||
$result = "/" . $base;
|
||||
|
||||
if(!$GLOBALS['fancy_urls'] or $force_unfancy){
|
||||
$result .= ".php";
|
||||
}
|
||||
elseif(isset($get["q"])){
|
||||
$result .= "/" . $get["q"];
|
||||
unset($get["q"]);
|
||||
}
|
||||
|
||||
|
||||
if($get){
|
||||
$i = 0;
|
||||
foreach($get as $key => $value){
|
||||
if($i == 0) $result .= "?";
|
||||
else $result .= "&";
|
||||
|
||||
$result .= $key . "=" . $value;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return($result);
|
||||
}
|
||||
|
||||
?>
|
32
user.php
32
user.php
|
@ -73,13 +73,8 @@ if(isset($_GET["p"])){
|
|||
echo($h_user["name"]);
|
||||
}
|
||||
else{
|
||||
echo("<a href='/user");
|
||||
|
||||
if($fancy_urls)
|
||||
echo ("/");
|
||||
else
|
||||
echo(".php?q=");
|
||||
echo($h_user["name"] . "'>" . $h_user["name"] ."</a>\n");
|
||||
$new_get["q"] = $h_user["name"];
|
||||
echo("<a href='" . redirect("user", $new_get) . "'>" . $h_user["name"] ."</a>\n");
|
||||
}
|
||||
echo(" asked:</p>");
|
||||
|
||||
|
@ -152,6 +147,7 @@ if(isset($_GET["p"])){
|
|||
|
||||
|
||||
$time = new DateTime("@0");
|
||||
$tmp_get = $_GET;
|
||||
while($current = $qs->fetchArray(SQLITE3_ASSOC)){
|
||||
|
||||
// Execute prepared statement
|
||||
|
@ -168,13 +164,8 @@ if(isset($_GET["p"])){
|
|||
echo($q_user["name"]);
|
||||
}
|
||||
else{
|
||||
echo("<a href='/user");
|
||||
|
||||
if($fancy_urls)
|
||||
echo ("/");
|
||||
else
|
||||
echo(".php?q=");
|
||||
echo($q_user["name"] . "'>" . $q_user["name"] ."</a>");
|
||||
$new_get["q"] = $q_user["name"];
|
||||
echo("<a href='" . redirect("user", $new_get) . "'>" . $q_user["name"] ."</a>");
|
||||
}
|
||||
echo("</p>\n");
|
||||
|
||||
|
@ -200,8 +191,8 @@ if(isset($_GET["p"])){
|
|||
// Time
|
||||
$time->settimestamp($current["q_date"]);
|
||||
echo("\t\t\t\t\t");
|
||||
$_GET["p"] = $current["id"];
|
||||
echo('<a href="' . redirect("user", $_GET) . '">');
|
||||
$tmp_get["p"] = $current["id"];
|
||||
echo('<a href="' . redirect("user", $tmp_get) . '">');
|
||||
echo("<p class='question-date'>" . $time->format("Y-m-d h:i:s") . "</p>");
|
||||
echo("</a>\n");
|
||||
|
||||
|
@ -250,12 +241,9 @@ if(isset($_GET["p"])){
|
|||
$ps_item = "";
|
||||
|
||||
if($link){
|
||||
$link_init = "<a href='/user";
|
||||
if($fancy_urls)
|
||||
$link_init .= "/" . $_GET["q"] . "?";
|
||||
else
|
||||
$link_init .= ".php?q=" . $_GET["q"] . "&";
|
||||
$link_init = $link_init . "page=" . $link . "'>";
|
||||
$tmp_get = $_GET;
|
||||
$tmp_get["page"] = $link;
|
||||
$link_init = "<a href='" . redirect("user", $tmp_get) . "'>";
|
||||
|
||||
$label = $link_init . $label . "</a>";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue