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
content/

View File

@ -13,6 +13,8 @@ define('PATH_BOOT', PATH_ROOT.'kernel/boot/');
// Init
require(PATH_BOOT.'init.php');
// Admin area
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
$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;
error_log($errorText, 0);
@ -45,39 +45,49 @@ $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
'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();
$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 site.php
$data = array(
"title"=>"Bludit CMS",
"description"=>"",
"footer"=>"Footer text - 2015",
"language"=>"english",
"locale"=>"en_EN",
"timezone"=>"America/Argentina/Buenos_Aires",
"theme"=>"pure",
"adminTheme"=>"default",
"homepage"=>"",
"postsperpage"=>"6",
"uriPost"=>"/post/",
"uriPage"=>"/",
"uriTag"=>"/tag/",
"advancedOptions"=>"false",
"url"=>"http:/localhost/cms/bludit-bitbucket/"
'title'=>'Bludit CMS',
'description'=>'',
'footer'=>'Footer text - 2015',
'language'=>'english',
'locale'=>'en_EN',
'timezone'=>'America/Argentina/Buenos_Aires',
'theme'=>'pure',
'adminTheme'=>'default',
'homepage'=>'',
'postsperpage'=>'6',
'uriPost'=>'/post/',
'uriPage'=>'/',
'uriTag'=>'/tag/',
'advancedOptions'=>'false',
'url'=>'http:/localhost/cms/bludit-bitbucket/'
);
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
$data = array(
'admin'=>array(
"firstName"=>"",
"lastName"=>"",
"twitter"=>"",
"role"=>"admin",
"password"=>"7607d34033344d9a4615a8795d865ec4a47851e7",
"salt"=>"adr32t",
"email"=>"",
"registered"=>1430686755
'firstName'=>'',
'lastName'=>'',
'twitter'=>'',
'role'=>'admin',
'password'=>'7607d34033344d9a4615a8795d865ec4a47851e7',
'salt'=>'adr32t',
'email'=>'',
'registered'=>1430686755
)
);
file_put_contents(PATH_DATABASES.'users.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
// 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 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';
$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 = preg_replace( $accents_regex, '$1', htmlentities( $string, ENT_QUOTES, 'UTF-8' ) );
$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.
public static function cut($string, $start, $length)
{
if(MB_STRING)
return mb_substr($string, $start, $length, 'UTF-8');
return substr($string, $start, $length);
if(MB_STRING) {
$cut = mb_substr($string, $start, $length, 'UTF-8');
}
else {
$cut = substr($string, $start, $length);
}
if(empty($cut)) {
return '';
}
return $cut;
}
// Return string length

View File

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