From ccabdeef2da1fc2bd70bfeeaf7d8659f6e5f2b9d Mon Sep 17 00:00:00 2001 From: Tomasz Date: Tue, 18 Jan 2022 23:13:52 +0100 Subject: [PATCH 1/2] Redirect to install page when configuration doesn't exist. --- system/core/Common.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/system/core/Common.php b/system/core/Common.php index d6a1fdb4..0df24f80 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -256,8 +256,9 @@ if ( ! function_exists('get_config')) } elseif ( ! $found) { - set_status_header(503); - echo 'The configuration file does not exist.'; + // set_status_header(301); + header('Location: install/'); + // echo 'The configuration file does not exist.'; exit(3); // EXIT_CONFIG } From c1f02c09c6a77b12e8addfd34eef0a701fa650a7 Mon Sep 17 00:00:00 2001 From: Tomasz Date: Thu, 20 Jan 2022 00:10:55 +0100 Subject: [PATCH 2/2] Remove install dir after install and update DXCC, all automatically. --- install/index.php | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/install/index.php b/install/index.php index e88b9a4d..55d2ecdf 100644 --- a/install/index.php +++ b/install/index.php @@ -5,8 +5,20 @@ $db_config_path = '../application/config/'; $db_file_path = $db_config_path."database.php"; +function delDir($dir) { + $files = glob( $dir . '*', GLOB_MARK ); + foreach( $files as $file ){ + if( substr( $file, -1 ) == '/' ) + delDir( $file ); + else + unlink( $file ); + } + rmdir( $dir ); +} + if (file_exists($db_file_path)) { - echo "Cloudlog is already installed, please delete the /install folder."; + delDir(getcwd()); + header("../"); exit; } @@ -40,11 +52,23 @@ if($_POST) { // If no errors, redirect to registration page if(!isset($message)) { + sleep(1); + $ch = curl_init(); + $protocol=((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https" : "http"; + list($realHost,)=explode(':',$_SERVER['HTTP_HOST']); + $cloudlog_url=$protocol."://".$realHost.":".$_SERVER['SERVER_PORT']; + curl_setopt($ch, CURLOPT_URL,$cloudlog_url); + curl_setopt($ch, CURLOPT_VERBOSE, 0); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + $result = curl_exec($ch); + curl_setopt($ch, CURLOPT_URL,$cloudlog_url."/index.php/update/dxcc"); + $result = curl_exec($ch); + delDir(getcwd()); + header('Location: '.$protocol."://".$_SERVER['HTTP_HOST'].$_POST['directory']); echo "

Install successful

"; echo "

Please delete the install folder"; exit; } - } else { $message = $core->show_message('error','Not all fields have been filled in correctly. The host, username, password, and database name are required.'); @@ -139,4 +163,3 @@ if($_POST) { -