This commit is contained in:
Shish 2020-02-06 03:10:30 +00:00
parent 2b994d5c29
commit cdaecb3380
4 changed files with 25 additions and 20 deletions

View file

@ -15,7 +15,8 @@
* and other such things that aren't ready yet
*/
function install() {
function install()
{
date_default_timezone_set('UTC');
define("DATABASE_TIMEOUT", 10000);
@ -49,15 +50,15 @@ function install() {
require_once "core/util.php";
$dsn = get_dsn();
if($dsn) {
if ($dsn) {
do_install($dsn);
} else {
ask_questions();
}
}
function get_dsn() {
function get_dsn()
{
if (file_exists("data/config/auto_install.conf.php")) {
$dsn = null;
require_once "data/config/auto_install.conf.php";
@ -72,7 +73,8 @@ function get_dsn() {
return $dsn;
}
function do_install($dsn) {
function do_install($dsn)
{
try {
create_dirs();
create_tables(new Database($dsn));
@ -80,7 +82,6 @@ function do_install($dsn) {
} catch (InstallerException $e) {
exit_with_page($e->title, $e->body, $e->code);
}
}
function ask_questions()
@ -129,7 +130,7 @@ function ask_questions()
exit_with_page(
"Install Options",
<<<EOD
<<<EOD
$warn_msg
$err_msg
@ -194,7 +195,8 @@ function ask_questions()
Drivers can generally be downloaded with your OS package manager;
for Debian / Ubuntu you want php-pgsql, php-mysql, or php-sqlite.
</p>
EOD);
EOD
);
}
@ -337,7 +339,8 @@ function write_config($dsn)
}
}
function exit_with_page($title, $body, $code=0) {
function exit_with_page($title, $body, $code=0)
{
print("<!DOCTYPE html>
<html>
<head>

View file

@ -471,7 +471,7 @@ function get_debug_info(): string
function require_all(array $files): void
{
foreach ($files as $filename) {
require_once $filename;
require_once $filename;
}
}

View file

@ -45,10 +45,12 @@ class Index extends Extension
try {
$fast_page_limit = 500;
if(
SPEED_HAX
&& strstr($_SERVER["HTTP_USER_AGENT"], "Googlebot") !== false
&& count($search_terms) > 1
if (
SPEED_HAX && strstr($_SERVER["HTTP_USER_AGENT"], "Googlebot") !== false
&& (
$count_search_terms > 1
|| ($count_search_terms == 1 && $search_terms[0][0] == "-")
)
) {
// googlebot loves searching for weird combinations of tags...
$fast_page_limit = 50;

View file

@ -139,12 +139,12 @@ $_tracer->end();
//$_tracer->mark(@$_SERVER["REQUEST_URI"]);
$_tracer->begin(
$_SERVER["REQUEST_URI"] ?? "No Request",
[
"user"=>$_COOKIE["shm_user"] ?? "No User",
"ip"=>$_SERVER['REMOTE_ADDR'] ?? "No IP",
"user_agent"=>$_SERVER['HTTP_USER_AGENT'] ?? "No UA",
]
$_SERVER["REQUEST_URI"] ?? "No Request",
[
"user"=>$_COOKIE["shm_user"] ?? "No User",
"ip"=>$_SERVER['REMOTE_ADDR'] ?? "No IP",
"user_agent"=>$_SERVER['HTTP_USER_AGENT'] ?? "No UA",
]
);
if (!SPEED_HAX) {