Improves on installer

This commit is contained in:
Diego Najar 2018-02-25 17:25:10 +01:00
parent b558899f22
commit 5440900fb4
3 changed files with 122 additions and 72 deletions

View File

@ -57,7 +57,7 @@ define('REMEMBER_COOKIE_TOKEN', 'BLUDITREMEMBERTOKEN');
define('REMEMBER_COOKIE_EXPIRE_IN_DAYS', 30);
// Filename
define('FILENAME', 'index.md');
define('FILENAME', 'index.txt');
// Database date format
define('DB_DATE_FORMAT', 'Y-m-d H:i:s');

View File

@ -3,7 +3,7 @@
"native": "English",
"english-name": "English",
"locale": "en, en_US, en_AU, en_CA, en_GB, en_IE, en_NZ",
"last-update": "2017-12-27",
"last-update": "2018-02-25",
"authors": {
"0": "Diego @dignajar",
"1": "Clickwork https://clickwork.ch",
@ -233,7 +233,6 @@
"ip-address-has-been-blocked": "IP address has been blocked",
"try-again-in-a-few-minutes": "Try again in a few minutes",
"content-published-from-scheduler": "Content published from scheduler",
"installer-page-about-content": "The about page is an important page. A lot of people are interested in the owner of a blog or a website.",
"blog": "Blog",
"complete-all-fields": "Complete all fields",
"static": "Static",
@ -273,7 +272,7 @@
"next-page": "Next page",
"scheduled": "Scheduled",
"this-token-is-similar-to-a-password-it-should-not-be-shared": "This token is similar to a password, it should not be shared.",
"congratulations-you-have-successfully-installed-your-bludit": "Congratulations you have successfully installed your **Bludit**.",
"congratulations-you-have-successfully-installed-your-bludit": "Congratulations you have successfully installed your Bludit.",
"this-theme-may-not-be-supported-by-this-version-of-bludit": "This theme may not be supported by this version of Bludit",
"read-more": "Read more",
"remember-me": "Remember me",
@ -283,5 +282,17 @@
"change-the-position-of-the-plugins": "Change the position of the plugins",
"reading-time": "Reading time",
"minutes": "minutes",
"minute": "minute"
"minute": "minute",
"example-page-1-slug": "create-your-own-content",
"example-page-1-title": "Create your own content",
"example-page-1-content": "Start writing your own content or edit the current to fit your needs. To create, edit or remove content you need to login to the [admin panel](/admin) with the username `admin` and the password you set on the installation process.",
"example-page-2-slug": "set-up-your-new-site",
"example-page-2-title": "Set up your new site",
"example-page-2-content": "Update the settings of your site from the [admin panel](/admin), you can change the title, description and the social networks from [Settings > General](/admin/settings-general).",
"example-page-3-slug": "follow-bludit",
"example-page-3-title": "Follow Bludit",
"example-page-3-content": "Get information about news, new releases, new themes or new plugins on our social networks [Facebook](https://www.facebook.com/bluditcms/), [Twitter](https://twitter.com/bludit) and [GooglePlus](https://plus.google.com/+Bluditcms) or visit our [Blog](https://blog.bludit.com).",
"example-page-4-slug": "about",
"example-page-4-title": "About",
"example-page-4-content": "Your About page is typically one of the most visited pages on your site, need to be simple with a few key things, such as your name, who are you, how can contact you, a small story, etc."
}

View File

