diff --git a/install.php b/install.php index fb171397..052f7db4 100644 --- a/install.php +++ b/install.php @@ -1,353 +1,244 @@ -Error:"; - echo "
inc/instance-config.php already exists. Please delete it before trying to re-install.
"; - die(); -} - -$default_values = array( - // Database stuff - array( - 'output' => "Please change the following to reflect the setup of your database.
" - ), - array( - 'name' => 'DB_TYPE', - 'html' => 'dropdown', - 'values' => array( - 'mysql' => 'MySQL', - 'dblib' => 'FreeTDS / Microsoft SQL Server / Sybase', - 'pgsql' => 'PostgreSQL', - 'sqlite' => 'SQLite' - ), - 'comment' => 'Database engine:' - ), - array( - 'name' => 'DB_SERVER', - 'html' => 'text', - 'values' => 'localhost', - 'comment' => 'Database hostname:' - ), - array( - 'name' => 'DB_USER', - 'html' => 'text', - 'values' => 'root', - 'comment' => 'Database username:' - ), - array( - 'name' => 'DB_PASSWORD', - 'html' => 'password', - 'values' => '', - 'comment' => 'Database password:' - ), - array( - 'name' => 'DB_DATABASE', - 'html' => 'text', - 'values' => 'tinyboard', - 'comment' => 'Database name (please create this database beforehand):' - ), + $config['root'], + 'title' => 'Install', + 'body' => '' + ); + + if($step == 0) { + // Agreeement + $page['body'] = ' + ++ I have read and understood the agreement. Proceed to installation. +
'; - // General Config - array( - 'output' => "General board configuration.
" - ), - array( - 'name' => 'LURKTIME', - 'html' => 'text', - 'values' => '30', - 'comment' => 'How many seconds before you can post, after the first visit:' - ), - array( - 'name' => 'MAX_BODY', - 'html' => 'text', - 'values' => '1800', - 'comment' => 'Max body length:' - ), - array( - 'name' => 'THREADS_PER_PAGE', - 'html' => 'text', - 'values' => '10', - 'comment' => 'Threads per page:' - ), - array( - 'name' => 'MAX_PAGES', - 'html' => 'text', - 'values' => '5', - 'comment' => 'Max pages:' - ), - array( - 'name' => 'THREADS_PREVIEW', - 'html' => 'text', - 'values' => '5', - 'comment' => 'Threads Preview:' - ), - array( - 'name' => 'VERBOSE_ERRORS', - 'html' => 'bool', - 'values' => true, - 'comment' => 'Turns \'display_errors\' on. Not recommended for production.:' - ), + echo Element('page.html', $page); + } elseif($step == 1) { + $page['title'] = 'Pre-installation test'; - // Image Config - array( - 'output' => "Image configuration.
" - ), - array( - 'name' => 'THUMB_WIDTH', - 'html' => 'text', - 'values' => '200', - 'comment' => 'Maximum thumbnail width:' - ), - array( - 'name' => 'THUMB_HEIGHT', - 'html' => 'text', - 'values' => '200', - 'comment' => 'Maximum thumbnail height:' - ), - array( - 'name' => 'MAX_FILESIZE', - 'html' => 'text', - 'values' => '10485760', - 'comment' => 'Maximum file size (in bytes; default: 10MB):' - ), - array( - 'name' => 'MAX_WIDTH', - 'html' => 'text', - 'values' => '10000', - 'comment' => 'Maximum image width:' - ), - array( - 'name' => 'MAX_HEIGHT', - 'html' => 'text', - 'values' => '10000', - 'comment' => 'Maximum image height:' - ), - array( - 'name' => 'ALLOW_ZIP', - 'html' => 'bool', - 'values' => false, - 'comment' => 'When you upload a ZIP as a file, all the images inside the archive '. - 'get dumped into the thread as replies. (Extremely beta and not recommended yet.)' - ), - array( - 'name' => 'REDRAW_IMAGE', - 'html' => 'bool', - 'values' => false, - 'comment' => 'Redraw the image using GD functions to strip any excess data (WARNING: VERY BETA).' - ), - array( - 'name' => 'SHOW_RATIO', - 'html' => 'bool', - 'values' => true, - 'comment' => 'Display the aspect ratio in a post\'s file info.' - ), + $page['body'] = '' . $item . ' | ' . $item . ' | '; } - if (isset($_POST[$value['name']])) { - $x = $_POST[$value['name']]; - } else { - if (is_array($value['values'])) { - $x = $value['values'][0]; - } else { - $x = $value['values']; - } + + + // Required extensions + rheader('PHP extensions'); + row('PDO', extension_loaded('pdo')); + row('GD', extension_loaded('gd')); + + // GD tests + rheader('GD tests'); + row('JPEG', function_exists('imagecreatefromjpeg')); + row('PNG', function_exists('imagecreatefrompng')); + row('GIF', function_exists('imagecreatefromgif')); + row('BMP', function_exists('imagecreatefrombmp')); + + // Database drivers + $drivers = PDO::getAvailableDrivers(); + + rheader('PDO drivers (currently installed drivers)'); + foreach($drivers as &$driver) { + row($driver, true); } - if ($value['html'] != 'bool') { - $x = "'$x'"; + + // Permissions + rheader('File permissions'); + row('root directory (' . getcwd() . ')', is_writable('.')); + + $page['body'] .= ' |
---|
+ Continue. +
'; + + echo Element('page.html', $page); + } elseif($step == 2) { + // Basic config + $page['title'] = 'Configuration'; + + function create_salt() { + return substr(base64_encode(sha1(rand())), 0, rand(25, 31)); } - $config_file .= "define('".$value['name']."',$x,true);\n"; - } - file_put_contents('inc/instance-config.php',$config_file); - - require 'inc/functions.php'; - require 'inc/display.php'; - require 'inc/instance-config.php'; - //require 'inc/config.php'; - require 'inc/template.php'; - require 'inc/database.php'; - - sql_open(); - foreach ($sql as $query) { - query($query); - } - - echo "