diff --git a/includes/filter_footer.php b/includes/filter_footer.php index 5925d688..8ce64f3a 100644 --- a/includes/filter_footer.php +++ b/includes/filter_footer.php @@ -18,9 +18,9 @@ if ($total_found_rows > 5) {
-
+
- @@ -29,10 +29,35 @@ if ($total_found_rows > 5) {
-
-

+ + $total_found_rows) { + $end = $total_found_rows; + } + + // Now output something like "Showing X to Y of Z records" + ?> + +
+

+ Showing to of records +

+ + +
-
+
    diff --git a/setup412.php b/setup412.php new file mode 100644 index 00000000..67643767 --- /dev/null +++ b/setup412.php @@ -0,0 +1,813 @@ +Database connection failed - please check and try again

    " . mysqli_connect_error()); + } + + $new_config = " 2097152) { + $file_error = 1; + } + + if ($file_error == 0) { + // directory in which the uploaded file will be moved + $upload_file_dir = "uploads/users/1/"; + $dest_path = $upload_file_dir . $new_file_name; + + move_uploaded_file($file_tmp_path, $dest_path); + + //Set Avatar + mysqli_query($mysqli,"UPDATE users SET user_avatar = '$new_file_name' WHERE user_id = 1"); + + $_SESSION['alert_message'] = 'File successfully uploaded.'; + } else { + + $_SESSION['alert_message'] = 'There was an error moving the file to upload directory. Please make sure the upload directory is writable by web server.'; + } + } + + $_SESSION['alert_message'] = "User $name created"; + + header("Location: setup.php?organization"); + exit; + +} + +if (isset($_POST['create_organization'])) { + + $name = sanitizeInput($_POST['name']); + + mysqli_query($mysqli,"INSERT INTO global_settings SET global_setting_organization_name = '$name'"); + + //final setup stages + $myfile = fopen("includes/config.php", "a"); + + $txt = "\$config_enable_setup = 0;\n\n"; + + fwrite($myfile, $txt); + + fclose($myfile); + + $_SESSION['alert_message'] = "Organization $name created"; + + header("Location: login.php"); + + exit; + +} + +?> + + + + + + + + + + ITFlow Setup + + + + + + + + + + + + + +
    + + + + + + + + + +
    + + +
    +
    + + +
    + + +
    + + + 'mysqli', + 'php-curl' => 'curl', + 'php-mbstring' => 'mbstring', + 'php-gd' => 'gd', + ]; + + foreach ($extensions as $name => $ext) { + $loaded = extension_loaded($ext); + $phpExtensions[] = [ + 'name' => "$name installed", + 'passed' => $loaded, + 'value' => $loaded ? 'Installed' : 'Not Installed', + ]; + } + + // Section: PHP Configuration + $phpConfig = []; + + // Check if shell_exec is enabled + $disabled_functions = explode(',', ini_get('disable_functions')); + $disabled_functions = array_map('trim', $disabled_functions); + $shell_exec_enabled = !in_array('shell_exec', $disabled_functions); + + $phpConfig[] = [ + 'name' => 'shell_exec is enabled', + 'passed' => $shell_exec_enabled, + 'value' => $shell_exec_enabled ? 'Enabled' : 'Disabled', + ]; + + // Check upload_max_filesize and post_max_size >= 500M + function return_bytes($val) { + $val = trim($val); + $unit = strtolower(substr($val, -1)); + $num = (float)$val; + switch ($unit) { + case 'g': + $num *= 1024; + case 'm': + $num *= 1024; + case 'k': + $num *= 1024; + } + return $num; + } + + $required_bytes = 500 * 1024 * 1024; // 500M in bytes + + $upload_max_filesize = ini_get('upload_max_filesize'); + $post_max_size = ini_get('post_max_size'); + + $upload_passed = return_bytes($upload_max_filesize) >= $required_bytes; + $post_passed = return_bytes($post_max_size) >= $required_bytes; + + $phpConfig[] = [ + 'name' => 'upload_max_filesize >= 500M', + 'passed' => $upload_passed, + 'value' => $upload_max_filesize, + ]; + + $phpConfig[] = [ + 'name' => 'post_max_size >= 500M', + 'passed' => $post_passed, + 'value' => $post_max_size, + ]; + + // Check PHP version >= 8.2.0 + $php_version = PHP_VERSION; + $php_passed = version_compare($php_version, '8.2.0', '>='); + + $phpConfig[] = [ + 'name' => 'PHP version >= 8.2.0', + 'passed' => $php_passed, + 'value' => $php_version, + ]; + + // Section: Shell Commands + $shellCommands = []; + + if ($shell_exec_enabled) { + $commands = ['git']; + + foreach ($commands as $command) { + $which = trim(shell_exec("which $command 2>/dev/null")); + $exists = !empty($which); + $shellCommands[] = [ + 'name' => "Command '$command' available", + 'passed' => $exists, + 'value' => $exists ? $which : 'Not Found', + ]; + } + } else { + // If shell_exec is disabled, mark commands as unavailable + foreach (['git'] as $command) { + $shellCommands[] = [ + 'name' => "Command '$command' available", + 'passed' => false, + 'value' => 'shell_exec Disabled', + ]; + } + } + + // Section: SSL Checks + $sslChecks = []; + + // Check if accessing via HTTPS + $https = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443; + $sslChecks[] = [ + 'name' => 'Accessing via HTTPS', + 'passed' => $https, + 'value' => $https ? 'Yes' : 'No', + ]; + + // SSL Certificate Validity Check + if ($https) { + $streamContext = stream_context_create(["ssl" => ["capture_peer_cert" => true]]); + $socket = @stream_socket_client("ssl://{$_SERVER['HTTP_HOST']}:443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $streamContext); + + if ($socket) { + $params = stream_context_get_params($socket); + $cert = $params['options']['ssl']['peer_certificate']; + $certInfo = openssl_x509_parse($cert); + + $validFrom = $certInfo['validFrom_time_t']; + $validTo = $certInfo['validTo_time_t']; + $currentTime = time(); + + $certValid = ($currentTime >= $validFrom && $currentTime <= $validTo); + + $sslChecks[] = [ + 'name' => 'SSL Certificate is valid', + 'passed' => $certValid, + 'value' => $certValid ? 'Valid' : 'Invalid or Expired', + ]; + } else { + $sslChecks[] = [ + 'name' => 'SSL Certificate is valid', + 'passed' => false, + 'value' => 'Unable to retrieve certificate', + ]; + } + } else { + $sslChecks[] = [ + 'name' => 'SSL Certificate is valid', + 'passed' => false, + 'value' => 'Not using HTTPS', + ]; + } + + // Section: Domain Checks + $domainChecks = []; + + // Check if the site has a valid FQDN + $fqdn = $_SERVER['HTTP_HOST']; + $isValidFqdn = (bool) filter_var('http://' . $fqdn, FILTER_VALIDATE_URL) && preg_match('/^[a-z0-9.-]+\.[a-z]{2,}$/i', $fqdn); + + $domainChecks[] = [ + 'name' => 'Site has a valid FQDN', + 'passed' => $isValidFqdn, + 'value' => $fqdn, + ]; + + // Section: File Permissions + $filePermissions = []; + + // Check if web user has write access to webroot directory + $webroot = $_SERVER['DOCUMENT_ROOT']; + $writable = is_writable($webroot); + $filePermissions[] = [ + 'name' => 'Web user has write access to webroot directory', + 'passed' => $writable, + 'value' => $webroot, + ]; + ?> + +
    +
    +

    Step 1 - Setup Checks

    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    PHP Extensions
    + + + + + +
    PHP Configuration
    + + + + + +
    Shell Commands
    + + + + + +
    SSL Checks
    + + + + + +
    Domain Checks
    + + + + + +
    File Permissions
    + + + + + +
    + +
    + + Next (Database) +
    +
    + + + +
    +
    +

    Step 2 - Connect your Database

    +
    +
    + + Database is already configured. Any further changes should be made by editing the config.php file, + or deleting it and refreshing this page. + +
    + +
    Database Connection Details
    + +
    + +
    +
    + +
    + +
    +
    + +
    + +
    +
    + +
    + +
    +
    + +
    +
    Database Authentication Details
    + +
    + +
    +
    + +
    + +
    +
    + +
    + +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    + + + +
    +
    +

    Step 3 - Create your first user

    +
    +
    + +
    +
    + +
    +
    + +
    + +
    +
    + +
    + +
    +
    + +
    + +
    +
    + +
    + +
    +
    + +
    + +
    + +
    +
    +
    + +
    + + +
    + +
    + + +
    +
    +
    + + + +
    +
    +

    Step 4 - Organization Details

    +
    +
    +
    + +
    + +
    +
    + +
    + +
    +
    + +
    + + +
    + +
    + + + +
    +
    +
    + + + +
    +
    +

    TaskFlow Setup

    +
    +
    +

    Thank you for choosing to try TaskFlow!

    +

    This is the start of your journey towards amazing task management

    +

    A database must be created before proceeding - click on the button below to get started.

    +
    +

    TaskFlow is free software: you can redistribute and/or modify it under the terms of the GNU General Public License.
    It is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.

    +
    + +
    +
    + + + +
    +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + +