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

View file

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

View file

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

View file

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