New features

This commit is contained in:
Diego Najar 2015-05-07 01:00:01 +00:00
parent 42e3d7a11e
commit 59c247809d
5 changed files with 77 additions and 38 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
.DS_Store .DS_Store
content/

View File

@ -13,6 +13,8 @@ define('PATH_BOOT', PATH_ROOT.'kernel/boot/');
// Init // Init
require(PATH_BOOT.'init.php'); require(PATH_BOOT.'init.php');
// Admin area // Admin area
if($Url->whereAmI()==='admin') if($Url->whereAmI()==='admin')
{ {

View File

@ -18,7 +18,7 @@ define('PATH_PLUGINS_DATABASES', PATH_CONTENT.'databases/plugins/');
// 7=read,write,execute | 5=read,execute // 7=read,write,execute | 5=read,execute
$dirpermissions = 0755; $dirpermissions = 0755;
if(mkdir(PATH_POSTS, $dirpermissions, true)) if(mkdir(PATH_POSTS.'welcome', $dirpermissions, true))
{ {
$errorText = 'Error when trying to created the directory=>'.PATH_POSTS; $errorText = 'Error when trying to created the directory=>'.PATH_POSTS;
error_log($errorText, 0); error_log($errorText, 0);
@ -45,39 +45,49 @@ $dataHead = "<?php defined('BLUDIT') or die('Bludit CMS.'); ?>".PHP_EOL;
// File pages.php // File pages.php
$data = array( $data = array(
'error'=>array( 'error'=>array(
"description"=>"Error page", 'description'=>'Error page',
"username"=>"admin", 'username'=>'admin',
"tags"=>"", 'tags'=>'',
"status"=>"published", 'status'=>'published',
"unixTimeCreated"=>1430686755, 'unixTimeCreated'=>1430686755,
"unixTimeModified"=>0, 'unixTimeModified'=>0,
"position"=>0 'position'=>0
) )
); );
file_put_contents(PATH_DATABASES.'pages.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX); file_put_contents(PATH_DATABASES.'pages.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
// File posts.php // File posts.php
$data = array(); $data = array(
'welcome'=>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_put_contents(PATH_DATABASES.'posts.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
// File site.php // File site.php
$data = array( $data = array(
"title"=>"Bludit CMS", 'title'=>'Bludit CMS',
"description"=>"", 'description'=>'',
"footer"=>"Footer text - 2015", 'footer'=>'Footer text - 2015',
"language"=>"english", 'language'=>'english',
"locale"=>"en_EN", 'locale'=>'en_EN',
"timezone"=>"America/Argentina/Buenos_Aires", 'timezone'=>'America/Argentina/Buenos_Aires',
"theme"=>"pure", 'theme'=>'pure',
"adminTheme"=>"default", 'adminTheme'=>'default',
"homepage"=>"", 'homepage'=>'',
"postsperpage"=>"6", 'postsperpage'=>'6',
"uriPost"=>"/post/", 'uriPost'=>'/post/',
"uriPage"=>"/", 'uriPage'=>'/',
"uriTag"=>"/tag/", 'uriTag'=>'/tag/',
"advancedOptions"=>"false", 'advancedOptions'=>'false',
"url"=>"http:/localhost/cms/bludit-bitbucket/" 'url'=>'http:/localhost/cms/bludit-bitbucket/'
); );
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);
@ -85,21 +95,38 @@ file_put_contents(PATH_DATABASES.'site.php', $dataHead.json_encode($data, JSON_P
// File users.php // File users.php
$data = array( $data = array(
'admin'=>array( 'admin'=>array(
"firstName"=>"", 'firstName'=>'',
"lastName"=>"", 'lastName'=>'',
"twitter"=>"", 'twitter'=>'',
"role"=>"admin", 'role'=>'admin',
"password"=>"7607d34033344d9a4615a8795d865ec4a47851e7", 'password'=>'7607d34033344d9a4615a8795d865ec4a47851e7',
"salt"=>"adr32t", 'salt'=>'adr32t',
"email"=>"", 'email'=>'',
"registered"=>1430686755 'registered'=>1430686755
) )
); );
file_put_contents(PATH_DATABASES.'users.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX); file_put_contents(PATH_DATABASES.'users.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
// File index.txt for error page // File index.txt for error page
$data = "Title: Error".PHP_EOL."Content: The page has not been found."; $data = 'Title: Error
Content: The page has not been found.';
file_put_contents(PATH_PAGES.'error/index.txt', $data, LOCK_EX); file_put_contents(PATH_PAGES.'error/index.txt', $data, LOCK_EX);
// File index.txt for welcome post
$data = 'title: Welcome
Content:
Congrats you have installed Bludit!
===
What next:
- Administrate your Bludit from the Admin Area
- Follow Bludit on Twitter / Facebook / Google+
- Visit the forum for support
- Read the documentation for more information
- Share with your friend :D';
file_put_contents(PATH_POSTS.'welcome/index.txt', $data, LOCK_EX);
?> ?>

View File

@ -41,7 +41,7 @@ class helperText {
{ {
$accents_regex = '~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i'; $accents_regex = '~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i';
$special_cases = array( '&' => 'and'); $special_cases = array( '&' => 'and');
$string = mb_strtolower( trim( $string ), 'UTF-8' ); $string = self::lowercase( trim( $string ), 'UTF-8' );
$string = str_replace( array_keys($special_cases), array_values( $special_cases), $string ); $string = str_replace( array_keys($special_cases), array_values( $special_cases), $string );
$string = preg_replace( $accents_regex, '$1', htmlentities( $string, ENT_QUOTES, 'UTF-8' ) ); $string = preg_replace( $accents_regex, '$1', htmlentities( $string, ENT_QUOTES, 'UTF-8' ) );
$string = preg_replace("/[^a-z0-9]/u", "$separator", $string); $string = preg_replace("/[^a-z0-9]/u", "$separator", $string);
@ -74,9 +74,18 @@ class helperText {
// Returns the portion of string specified by the start and length parameters. // Returns the portion of string specified by the start and length parameters.
public static function cut($string, $start, $length) public static function cut($string, $start, $length)
{ {
if(MB_STRING) if(MB_STRING) {
return mb_substr($string, $start, $length, 'UTF-8'); $cut = mb_substr($string, $start, $length, 'UTF-8');
return substr($string, $start, $length); }
else {
$cut = substr($string, $start, $length);
}
if(empty($cut)) {
return '';
}
return $cut;
} }
// Return string length // Return string length

View File

@ -33,7 +33,7 @@ class Login {
{ {
$username = Session::get('username'); $username = Session::get('username');
return (!empty($username)) { if(!empty($username)) {
return true; return true;
} }
} }