<commit_before><?php

/**
 * Morfy :: Installator
 */

// Get array with the names of all modules compiled and loaded
$php_modules = get_loaded_extensions();

// Get server port
if ($_SERVER["SERVER_PORT"] == "80") $port = ""; else $port = ':'.$_SERVER["SERVER_PORT"];

// Get site URL
$site_url = 'http://'.$_SERVER["SERVER_NAME"].$port.str_replace(array("index.php", "install.php"), "", $_SERVER['PHP_SELF']);

// Replace last slash in site_url
$site_url = rtrim($site_url, '/');

// Rewrite base
$rewrite_base = str_replace(array("index.php", "install.php"), "", $_SERVER['PHP_SELF']);

// Errors array
$errors = array();

// Directories to check
$dir_array = array('content', 'themes');

if (version_compare(PHP_VERSION, "5.3.0", "<")) {
    $errors['php'] = 'error';
}

if (function_exists('apache_get_modules')) {
    if ( ! in_array('mod_rewrite', apache_get_modules())) {
        $errors['mod_rewrite'] = 'error';
    }
}

if (!is_writable(__FILE__)) {
    $errors['install'] = 'error';
}


if (!is_writable('.htaccess')) {
    $errors['htaccess'] = 'error';
}

// Dirs 'public', 'storage', 'backups', 'tmp'
foreach ($dir_array as $dir) {
    if (!is_writable($dir.'/')) {
        $errors[$dir] = 'error';
    }
}

