Example #1
0
function install($adminPassword, $email, $locale)
{
    $Language = new dbLanguage($locale);
    $stdOut = array();
    // ============================================================================
    // Create directories
    // ============================================================================
    // 7=read,write,execute | 5=read,execute
    $dirpermissions = 0755;
    $firstPostSlug = 'first-post';
    if (!mkdir(PATH_POSTS . $firstPostSlug, $dirpermissions, true)) {
        $errorText = 'Error when trying to created the directory=>' . PATH_POSTS . $firstPostSlug;
        error_log($errorText, 0);
    }
    if (!mkdir(PATH_PAGES . 'error', $dirpermissions, true)) {
        $errorText = 'Error when trying to created the directory=>' . PATH_PAGES . 'error';
        error_log($errorText, 0);
    }
    if (!mkdir(PATH_PLUGINS_DATABASES . 'pages', $dirpermissions, true)) {
        $errorText = 'Error when trying to created the directory=>' . PATH_PLUGINS_DATABASES;
        error_log($errorText, 0);
    }
    if (!mkdir(PATH_UPLOADS, $dirpermissions, true)) {
        $errorText = 'Error when trying to created the directory=>' . PATH_UPLOADS;
        error_log($errorText, 0);
    }
    // ============================================================================
    // Create files
    // ============================================================================
    $dataHead = "<?php defined('BLUDIT') or die('Bludit CMS.'); ?>" . PHP_EOL;
    // File pages.php
    $data = array('error' => array('description' => 'Error page', 'username' => 'admin', 'tags' => '', 'status' => 'published', 'unixTimeCreated' => 1430686755, 'unixTimeModified' => 0, 'position' => 0));
    file_put_contents(PATH_DATABASES . 'pages.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
    // File posts.php
    $data = array($firstPostSlug => array('description' => 'Welcome to Bludit', 'username' => 'admin', 'status' => 'published', 'tags' => 'welcome, bludit, cms', 'allowComments' => false, 'unixTimeCreated' => 1430875199, 'unixTimeModified' => 0));
    file_put_contents(PATH_DATABASES . 'posts.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
    // File site.php
    $data = array('title' => 'Bludit', 'slogan' => 'cms', 'description' => '', 'footer' => '©2015', 'language' => $locale, 'locale' => $locale, 'timezone' => 'UTC', 'theme' => 'pure', 'adminTheme' => 'default', 'homepage' => '', 'postsperpage' => '6', 'uriPost' => '/post/', 'uriPage' => '/', 'uriTag' => '/tag/', 'advancedOptions' => 'false', 'url' => 'http://' . DOMAIN . HTML_PATH_ROOT);
    file_put_contents(PATH_DATABASES . 'site.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
    $salt = getRandomString();
    $passwordHash = sha1($adminPassword . $salt);
    $registered = time();
    // File users.php
    $data = array('admin' => array('firstName' => '', 'lastName' => '', 'twitter' => '', 'role' => 'admin', 'password' => $passwordHash, 'salt' => $salt, 'email' => $email, 'registered' => $registered));
    file_put_contents(PATH_DATABASES . 'users.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
    // File plugins/pages/db.php
    $data = array('homeLink' => true, 'label' => $Language->get('Pages'));
    file_put_contents(PATH_PLUGINS_DATABASES . 'pages' . DS . 'db.php', $dataHead . json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
    // File index.txt for error page
    $data = 'Title: ' . $Language->get('Error') . '
	Content: ' . $Language->get('The page has not been found');
    file_put_contents(PATH_PAGES . 'error' . DS . 'index.txt', $data, LOCK_EX);
    // File index.txt for welcome post
    $data = 'Title: ' . $Language->get('First post') . '
Content:

' . $Language->get('Congratulations you have successfully installed your Bludit') . '
---

' . $Language->get('Whats next') . '
---
- ' . $Language->get('Manage your Bludit from the admin panel') . '
- ' . $Language->get('Follow Bludit on') . ' [Twitter](https://twitter.com/bludit) / [Facebook](https://www.facebook.com/pages/Bludit/239255789455913) / [Google+](https://plus.google.com/+Bluditcms)
- ' . $Language->get('Visit the support forum') . '
- ' . $Language->get('Read the documentation for more information') . '
- ' . $Language->get('Share with your friends and enjoy');
    file_put_contents(PATH_POSTS . $firstPostSlug . DS . 'index.txt', $data, LOCK_EX);
    return true;
}
Example #2
0
        exit('<meta http-equiv="refresh" content="0; url="' . HTML_PATH_ROOT . '">');
    }
}
?>
<!DOCTYPE HTML>
<html class="uk-height-1-1 uk-notouch">
<head>
	<base href="bl-kernel/admin/themes/default/">
	<meta charset="<?php 
echo CHARSET;
?>
">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">

	<title><?php 
echo $Language->get('Bludit Installer');
?>
</title>

	<!-- Favicon -->
	<link rel="shortcut icon" type="image/x-icon" href="./img/favicon.png">

	<!-- CSS -->
	<link rel="stylesheet" type="text/css" href="./css/uikit/uikit.almost-flat.min.css?version=<?php 
echo time();
?>
">
	<link rel="stylesheet" type="text/css" href="./css/installer.css?version=<?php 
echo time();
?>
">
Example #3
0
    }
}
?>

<!doctype html>
<html lang="en">
<head>
	<base href="admin/themes/default/">
	<meta charset="<?php 
echo CHARSET;
?>
">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">

	<title><?php 
echo $Language->get('Bludit Installer');
?>
</title>

	<link rel="stylesheet" href="./css/kube.min.css">
	<link rel="stylesheet" href="./css/installer.css">

	<script src="./js/jquery.min.js"></script>
	<script src="./js/kube.min.js"></script>
</head>
<body>
<div class="units-row">
<div class="unit-centered unit-60">
<div class="main">

	<h1 class="title"><?php