@ -243,13 +243,20 @@ function install($adminPassword, $email, $timezone)
$dirpermissions = 0755;
// PAGES
if (!mkdir(PATH_PAGES.'welcome', $dirpermissions, true)) {
$errorText = 'Error when trying to created the directory=>'.PATH_PAGES.'welcome';
if (!mkdir(PATH_PAGES.$Language->get('example-page-1-slug'), $dirpermissions, true)) {
$errorText = 'Error when trying to created the directory=>'.PATH_PAGES.$Language->get('example-page-1-slug');
error_log($errorText, 0);
}
if (!mkdir(PATH_PAGES.'about', $dirpermissions, true)) {
$errorText = 'Error when trying to created the directory=>'.PATH_PAGES.'about';
if (!mkdir(PATH_PAGES.$Language->get('example-page-2-slug'), $dirpermissions, true)) {
$errorText = 'Error when trying to created the directory=>'.PATH_PAGES.$Language->get('example-page-2-slug');
error_log($errorText, 0);
}
if (!mkdir(PATH_PAGES.$Language->get('example-page-3-slug'), $dirpermissions, true)) {
$errorText = 'Error when trying to created the directory=>'.PATH_PAGES.$Language->get('example-page-3-slug');
error_log($errorText, 0);
}
if (!mkdir(PATH_PAGES.$Language->get('example-page-4-slug'), $dirpermissions, true)) {
$errorText = 'Error when trying to created the directory=>'.PATH_PAGES.$Language->get('example-page-4-slug');
error_log($errorText, 0);
}
@ -293,8 +300,59 @@ function install($adminPassword, $email, $timezone)
// File pages.php
$data = array(
'about'=>array(
'description'=>$Language->get('About your site or yourself'),
$Language->get('example-page-1-slug')=>array(
'description'=>'',
'username'=>'admin',
'tags'=>array(),
'status'=>'published',
'type'=>'page',
'date'=>$currentDate,
'dateModified'=>'',
'allowComments'=>true,
'position'=>1,
'coverImage'=>'',
'md5file'=>'',
'category'=>'',
'uuid'=>md5(uniqid()),
'parent'=>'',
'slug'=>$Language->get('example-page-1-slug')
),
$Language->get('example-page-2-slug')=>array(
'description'=>'',
'username'=>'admin',
'tags'=>array(),
'status'=>'published',
'type'=>'page',
'date'=>$currentDate,
'dateModified'=>'',
'allowComments'=>true,
'position'=>1,
'coverImage'=>'',
'md5file'=>'',
'category'=>'',
'uuid'=>md5(uniqid()),
'parent'=>'',
'slug'=>$Language->get('example-page-2-slug')
),
$Language->get('example-page-3-slug')=>array(
'description'=>'',
'username'=>'admin',
'tags'=>array(),
'status'=>'published',
'type'=>'page',
'date'=>$currentDate,
'dateModified'=>'',
'allowComments'=>true,
'position'=>1,
'coverImage'=>'',
'md5file'=>'',
'category'=>'',
'uuid'=>md5(uniqid()),
'parent'=>'',
'slug'=>$Language->get('example-page-3-slug')
),
$Language->get('example-page-4-slug')=>array(
'description'=>'',
'username'=>'admin',
'tags'=>array(),
'status'=>'static',
@ -302,31 +360,14 @@ function install($adminPassword, $email, $timezone)
'date'=>$currentDate,
'dateModified'=>'',
'allowComments'=>true,
'position'=>2,
'position'=>1,
'coverImage'=>'',
'md5file'=>'',
'category'=>'',
'uuid'=>md5(uniqid()),
'parent'=>'',
'slug'=>'about'
),
'welcome'=>array(
'description'=>$Language->get('Welcome to Bludit'),
'username'=>'admin',
'tags'=>array('bludit'=>'Bludit','cms'=>'CMS','flat-files'=>'Flat files'),
'status'=>'published',
'type'=>'post',
'date'=>$currentDate,
'dateModified'=>'',
'allowComments'=>true,
'position'=>1,
'coverImage'=>'',
'md5file'=>'',
'category'=>'general',
'uuid'=>md5(uniqid()),
'parent'=>'',
'slug'=>'welcome'
)
'slug'=>$Language->get('example-page-4-slug')
)
);
file_put_contents(PATH_DATABASES.'pages.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
@ -343,14 +384,14 @@ function install($adminPassword, $email, $timezone)
}
$data = array(
'title'=>'BLUDIT',
'slogan'=>'CMS',
'description'=>'',
'slogan'=>$Language->get('welcome-to-bludit'),
'description'=>$Language->get('congratulations-you-have-successfully-installed-your-bludit'),
'footer'=>'Copyright © '.Date::current('Y'),
'itemsPerPage'=>6,
'language'=>$Language->currentLanguage(),
'locale'=>$Language->locale(),
'timezone'=>$timezone,
'theme'=>'kernel-panic',
'theme'=>'alternative',
'adminTheme'=>'default',
'homepage'=>'',
'pageNotFound'=>'',
@ -360,7 +401,14 @@ function install($adminPassword, $email, $timezone)
'uriBlog'=>'/blog/',
'url'=>$siteUrl,
'emailFrom'=>'no-reply@'.DOMAIN,
'orderBy'=>'date'
'orderBy'=>'date',
'currentBuild'=>'0',
'twitter'=>'https://twitter.com/bludit',
'facebook'=>'https://www.facebook.com/bluditcms',
'codepen'=>'',
'googlePlus'=>'https://plus.google.com/+Bluditcms',
'github'=> 'https://github.com/bludit',
'dateFormat'=>'F j, Y'
);
file_put_contents(PATH_DATABASES.'site.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
@ -429,19 +477,6 @@ function install($adminPassword, $email, $timezone)
);
file_put_contents(PATH_DATABASES.'tags.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
// File plugins/about/db.php
file_put_contents(
PATH_PLUGINS_DATABASES.'about'.DS.'db.php',
$dataHead.json_encode(
array(
'position'=>0,
'label'=>$Language->get('About'),
'text'=>$Language->get('this-is-a-brief-description-of-yourself-our-your-site')
),
JSON_PRETTY_PRINT),
LOCK_EX
);
// File plugins/simplemde/db.php
file_put_contents(
PATH_PLUGINS_DATABASES.'simplemde'.DS.'db.php',
@ -455,6 +490,19 @@ function install($adminPassword, $email, $timezone)
LOCK_EX
);
// File plugins/about/db.php
file_put_contents(
PATH_PLUGINS_DATABASES.'about'.DS.'db.php',
$dataHead.json_encode(
array(
'position'=>1,
'label'=>$Language->get('About'),
'text'=>$Language->get('this-is-a-brief-description-of-yourself-our-your-site')
),
JSON_PRETTY_PRINT),
LOCK_EX
);
// File plugins/tags/db.php
file_put_contents(
PATH_PLUGINS_DATABASES.'tags'.DS.'db.php',
@ -467,30 +515,21 @@ function install($adminPassword, $email, $timezone)
LOCK_EX
);
// File for about page
$data = 'Title: '.$Language->get('About').PHP_EOL.'Content: '.PHP_EOL.$Language->get('installer-page-about-content');
file_put_contents(PATH_PAGES.'about'.DS.FILENAME, $data, LOCK_EX);
// Page create-your-own-content
$data = 'Title: '.$Language->get('example-page-1-title').PHP_EOL.'Content: '.PHP_EOL.$Language->get('example-page-1-content');
file_put_contents(PATH_PAGES.$Language->get('example-page-1-slug').DS.FILENAME, $data, LOCK_EX);
// File for welcome page
$text1 = Text::replaceAssoc(
array(
'{{ADMIN_AREA_LINK}}'=>PROTOCOL.DOMAIN.HTML_PATH_ROOT.'admin'
),
$Language->get('Manage your Bludit from the admin panel')
);
// Page set-up-your-new-site
$data = 'Title: '.$Language->get('example-page-2-title').PHP_EOL.'Content: '.PHP_EOL.$Language->get('example-page-2-content');
file_put_contents(PATH_PAGES.$Language->get('example-page-2-slug').DS.FILENAME, $data, LOCK_EX);
$data = 'Title: '.$Language->get('Welcome').'
Content:
'.$Language->get('congratulations-you-have-successfully-installed-your-bludit').'
// Page follow-bludit
$data = 'Title: '.$Language->get('example-page-3-title').PHP_EOL.'Content: '.PHP_EOL.$Language->get('example-page-3-content');
file_put_contents(PATH_PAGES.$Language->get('example-page-3-slug').DS.FILENAME, $data, LOCK_EX);
### '.$Language->get('whats-next').'
- '.$text1.'
- '.$Language->get('Follow Bludit on').' [Twitter](https://twitter.com/bludit) / [Facebook](https://www.facebook.com/bluditcms) / [Google+](https://plus.google.com/+Bluditcms)
- '.$Language->get('Chat with developers and users on Gitter').'
- '.$Language->get('visit-the-forum-for-support').'
- '.$Language->get('Read the documentation for more information');
file_put_contents(PATH_PAGES.'welcome'.DS.FILENAME, $data, LOCK_EX);
// Page about
$data = 'Title: '.$Language->get('example-page-4-title').PHP_EOL.'Content: '.PHP_EOL.$Language->get('example-page-4-content');
file_put_contents(PATH_PAGES.$Language->get('example-page-4-slug').DS.FILENAME, $data, LOCK_EX);
return true;
}
@ -506,10 +545,10 @@ function checkPOST($args)
}
// Sanitize email
$email = sanitize::email($args['email']);
//$email = sanitize::email($args['email']);
// Install Bludit
install($args['password'], $email, $args['timezone']);
install($args['password'], '', $args['timezone']);
return true;
}