// If pressed <Install> button then try to install
if (isset($_POST['install_submit'])) {

        $post_site_url = isset($_POST['site_url']) ? $_POST['site_url'] : '';
        $post_site_timezone = isset($_POST['site_timezone']) ? $_POST['site_timezone'] : '';
        $post_site_title = isset($_POST['site_title']) ? $_POST['site_title'] : '';
        $post_site_description = isset($_POST['site_description']) ? $_POST['site_description'] : '';
        $post_site_keywords = isset($_POST['site_keywords']) ? $_POST['site_keywords'] : '';
        $post_email = isset($_POST['email']) ? $_POST['email'] : '';

        file_put_contents('config/Morfy.php', "<?php
    return array(
        'site_url' => '{$post_site_url}',
        'site_charset' => 'UTF-8',
        'site_timezone' => '{$post_site_timezone}',
        'site_theme' => 'default',
        'site_title' => '{$post_site_title}',
        'site_description' => '{$post_site_description}',
        'site_keywords' => '{$post_site_keywords}',
        'email' => '{$post_email}',
        'plugins' => array(
            'parsedown',
            'sitemap',
        ),
        /**
         * https://github.com/fenom-template/fenom/blob/master/docs/ru/configuration.md
         */
        'fenom' =>  array(
            // 'disable_methods' => false,
            // 'disable_native_funcs' => false,
            'auto_reload' => true,
            // 'force_compile' => false,
            // 'disable_cache' => false,
            'force_include' => true,
            // 'auto_escape' => false,
            // 'force_verify' => false,
            // 'disable_php_calls' => false,
            // 'disable_statics' => false,
            'strip' => true,
        )
    );
        ");

        // Write .htaccess
        $htaccess = file_get_contents('.htaccess');
        $save_htaccess_content = str_replace("/%siteurlhere%/", $rewrite_base, $htaccess);

        $handle = fopen ('.htaccess', "w");
        fwrite($handle, $save_htaccess_content);
        fclose($handle);

        // Installation done :)
        header("location: index.php?install=done");

}
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Morfy Installer</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Bootstrap -->
    <link href="<?php echo $site_url; ?>/themes/default/assets/css/bootstrap.min.css" rel="stylesheet">
    <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,700,900,400italic' type='text/css' rel='stylesheet' />
    <link href='http://fonts.googleapis.com/css?family=Audiowide' rel='stylesheet' type='text/css'>
    <script src="<?php echo $site_url; ?>/themes/default/assets/js/jquery.min.js"></script>
    <script src="<?php echo $site_url; ?>/themes/default/assets/js/bootstrap.min.js"></script>
    <style>
        .container {
            max-width: 600px;
            margin-bottom: 40px;
        }
        body {
            font-family: "Source Sans Pro","Helvetica","Arial",sans-serif;
            font-size: 16px;
            line-height: 26px;
            color: #333;
        }
        h1 {
            font-size: 126px;
            font-family: 'Audiowide', cursive;
            color: #333;
        }
        .ok {
            color: #3c763d;
            background-color: #dff0d8;
        }
        .error {
            color: #a94442;
            background-color: #f2dede;
            border-color: #ebccd1;
        }
        .step-1 ul li {
            margin-bottom: 10px;
            padding: 5px 10px;
            border-radius: 0;
        }<commit_msg>General Engine Improvements #20<commit_after><?php

/**
 * Morfy :: Installator
 */

// Get array with the names of all modules compiled and loaded
$php_modules = get_loaded_extensions();

// Get server port
if ($_SERVER["SERVER_PORT"] == "80") $port = ""; else $port = ':'.$_SERVER["SERVER_PORT"];

// Get site URL
$site_url = 'http://'.$_SERVER["SERVER_NAME"].$port.str_replace(array("index.php", "install.php"), "", $_SERVER['PHP_SELF']);

// Replace last slash in site_url
$site_url = rtrim($site_url, '/');

// Rewrite base
$rewrite_base = str_replace(array("index.php", "install.php"), "", $_SERVER['PHP_SELF']);

// Errors array
$errors = array();

// Directories to check
$dir_array = array('content', 'themes');

if (version_compare(PHP_VERSION, "5.3.0", "<")) {
    $errors['php'] = 'error';
}

if (function_exists('apache_get_modules')) {
    if ( ! in_array('mod_rewrite', apache_get_modules())) {
        $errors['mod_rewrite'] = 'error';
    }
}

if (!is_writable(__FILE__)) {
    $errors['install'] = 'error';
}


if (!is_writable('.htaccess')) {
    $errors['htaccess'] = 'error';
}

// Dirs 'public', 'storage', 'backups', 'tmp'
foreach ($dir_array as $dir) {
    if (!is_writable($dir.'/')) {
        $errors[$dir] = 'error';
    }
}

// If pressed <Install> button then try to install
if (isset($_POST['install_submit'])) {

        $post_site_url = isset($_POST['site_url']) ? $_POST['site_url'] : '';
        $post_site_timezone = isset($_POST['site_timezone']) ? $_POST['site_timezone'] : '';
        $post_site_title = isset($_POST['site_title']) ? $_POST['site_title'] : '';
        $post_site_description = isset($_POST['site_description']) ? $_POST['site_description'] : '';
        $post_site_keywords = isset($_POST['site_keywords']) ? $_POST['site_keywords'] : '';
        $post_email = isset($_POST['email']) ? $_POST['email'] : '';

        file_put_contents('config/Morfy.php', "<?php
    return array(
        'site_url' => '{$post_site_url}',
        'site_charset' => 'UTF-8',
        'site_timezone' => '{$post_site_timezone}',
        'site_theme' => 'default',
        'site_title' => '{$post_site_title}',
        'site_description' => '{$post_site_description}',
        'site_keywords' => '{$post_site_keywords}',
        'email' => '{$post_email}',
        'plugins' => array(
            'parsedown',
            'sitemap',
        ),
        /**
         * https://github.com/fenom-template/fenom/blob/master/docs/ru/configuration.md
         */
        'fenom' =>  array(
            // 'disable_methods' => false,
            // 'disable_native_funcs' => false,
            'auto_reload' => true,
            // 'force_compile' => false,
            // 'disable_cache' => false,
            'force_include' => true,
            // 'auto_escape' => false,
            // 'force_verify' => false,
            // 'disable_php_calls' => false,
            // 'disable_statics' => false,
            'strip' => true,
        )
    );
        ");

        // Write .htaccess
        $htaccess = file_get_contents('.htaccess');
        $save_htaccess_content = str_replace("/%siteurlhere%/", $rewrite_base, $htaccess);

        $handle = fopen ('.htaccess', "w");
        fwrite($handle, $save_htaccess_content);
        fclose($handle);

        // Installation done :)
        header("location: index.php?install=done");

}
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Morfy Installer</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Bootstrap -->
    <link href="<?php echo $site_url; ?>/themes/default/assets/css/bootstrap.min.css" rel="stylesheet">
    <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,700,900,400italic' type='text/css' rel='stylesheet' />
    <script src="<?php echo $site_url; ?>/themes/default/assets/js/jquery.min.js"></script>
    <script src="<?php echo $site_url; ?>/themes/default/assets/js/bootstrap.min.js"></script>
    <style>
        body {
            font-family: "Source Sans Pro","Helvetica","Arial",sans-serif;
            font-size: 16px;
            line-height: 26px;
            color: #333;
        }

        .container {
            max-width: 600px;
            margin-bottom: 40px;
        }

        .ok {
            color: #3c763d;
            background-color: #dff0d8;
        }

        .error {
            color: #a94442;
            background-color: #f2dede;
            border-color: #ebccd1;
        }

        .step-1 ul li {
            margin-bottom: 10px;
            padding: 5px 10px;
            border-radius: 0;
        }
{'fraction_non_alphanumeric': 0.18621127207359628, 'fraction_numerical': 0.012794755207782595, 'mean_word_length': 2.5529676934635614, 'pattern_counts': {'":': 0, '<': 48, '<?xml version=': 0, '>': 86, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3159284', 'n_tokens_mistral': 3172, 'n_tokens_neox': 3062, 'n_words': 529}