From cefe1c0325792f7215a1701dd994f1cdbc4693f6 Mon Sep 17 00:00:00 2001 From: Shish Date: Wed, 7 Nov 2018 00:08:26 +0000 Subject: [PATCH] a bunch of installer tweaks --- .travis.yml | 2 +- install.php => core/_install.php | 62 ++++++-------------------------- core/util.php | 2 +- index.php | 22 +++++------- lib/shimmie.css | 52 ++++++++++++++++++++++++--- 5 files changed, 68 insertions(+), 72 deletions(-) rename install.php => core/_install.php (60%) diff --git a/.travis.yml b/.travis.yml index 5d4b46c0..880a0b28 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,7 +38,7 @@ install: fi - if [[ "$DB" == "sqlite" ]]; then echo ' data/config/auto_install.conf.php ; fi - composer install - - php install.php + - php index.php script: - vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover=data/coverage.clover diff --git a/install.php b/core/_install.php similarity index 60% rename from install.php rename to core/_install.php index b2e7508d..d84fbbc4 100644 --- a/install.php +++ b/core/_install.php @@ -25,41 +25,8 @@ date_default_timezone_set('UTC'); Shimmie Installation - - + + @@ -92,19 +59,11 @@ date_default_timezone_set('UTC'); assert_options(ASSERT_ACTIVE, 1); assert_options(ASSERT_BAIL, 1); -/* - * Compute the path to the folder containing "install.php" and - * store it as the 'Shimmie Root' folder for later on. - * - * Example: - * __SHIMMIE_ROOT__ = '/var/www/shimmie2/' - * - */ -define('__SHIMMIE_ROOT__', trim(rtrim(dirname(__FILE__), '/\\')) . '/'); - // Pull in necessary files -require_once __SHIMMIE_ROOT__."core/exceptions.class.php"; -require_once __SHIMMIE_ROOT__."core/database.class.php"; +require_once "core/exceptions.php"; +require_once "core/cacheengine.php"; +require_once "core/dbengine.php"; +require_once "core/database.php"; if(is_readable("data/config/shimmie.conf.php")) die("Shimmie is already installed."); @@ -160,6 +119,7 @@ function do_install() { // {{{ return; } + define("DEBUG_SQL", false); define("DATABASE_KA", true); install_process(); } // }}} @@ -206,8 +166,8 @@ function ask_questions() { // {{{ $db_p = in_array("pgsql", $drivers) ? '' : ""; $db_s = in_array("sqlite", $drivers) ? '' : ""; - $warn_msg = $warnings ? "

Warnings

".implode("\n
", $warnings) : ""; - $err_msg = $errors ? "

Errors

".implode("\n
", $errors) : ""; + $warn_msg = $warnings ? "

Warnings

".implode("\n

", $warnings) : ""; + $err_msg = $errors ? "

Errors

".implode("\n

", $errors) : ""; print << @@ -218,7 +178,7 @@ function ask_questions() { // {{{ $err_msg

Database Install

-
+
@@ -272,7 +232,7 @@ function ask_questions() { // {{{

Drivers can generally be downloaded with your OS package manager; - for Debian / Ubuntu you want php5-pgsql, php5-mysql, or php5-sqlite. + for Debian / Ubuntu you want php-pgsql, php-mysql, or php-sqlite.

diff --git a/core/util.php b/core/util.php index d838e5ae..d611aa88 100644 --- a/core/util.php +++ b/core/util.php @@ -513,7 +513,7 @@ function _get_user(): User { * @return string|null */ function _get_query() { - return @$_POST["q"]?:@$_GET["q"]; + return (@$_POST["q"]?:@$_GET["q"])?:"/"; } diff --git a/index.php b/index.php index 32d37921..b944e3eb 100644 --- a/index.php +++ b/index.php @@ -44,28 +44,19 @@ */ if(!file_exists("data/config/shimmie.conf.php")) { - header("Location: install.php"); + require_once "core/_install.php"; exit; } if(!file_exists("vendor/")) { //CHECK: Should we just point to install.php instead? Seems unsafe though. print << Shimmie Error - - + +
@@ -73,9 +64,12 @@ if(!file_exists("vendor/")) {

Warning: Composer vendor folder does not exist!

Shimmie is unable to find the composer vendor directory.
- Have you followed the composer setup instructions found in the README? + Have you followed the composer setup instructions found in the + README? -

If you are not intending to do any development with Shimmie, it is highly recommend you use one of the pre-packaged releases found on Github instead.

+

If you are not intending to do any development with Shimmie, + it is highly recommend you use one of the pre-packaged releases + found on Github instead.

diff --git a/lib/shimmie.css b/lib/shimmie.css index 813f87ca..e4709711 100644 --- a/lib/shimmie.css +++ b/lib/shimmie.css @@ -1,11 +1,12 @@ ARTICLE SELECT {width: 150px;} INPUT, TEXTAREA {box-sizing: border-box;} -TD>INPUT[type="button"] {width: 100%;} -TD>INPUT[type="submit"] {width: 100%;} -TD>INPUT[type="text"] {width: 100%;} -TD>INPUT[type="password"] {width: 100%;} -TD>SELECT {width: 100%;} +TD>INPUT[type="button"], +TD>INPUT[type="submit"], +TD>INPUT[type="text"], +TD>INPUT[type="password"], +TD>INPUT[type="email"], +TD>SELECT, TD>TEXTAREA {width: 100%;} TABLE.form {width: 300px;} @@ -30,3 +31,44 @@ IMG.lazy {display: none;} margin: 8px; border: 1px solid #882; } + +#installer { + background: #EEE; + font-family: "Arial", sans-serif; + font-size: 14px; + width: 512px; + margin: auto; + margin-top: 16px; + border: 1px solid black; + border-radius: 16px; +} +#installer P { + padding: 5px; +} +#installer A { + text-decoration: none; +} +#installer A:hover { + text-decoration: underline; +} +#installer H1, #installer H3 { + background: #DDD; + text-align: center; + margin: 0px; + padding: 2px; +} +#installer H1 { + border-bottom: 1px solid black; + border-radius: 16px 16px 0px 0px; +} +#installer H3 { + border-bottom: 1px solid black; +} +#installer TH { + text-align: right; +} +#installer INPUT, +#installer SELECT { + width: 100%; + box-sizing: border-box; +}