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"]);
|
echo($h_user["name"]);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
echo("<a href='/user");
|
$new_get["q"] = $h_user["name"];
|
||||||
|
echo("<a href='" . redirect("user", $new_get) . "'>" . $h_user["name"] ."</a>\n");
|
||||||
if($fancy_urls)
|
|
||||||
echo ("/");
|
|
||||||
else
|
|
||||||
echo(".php?q=");
|
|
||||||
echo($h_user["name"] . "'>" . $h_user["name"] ."</a>\n");
|
|
||||||
}
|
}
|
||||||
echo(" asked:</p>");
|
echo(" asked:</p>");
|
||||||
|
|
||||||
|
@ -152,6 +147,7 @@ if(isset($_GET["p"])){
|
||||||
|
|
||||||
|
|
||||||
$time = new DateTime("@0");
|
$time = new DateTime("@0");
|
||||||
|
$tmp_get = $_GET;
|
||||||
while($current = $qs->fetchArray(SQLITE3_ASSOC)){
|
while($current = $qs->fetchArray(SQLITE3_ASSOC)){
|
||||||
|
|
||||||
// Execute prepared statement
|
// Execute prepared statement
|
||||||
|
@ -168,13 +164,8 @@ if(isset($_GET["p"])){
|
||||||
echo($q_user["name"]);
|
echo($q_user["name"]);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
echo("<a href='/user");
|
$new_get["q"] = $q_user["name"];
|
||||||
|
echo("<a href='" . redirect("user", $new_get) . "'>" . $q_user["name"] ."</a>");
|
||||||
if($fancy_urls)
|
|
||||||
echo ("/");
|
|
||||||
else
|
|
||||||
echo(".php?q=");
|
|
||||||
echo($q_user["name"] . "'>" . $q_user["name"] ."</a>");
|
|
||||||
}
|
}
|
||||||
echo("</p>\n");
|
echo("</p>\n");
|
||||||
|
|
||||||
|
@ -200,8 +191,8 @@ if(isset($_GET["p"])){
|
||||||
// Time
|
// Time
|
||||||
$time->settimestamp($current["q_date"]);
|
$time->settimestamp($current["q_date"]);
|
||||||
echo("\t\t\t\t\t");
|
echo("\t\t\t\t\t");
|
||||||
$_GET["p"] = $current["id"];
|
$tmp_get["p"] = $current["id"];
|
||||||
echo('<a href="' . redirect("user", $_GET) . '">');
|
echo('<a href="' . redirect("user", $tmp_get) . '">');
|
||||||
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>\n");
|
echo("</a>\n");
|
||||||
|
|
||||||
|
@ -250,12 +241,9 @@ if(isset($_GET["p"])){
|
||||||
$ps_item = "";
|
$ps_item = "";
|
||||||
|
|
||||||
if($link){
|
if($link){
|
||||||
$link_init = "<a href='/user";
|
$tmp_get = $_GET;
|
||||||
if($fancy_urls)
|
$tmp_get["page"] = $link;
|
||||||
$link_init .= "/" . $_GET["q"] . "?";
|
$link_init = "<a href='" . redirect("user", $tmp_get) . "'>";
|
||||||
else
|
|
||||||
$link_init .= ".php?q=" . $_GET["q"] . "&";
|
|
||||||
$link_init = $link_init . "page=" . $link . "'>";
|
|
||||||
|
|
||||||
$label = $link_init . $label . "</a>";
|
$label = $link_init . $label . "</a>";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue