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); define('REMEMBER_COOKIE_EXPIRE_IN_DAYS', 30);
// Filename // Filename
define('FILENAME', 'index.md'); define('FILENAME', 'index.txt');
// Database date format // Database date format
define('DB_DATE_FORMAT', 'Y-m-d H:i:s'); define('DB_DATE_FORMAT', 'Y-m-d H:i:s');

View File

@ -3,7 +3,7 @@
"native": "English", "native": "English",
"english-name": "English", "english-name": "English",
"locale": "en, en_US, en_AU, en_CA, en_GB, en_IE, en_NZ", "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": { "authors": {
"0": "Diego @dignajar", "0": "Diego @dignajar",
"1": "Clickwork https://clickwork.ch", "1": "Clickwork https://clickwork.ch",
@ -233,7 +233,6 @@
"ip-address-has-been-blocked": "IP address has been blocked", "ip-address-has-been-blocked": "IP address has been blocked",
"try-again-in-a-few-minutes": "Try again in a few minutes", "try-again-in-a-few-minutes": "Try again in a few minutes",
"content-published-from-scheduler": "Content published from scheduler", "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", "blog": "Blog",
"complete-all-fields": "Complete all fields", "complete-all-fields": "Complete all fields",
"static": "Static", "static": "Static",
@ -273,7 +272,7 @@
"next-page": "Next page", "next-page": "Next page",
"scheduled": "Scheduled", "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.", "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", "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", "read-more": "Read more",
"remember-me": "Remember me", "remember-me": "Remember me",
@ -283,5 +282,17 @@
"change-the-position-of-the-plugins": "Change the position of the plugins", "change-the-position-of-the-plugins": "Change the position of the plugins",
"reading-time": "Reading time", "reading-time": "Reading time",
"minutes": "minutes", "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; $dirpermissions = 0755;
// PAGES // PAGES
if (!mkdir(PATH_PAGES.'welcome', $dirpermissions, true)) { if (!mkdir(PATH_PAGES.$Language->get('example-page-1-slug'), $dirpermissions, true)) {
$errorText = 'Error when trying to created the directory=>'.PATH_PAGES.'welcome'; $errorText = 'Error when trying to created the directory=>'.PATH_PAGES.$Language->get('example-page-1-slug');
error_log($errorText, 0); error_log($errorText, 0);
} }
if (!mkdir(PATH_PAGES.$Language->get('example-page-2-slug'), $dirpermissions, true)) {
if (!mkdir(PATH_PAGES.'about', $dirpermissions, true)) { $errorText = 'Error when trying to created the directory=>'.PATH_PAGES.$Language->get('example-page-2-slug');
$errorText = 'Error when trying to created the directory=>'.PATH_PAGES.'about'; 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); error_log($errorText, 0);
} }
@ -293,8 +300,59 @@ function install($adminPassword, $email, $timezone)
// File pages.php // File pages.php
$data = array( $data = array(
'about'=>array( $Language->get('example-page-1-slug')=>array(
'description'=>$Language->get('About your site or yourself'), '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', 'username'=>'admin',
'tags'=>array(), 'tags'=>array(),
'status'=>'static', 'status'=>'static',
@ -302,30 +360,13 @@ function install($adminPassword, $email, $timezone)
'date'=>$currentDate, 'date'=>$currentDate,
'dateModified'=>'', 'dateModified'=>'',
'allowComments'=>true, 'allowComments'=>true,
'position'=>2, 'position'=>1,
'coverImage'=>'', 'coverImage'=>'',
'md5file'=>'', 'md5file'=>'',
'category'=>'', 'category'=>'',
'uuid'=>md5(uniqid()), 'uuid'=>md5(uniqid()),
'parent'=>'', 'parent'=>'',
'slug'=>'about' 'slug'=>$Language->get('example-page-4-slug')
),
'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'
) )
); );
@ -343,14 +384,14 @@ function install($adminPassword, $email, $timezone)
} }
$data = array( $data = array(
'title'=>'BLUDIT', 'title'=>'BLUDIT',
'slogan'=>'CMS', 'slogan'=>$Language->get('welcome-to-bludit'),
'description'=>'', 'description'=>$Language->get('congratulations-you-have-successfully-installed-your-bludit'),
'footer'=>'Copyright © '.Date::current('Y'), 'footer'=>'Copyright © '.Date::current('Y'),
'itemsPerPage'=>6, 'itemsPerPage'=>6,
'language'=>$Language->currentLanguage(), 'language'=>$Language->currentLanguage(),
'locale'=>$Language->locale(), 'locale'=>$Language->locale(),
'timezone'=>$timezone, 'timezone'=>$timezone,
'theme'=>'kernel-panic', 'theme'=>'alternative',
'adminTheme'=>'default', 'adminTheme'=>'default',
'homepage'=>'', 'homepage'=>'',
'pageNotFound'=>'', 'pageNotFound'=>'',
@ -360,7 +401,14 @@ function install($adminPassword, $email, $timezone)
'uriBlog'=>'/blog/', 'uriBlog'=>'/blog/',
'url'=>$siteUrl, 'url'=>$siteUrl,
'emailFrom'=>'no-reply@'.DOMAIN, '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); 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_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 plugins/simplemde/db.php
file_put_contents( file_put_contents(
PATH_PLUGINS_DATABASES.'simplemde'.DS.'db.php', PATH_PLUGINS_DATABASES.'simplemde'.DS.'db.php',
@ -455,6 +490,19 @@ function install($adminPassword, $email, $timezone)
LOCK_EX 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 plugins/tags/db.php
file_put_contents( file_put_contents(
PATH_PLUGINS_DATABASES.'tags'.DS.'db.php', PATH_PLUGINS_DATABASES.'tags'.DS.'db.php',
@ -467,30 +515,21 @@ function install($adminPassword, $email, $timezone)
LOCK_EX LOCK_EX
); );
// File for about page // Page create-your-own-content
$data = 'Title: '.$Language->get('About').PHP_EOL.'Content: '.PHP_EOL.$Language->get('installer-page-about-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.'about'.DS.FILENAME, $data, LOCK_EX); file_put_contents(PATH_PAGES.$Language->get('example-page-1-slug').DS.FILENAME, $data, LOCK_EX);
// File for welcome page // Page set-up-your-new-site
$text1 = Text::replaceAssoc( $data = 'Title: '.$Language->get('example-page-2-title').PHP_EOL.'Content: '.PHP_EOL.$Language->get('example-page-2-content');
array( file_put_contents(PATH_PAGES.$Language->get('example-page-2-slug').DS.FILENAME, $data, LOCK_EX);
'{{ADMIN_AREA_LINK}}'=>PROTOCOL.DOMAIN.HTML_PATH_ROOT.'admin'
),
$Language->get('Manage your Bludit from the admin panel')
);
$data = 'Title: '.$Language->get('Welcome').' // Page follow-bludit
Content: $data = 'Title: '.$Language->get('example-page-3-title').PHP_EOL.'Content: '.PHP_EOL.$Language->get('example-page-3-content');
'.$Language->get('congratulations-you-have-successfully-installed-your-bludit').' file_put_contents(PATH_PAGES.$Language->get('example-page-3-slug').DS.FILENAME, $data, LOCK_EX);
### '.$Language->get('whats-next').' // Page about
- '.$text1.' $data = 'Title: '.$Language->get('example-page-4-title').PHP_EOL.'Content: '.PHP_EOL.$Language->get('example-page-4-content');
- '.$Language->get('Follow Bludit on').' [Twitter](https://twitter.com/bludit) / [Facebook](https://www.facebook.com/bluditcms) / [Google+](https://plus.google.com/+Bluditcms) file_put_contents(PATH_PAGES.$Language->get('example-page-4-slug').DS.FILENAME, $data, LOCK_EX);
- '.$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);
return true; return true;
} }
@ -506,10 +545,10 @@ function checkPOST($args)
} }
// Sanitize email // Sanitize email
$email = sanitize::email($args['email']); //$email = sanitize::email($args['email']);
// Install Bludit // Install Bludit
install($args['password'], $email, $args['timezone']); install($args['password'], '', $args['timezone']);
return true; return true;
} }