Requirements check

Oh snap! Looks like your current web server configuration does not allow to run TS-website 2.0. Please fix the above problems and try again.
If you have any problems, please check wiki and follow the installation guide.
Success! Looks like you can run TS-website 2.0!
7 ok { $result = PHP_VERSION_ID < 50600 ? 2 : (PHP_VERSION_ID < 70000 ? 1 : 0); showCheckResult( "PHP 5.6.0+ (7.0+ recommended)", $result, "Current PHP version: " . phpversion() ); } // Check if we are using polyfill for utf8_encode { $result = defined("__USING_U8ENC_POLYFILL"); showCheckResult( "Function utf8_encode exists", $result ? 1 : 0, $result ? "Function not found, using polyfill" : "Function exists" ); } // password_hash and password_verify { $result = PHP_VERSION_ID >= 50500 && password_verify( "ayy-lmao-m88", password_hash("ayy-lmao-m88", PASSWORD_DEFAULT) ); showCheckResult( "password_hash & password_verify", $result ? 0 : 2, $result ? "Functions exists and work" : "Please make sure your PHP version supports BCRYPT and BLOWFISH" ); } displayCategory("Extension checks"); // Extensions check { foreach (["mbstring", "json", "pdo_mysql", "tokenizer", "curl"] as $extension) { $result = extension_loaded($extension); showCheckResult( "$extension extension", $result ? 0 : 2, $result ? "Extension installed and loaded" : 'Please install or enable ' . $extension . ' extension' ); } } displayCategory("File / directory permission checks"); // file / directory writable checks { // path => true if file, false if directory $paths = array( __CONFIG_FILE => true, __INSTALLER_LOCK_FILE => true, __CACHE_DIR => false, __CACHE_DIR . "/templates" => false, __CACHE_DIR . "/servericons" => false, ); foreach ($paths as $path => $isFile) { $exists = file_exists($path); // If file / directory doesnt exists try to create it and update the variable if(!$exists) $exists = $isFile ? @touch($path) : @mkdir($path); $writable = is_writable($path); $basename = basename($path); // we are using a custom method instead of realpath, // because it does not work with non-existing files $realpath = resolveFilename($path); $msg = "Yes"; if(!$writable) $msg = "Please make $realpath writable"; if(!$exists) $msg = ($isFile ? "File" : "Directory") . " $realpath does not exists, please create it"; $success = $exists && $writable; if (!$success && !defined("FILE_PERM_ERROR")) { define("FILE_PERM_ERROR", true); } showCheckResult("Is $basename writable?", $success ? 0 : 2, $msg); } } displayCategory("Miscellaneous"); // cache test { $result = false; try { require_once __PRIVATE_DIR . "/vendor/autoload.php"; $cache = new Wruczek\PhpFileCache\PhpFileCache(); $teststring = "cachetest123"; $cache->store("installertest", $teststring, 3); $result = $cache->retrieve("installertest") === $teststring; $cache->clearCache(); } catch (Exception $e) {} showCheckResult( "Cache save and read test", $result ? 0 : 2, $result ? "Save and read success" : "Something went wrong! Please make sure that private/cache directory is writable" ); } // template test { if($result) { if(extension_loaded("mbstring")) { $result = false; try { $latte = new Latte\Engine(); $latte->setTempDirectory(__CACHE_DIR); $latte->setLoader(new Latte\Loaders\StringLoader()); $render = @$latte->renderToString('Hello, {$test|upper}!', array("test" => "Wruczek")); $result = $render === "Hello, WRUCZEK!"; } catch (Exception $e) {} showCheckResult( "Template render and cache test", $result ? 0 : 2, $result ? "Render and cache success" : "Something went wrong! Please make sure that private/cache directory is writable" ); } else { showCheckResult("Template render and cache test", 2, "mbstring extension not found, cannot start the test"); } } else { showCheckResult("Template render and cache test", 2, "private/cache directory is not writable, cannot start the test"); } } } // Utils function showCheckResult($name, $state, $resulttext) { if($state === 0) { $attr = "fa-check-circle color-success"; } else if($state === 1) { $attr = "fa-minus-circle color-warning"; } else { $attr = "fa-times-circle color-danger"; if(!defined("CANNOT_INSTALL")) { define("CANNOT_INSTALL", true); } } ?> ' . $name . ''; } // https://tomnomnom.com/posts/realish-paths-without-realpath function resolveFilename($filename) { $filename = str_replace('//', '/', $filename); $parts = explode('/', $filename); $out = array(); foreach ($parts as $part){ if ($part === '.') continue; if ($part === '..') { array_pop($out); continue; } $out[] = $part; } return implode('/', $out); }