Merge pull request #1 from dignajar/master

Merge update from dignajar
This commit is contained in:
Ethan Chen 2015-08-18 12:36:27 +08:00
commit 45c612b4b3
38 changed files with 648 additions and 236 deletions

View File

@ -8,6 +8,31 @@
// Functions
// ============================================================================
function checkPost($args)
{
global $Security;
global $Login;
global $Language;
if($Security->isBlocked()) {
Alert::set($Language->g('IP address has been blocked').'<br>'.$Language->g('Try again in a few minutes'));
return false;
}
// Verify User sanitize the input
if( $Login->verifyUser($_POST['username'], $_POST['password']) )
{
Redirect::page('admin', 'dashboard');
return true;
}
// Bruteforce protection, add IP to blacklist.
$Security->addLoginFail();
Alert::set($Language->g('Username or password incorrect'));
return false;
}
// ============================================================================
// Main before POST
// ============================================================================
@ -18,15 +43,7 @@
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
// Verify User sanitize the input
if( $Login->verifyUser($_POST['username'], $_POST['password']) )
{
Redirect::page('admin', 'dashboard');
}
else
{
Alert::set($Language->g('Username or password incorrect'));
}
checkPost($_POST);
}
// ============================================================================

View File

@ -0,0 +1,26 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// ============================================================================
// Check role
// ============================================================================
if($Login->role()!=='admin') {
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
Redirect::page('admin', 'dashboard');
}
// ============================================================================
// Functions
// ============================================================================
// ============================================================================
// Main before POST
// ============================================================================
// ============================================================================
// POST Method
// ============================================================================
// ============================================================================
// Main after POST
// ============================================================================

View File

@ -16,6 +16,10 @@ div.unit-80 {
margin-left: 1% !important;
}
.tools-alert {
text-align: center;
}
/* ----------- FONTS AWESOME ----------- */
.fa-right {
margin-right: 5px;
@ -140,6 +144,7 @@ div.dashboardBox .nav {
div.dashboardBox .nav a {
padding: 0 !important;
display: inline-block;
margin-left: 8px;
}
div.dashboardBox i.iconContent {
@ -154,6 +159,11 @@ div.dashboardBox div.bigContent {
font-weight: bold;
}
div.dashboardBox span {
display: inline-block !important;
padding: 3px 6px;
}
div.dashboardBox h2 {
color: #666;
font-size: 1.1em;
@ -189,6 +199,7 @@ div.dashboardBox ul.menu li.description:last-child {
margin-bottom: 0 !important;
}
/* ----------- FORMS ----------- */
form h4 {

View File

@ -8,6 +8,10 @@ a:hover {
text-decoration: none !important;
}
p {
margin-bottom: 0;
}
/* ----------- FONTS AWESOME ----------- */
.fa-right {
margin-right: 5px;
@ -16,7 +20,7 @@ a:hover {
/* ----------- ----------- */
div.main {
text-align: center;
margin: 30px 0;
margin: 50px 0 0 0;
}
h1.title {
font-weight: lighter;
@ -27,6 +31,10 @@ td {
text-align: center;
}
.boxInstallerForm {
margin-top: 30px !important;
}
.tools-message {
display: block;
position: relative;

View File

@ -2,7 +2,7 @@
<html>
<head>
<base href="<?php echo HTML_PATH_ADMIN_THEME ?>">
<meta charset="utf-8">
<meta charset="<?php echo CHARSET ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo $layout['title'] ?></title>

View File

@ -2,10 +2,10 @@
<html>
<head>
<base href="<?php echo HTML_PATH_ADMIN_THEME ?>">
<meta charset="utf-8">
<meta charset="<?php echo CHARSET ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bludit Log in</title>
<title>Bludit</title>
<link rel="stylesheet" href="./css/kube.min.css?version=<?php echo BLUDIT_VERSION ?>">
<link rel="stylesheet" href="./css/default.css?version=<?php echo BLUDIT_VERSION ?>">
@ -23,7 +23,7 @@
<nav class="navbar nav-fullwidth">
<h1>Bludit</h1>
<ul>
<li><a href="<?php echo HTML_PATH_ROOT ?>"><?php $Language->p('Home') ?></a></li>
<li><a href="<?php echo HTML_PATH_ROOT ?>"><?php $Language->p('Website') ?></a></li>
</ul>
</nav>
</div>
@ -31,13 +31,13 @@
<div class="units-row">
<!-- CONTENT -->
<div class="unit-centered unit-40" style="max-width: 500px">
<div class="unit-centered unit-40" style="max-width: 400px">
<div id="content">
<?php
if(Alert::defined()) {
echo '<div class="tools-alert tools-alert-red">'.Alert::get().'</div>';
echo '<div class="tools-alert tools-alert-green">'.Alert::get().'</div>';
}
// Load view
@ -51,8 +51,6 @@
</div>
<div id="footer">Bludit</div>
<!-- Plugins Login Body Begin -->
<?php Theme::plugins('loginBodyEnd') ?>

View File

@ -50,7 +50,7 @@
</div>
<div class="dashboardBox">
<h2>Drafts</h2>
<h2><?php $Language->p('Drafts') ?></h2>
<div class="content">
<nav class="nav">
<ul>
@ -63,11 +63,11 @@
{
foreach($_draftPosts as $Post)
{
echo '<li>('.$Language->g('Post').') <a href="'.HTML_PATH_ADMIN_ROOT.'edit-post/'.$Post->key().'">'.($Post->title()?$Post->title():'['.$Language->g('Empty title').'] ').'</a></li>';
echo '<li><span class="label label-outline label-blue smaller">'.$Language->g('Post').'</span><a href="'.HTML_PATH_ADMIN_ROOT.'edit-post/'.$Post->key().'">'.($Post->title()?$Post->title():'['.$Language->g('Empty title').'] ').'</a></li>';
}
foreach($_draftPages as $Page)
{
echo '<li>('.$Language->g('Page').') <a href="'.HTML_PATH_ADMIN_ROOT.'edit-page/'.$Page->key().'">'.($Page->title()?$Page->title():'['.$Language->g('Empty title').'] ').'</a></li>';
echo '<li><span class="label label-outline label-green smaller">'.$Language->g('Page').'</span><a href="'.HTML_PATH_ADMIN_ROOT.'edit-page/'.$Page->key().'">'.($Page->title()?$Page->title():'['.$Language->g('Empty title').'] ').'</a></li>';
}
}
?>
@ -75,7 +75,5 @@
</nav>
</div>
</div>
</div>
</div>

View File

@ -24,7 +24,7 @@
}
echo '<tr>';
echo '<td>'.($Page->parentKey()?NO_PARENT_CHAR:'').'<a href="'.HTML_PATH_ADMIN_ROOT.'edit-page/'.$Page->key().'">'.($Page->published()?'':'['.$Language->g('Draft').'] ').($Page->title()?$Page->title():'['.$Language->g('Empty title').'] ').'</a></td>';
echo '<td>'.($Page->parentKey()?NO_PARENT_CHAR:'').'<a href="'.HTML_PATH_ADMIN_ROOT.'edit-page/'.$Page->key().'">'.($Page->published()?'':'<span class="label label-outline label-red smaller">'.$Language->g('Draft').'</span> ').($Page->title()?$Page->title():'<span class="label label-outline label-blue smaller">'.$Language->g('Empty title').'</span> ').'</a></td>';
echo '<td>'.$parentTitle.'</td>';
echo '</tr>';
}

View File

@ -16,7 +16,7 @@
foreach($posts as $Post)
{
echo '<tr>';
echo '<td><a href="'.HTML_PATH_ADMIN_ROOT.'edit-post/'.$Post->key().'">'.($Post->published()?'':'<span class="label label-outline label-red smaller">'.$Language->g('Draft').'</span> ').($Post->title()?$Post->title():'['.$Language->g('Empty title').'] ').'</a></td>';
echo '<td><a href="'.HTML_PATH_ADMIN_ROOT.'edit-post/'.$Post->key().'">'.($Post->published()?'':'<span class="label label-outline label-red smaller">'.$Language->g('Draft').'</span> ').($Post->title()?$Post->title():'<span class="label label-outline label-blue smaller">'.$Language->g('Empty title').'</span> ').'</a></td>';
echo '<td>'.$Post->dateCreated().'</td>';
echo '<td>'.$Post->timeago().'</td>';
echo '</tr>';

View File

@ -24,7 +24,7 @@
<label>
<?php $Language->p('Site slogan') ?>
<input type="text" name="slogan" class="width-50" value="<?php echo $Site->slogan() ?>">
<div class="forms-desc"><?php $Language->p('use-this-field-to-add-a-catchy-prhase') ?></div>
<div class="forms-desc"><?php $Language->p('use-this-field-to-add-a-catchy-phrase') ?></div>
</label>
<label>

View File

@ -3,12 +3,12 @@
<?php
foreach($themes as $theme)
{
$installed = '';
$installedCSS = '';
if($theme['dirname']==$Site->theme()) {
$installed = 'themeBoxInstalled';
$installedCSS = 'themeBoxInstalled';
}
echo '<div class="themeBox '.$installed.'">';
echo '<div class="themeBox '.$installedCSS.'">';
echo '<p class="name">'.$theme['name'].'</p>';
echo '<p>'.$theme['description'].'</p>';

View File

@ -23,7 +23,7 @@ define('BLUDIT', true);
// Directory separator
define('DS', DIRECTORY_SEPARATOR);
// PHP paths
// PHP paths for init
define('PATH_ROOT', __DIR__.DS);
define('PATH_BOOT', PATH_ROOT.'kernel'.DS.'boot'.DS);
@ -31,12 +31,10 @@ define('PATH_BOOT', PATH_ROOT.'kernel'.DS.'boot'.DS);
require(PATH_BOOT.'init.php');
// Admin area
if($Url->whereAmI()==='admin')
{
if($Url->whereAmI()==='admin') {
require(PATH_BOOT.'admin.php');
}
// Site
else
{
else {
require(PATH_BOOT.'site.php');
}

164
install.php Normal file → Executable file
View File

@ -13,7 +13,7 @@ define('BLUDIT', true);
// Directory separator
define('DS', DIRECTORY_SEPARATOR);
// PATHs
// PHP paths
define('PATH_ROOT', __DIR__.DS);
define('PATH_CONTENT', PATH_ROOT.'content'.DS);
define('PATH_POSTS', PATH_CONTENT.'posts'.DS);
@ -31,6 +31,9 @@ define('DOMAIN', getenv('HTTP_HOST'));
$base = (dirname(getenv('SCRIPT_NAME'))==DS)?'/':dirname(getenv('SCRIPT_NAME')).'/';
define('HTML_PATH_ROOT', $base);
// Log separator
define('LOG_SEP', ' | ');
// JSON
if(!defined('JSON_PRETTY_PRINT')) {
define('JSON_PRETTY_PRINT', 128);
@ -39,17 +42,18 @@ if(!defined('JSON_PRETTY_PRINT')) {
// Check if JSON encode and decode are enabled.
define('JSON', function_exists('json_encode'));
// Multibyte string / UTF-8
define('MB_STRING', extension_loaded('mbstring'));
// Charset, default UTF-8.
define('CHARSET', 'UTF-8');
// Multibyte string extension loaded.
define('MB_STRING', extension_loaded('mbstring'));
if(MB_STRING)
{
// Tell PHP that we're using UTF-8 strings until the end of the script.
// Set internal character encoding.
mb_internal_encoding(CHARSET);
// Tell PHP that we'll be outputting UTF-8 to the browser.
// Set HTTP output character encoding.
mb_http_output(CHARSET);
}
@ -59,6 +63,16 @@ include(PATH_HELPERS.'valid.class.php');
include(PATH_HELPERS.'text.class.php');
include(PATH_ABSTRACT.'dbjson.class.php');
include(PATH_KERNEL.'dblanguage.class.php');
include(PATH_HELPERS.'log.class.php');
// Load language
$localeFromHTTP = Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']);
if(isset($_GET['language'])) {
$localeFromHTTP = Sanitize::html($_GET['language']);
}
$Language = new dbLanguage($localeFromHTTP);
// ============================================================================
// FUNCTIONS
@ -144,9 +158,9 @@ function checkSystem()
return $stdOut;
}
function install($adminPassword, $email, $locale)
function install($adminPassword, $email)
{
$Language = new dbLanguage($locale);
global $Language;
$stdOut = array();
@ -222,9 +236,9 @@ function install($adminPassword, $email, $locale)
'title'=>'Bludit',
'slogan'=>'cms',
'description'=>'',
'footer'=>'©2015',
'language'=>$locale,
'locale'=>$locale,
'footer'=>'',
'language'=>$Language->getCurrentLocale(),
'locale'=>$Language->getCurrentLocale(),
'timezone'=>'UTC',
'theme'=>'pure',
'adminTheme'=>'default',
@ -259,6 +273,16 @@ function install($adminPassword, $email, $locale)
file_put_contents(PATH_DATABASES.'users.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
// File security.php
$data = array(
'minutesBlocked'=>5,
'numberFailuresAllowed'=>10,
'blackList'=>array()
);
file_put_contents(PATH_DATABASES.'security.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
// File plugins/pages/db.php
$data = array(
'homeLink'=>true,
@ -295,16 +319,18 @@ Content:
function checkPOST($args)
{
global $Language;
// Check empty password
if(empty($args['password']))
{
return '<div>The password field is empty</div>';
return '<div>'.$Language->g('The password field is empty').'</div>';
}
// Check invalid email
if( !Valid::email($args['email']) && ($args['noCheckEmail']=='0') )
{
return '<div>Your email address is invalid.</div><div id="jscompleteEmail">Proceed anyway!</div>';
return '<div>'.$Language->g('Your email address is invalid').'</div><div id="jscompleteEmail">'.$Language->g('Proceed anyway').'</div>';
}
// Sanitize email
@ -348,10 +374,10 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' )
<html lang="en">
<head>
<base href="admin/themes/default/">
<meta charset="utf-8">
<meta charset="<?php echo CHARSET ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bludit Installer</title>
<title><?php echo $Language->get('Bludit Installer') ?></title>
<link rel="stylesheet" href="./css/kube.min.css">
<link rel="stylesheet" href="./css/installer.css">
@ -361,21 +387,37 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' )
</head>
<body>
<div class="units-row">
<div class="unit-centered unit-60">
<div class="main">
<h1 class="title">Bludit Installer</h1>
<p>Welcome to the Bludit installer</p>
<div class="unit-centered unit-60">
<div class="main">
<?php
$system = checkSystem();
<h1 class="title"><?php echo $Language->get('Bludit Installer') ?></h1>
<p><?php echo $Language->get('Welcome to the Bludit installer') ?></p>
if(empty($system))
{
?>
<?php
<p>Complete the form, choose a password for the username <strong>admin</strong></p>
$system = checkSystem();
<div class="unit-centered unit-40">
// Missing requirements
if(!empty($system))
{
echo '<div class="boxInstallerForm unit-centered unit-50">';
echo '<table class="table-stripped">';
foreach($system as $value) {
echo '<tr><td>'.$value.'</td></tr>';
}
echo '</table>';
echo '</div>';
}
// Second step
elseif(isset($_GET['language']))
{
?>
<p><?php echo $Language->get('Complete the form choose a password for the username admin') ?></p>
<div class="boxInstallerForm unit-centered unit-40">
<?php
if(!empty($error)) {
@ -386,66 +428,68 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' )
<form id="jsformInstaller" method="post" action="" class="forms" autocomplete="off">
<input type="hidden" name="noCheckEmail" id="jsnoCheckEmail" value="0">
<input type="hidden" name="language" id="jslanguage" value="<?php echo $localeFromHTTP ?>">
<label>
<input type="text" value="admin" disabled="disabled" class="width-100">
</label>
<label>
<input type="text" name="password" id="jspassword" placeholder="Password, visible field!" class="width-100" autocomplete="off" maxlength="100" value="<?php echo isset($_POST['password'])?$_POST['password']:'' ?>">
<input type="text" name="password" id="jspassword" placeholder="<?php echo $Language->get('Password visible field') ?>" class="width-100" autocomplete="off" maxlength="100" value="<?php echo isset($_POST['password'])?$_POST['password']:'' ?>">
</label>
<label>
<input type="text" name="email" id="jsemail" placeholder="Email" class="width-100" autocomplete="off" maxlength="100">
<input type="text" name="email" id="jsemail" placeholder="<?php echo $Language->get('Email') ?>" class="width-100" autocomplete="off" maxlength="100">
</label>
<p><button class="btn btn-blue width-100"><?php echo $Language->get('Install') ?></button>
</p>
</form>
</div>
<?php
} // END elseif(isset($_GET['language']))
else
{
?>
<p><?php echo $Language->get('Choose your language') ?></p>
<div class="boxInstallerForm unit-centered unit-40">
<form id="jsformLanguage" method="get" action="" class="forms" autocomplete="off">
<label for="jslanguage">
<select id="jslanguage" name="language" class="width-100">
<?php
$htmlOptions = getLanguageList();
foreach($htmlOptions as $locale=>$nativeName) {
echo '<option value="'.$locale.'">'.$nativeName.'</option>';
echo '<option value="'.$locale.'"'.( ($localeFromHTTP===$locale)?' selected="selected"':'').'>'.$nativeName.'</option>';
}
?>
</select>
</label>
<p>
<button class="btn btn-blue width-100">Install</button>
<p><button class="btn btn-blue width-100"><?php echo $Language->get('Next') ?></button>
</p>
</form>
</div>
<?php
} // END else
?>
<?php
}
else
{
echo '<div class="unit-centered unit-50">';
echo '<table class="table-stripped">';
</div>
</div>
foreach ($system as $value)
{
echo '<tr><td>'.$value.'</td></tr>';
}
echo '</table>';
echo '</div';
}
?>
</div>
</div>
<script>
$(document).ready(function()
{
$("#jscompleteEmail").on("click", function() {
$("#jsnoCheckEmail").val("1");
if(!$("jspassword").val()) {
$("#jsformInstaller").submit();
}
});
});
</script>
<script>
$(document).ready(function()
{
$("#jscompleteEmail").on("click", function() {
$("#jsnoCheckEmail").val("1");
if(!$("jspassword").val()) {
$("#jsformInstaller").submit();
}
});
});
</script>
</div>
</body>

View File

@ -19,20 +19,21 @@ $layout['parameters'] = implode('/', $explodeSlug);
// Thanks, http://stackoverflow.com/questions/517008/how-to-turn-off-magic-quotes-on-shared-hosting
if ( in_array( strtolower( ini_get( 'magic_quotes_gpc' ) ), array( '1', 'on' ) ) )
{
$_POST = array_map('stripslashes', $_POST);
$_GET = array_map('stripslashes', $_GET);
$_POST = array_map('stripslashes', $_POST);
$_GET = array_map('stripslashes', $_GET);
$_COOKIE = array_map('stripslashes', $_COOKIE);
}
// AJAX
if( $Login->isLogged() && ($layout['slug']==='ajax') )
if( $layout['slug']==='ajax' )
{
// Boot rules
// Ajax doesn't needs load rules
// Load AJAX file
if( Sanitize::pathFile(PATH_AJAX, $layout['parameters'].'.php') )
include(PATH_AJAX.$layout['parameters'].'.php');
if($Login->isLogged())
{
// Load AJAX file
if( Sanitize::pathFile(PATH_AJAX, $layout['parameters'].'.php') ) {
include(PATH_AJAX.$layout['parameters'].'.php');
}
}
}
// ADMIN AREA
else
@ -56,17 +57,20 @@ else
Theme::plugins('beforeAdminLoad');
// Admin theme init.php
if( Sanitize::pathFile(PATH_ADMIN_THEMES, $Site->adminTheme().DS.'init.php') )
if( Sanitize::pathFile(PATH_ADMIN_THEMES, $Site->adminTheme().DS.'init.php') ) {
include(PATH_ADMIN_THEMES.$Site->adminTheme().DS.'init.php');
}
// Load controller
if( Sanitize::pathFile(PATH_ADMIN_CONTROLLERS, $layout['controller'].'.php') )
if( Sanitize::pathFile(PATH_ADMIN_CONTROLLERS, $layout['controller'].'.php') ) {
include(PATH_ADMIN_CONTROLLERS.$layout['controller'].'.php');
}
// Load view and theme
if( Sanitize::pathFile(PATH_ADMIN_THEMES, $Site->adminTheme().DS.$layout['template']) )
if( Sanitize::pathFile(PATH_ADMIN_THEMES, $Site->adminTheme().DS.$layout['template']) ) {
include(PATH_ADMIN_THEMES.$Site->adminTheme().DS.$layout['template']);
}
// Plugins after admin area loaded
Theme::plugins('afterAdminLoad');
}
}

View File

@ -1,14 +1,16 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// Bludit version
define('BLUDIT_VERSION', 'githubVersion');
define('BLUDIT_CODENAME', '');
define('BLUDIT_RELEASE_DATE', '');
// Debug mode
define('DEBUG_MODE', TRUE);
// Turn off all error reporting
error_reporting(0);
// Turn on all error reporting
error_reporting(0); // Turn off all error reporting
if(DEBUG_MODE)
{
// Turn on all error reporting
ini_set("display_errors", 1);
ini_set('display_startup_errors',1);
ini_set("track_errors", 1);
@ -16,35 +18,31 @@ if(DEBUG_MODE)
error_reporting(E_ALL | E_STRICT | E_NOTICE);
}
// Log separator
define('LOG_SEP', ' | ');
// PHP PATHS
// PHP paths
// PATH_ROOT and PATH_BOOT are defined in index.php
define('PATH_LANGUAGES', PATH_ROOT.'languages'.DS);
define('PATH_THEMES', PATH_ROOT.'themes'.DS);
define('PATH_PLUGINS', PATH_ROOT.'plugins'.DS);
define('PATH_KERNEL', PATH_ROOT.'kernel'.DS);
define('PATH_ABSTRACT', PATH_KERNEL.'abstract'.DS);
define('PATH_RULES', PATH_KERNEL.'boot'.DS.'rules'.DS);
define('PATH_HELPERS', PATH_KERNEL.'helpers'.DS);
define('PATH_AJAX', PATH_KERNEL.'ajax'.DS);
define('PATH_JS', PATH_KERNEL.'js'.DS);
define('PATH_CONTENT', PATH_ROOT.'content'.DS);
define('PATH_POSTS', PATH_CONTENT.'posts'.DS);
define('PATH_PAGES', PATH_CONTENT.'pages'.DS);
define('PATH_DATABASES', PATH_CONTENT.'databases'.DS);
define('PATH_PLUGINS_DATABASES', PATH_CONTENT.'databases'.DS.'plugins'.DS);
define('PATH_UPLOADS', PATH_CONTENT.'uploads'.DS);
define('PATH_ADMIN', PATH_ROOT.'admin'.DS);
define('PATH_ADMIN_THEMES', PATH_ADMIN.'themes'.DS);
define('PATH_ADMIN_CONTROLLERS', PATH_ADMIN.'controllers'.DS);
define('PATH_ADMIN_VIEWS', PATH_ADMIN.'views'.DS);
// Log separator
define('LOG_SEP', ' | ');
// JSON pretty print
if(!defined('JSON_PRETTY_PRINT')) {
define('JSON_PRETTY_PRINT', 128);
@ -56,56 +54,52 @@ define('SALT_LENGTH', 8);
// Page brake string
define('PAGE_BREAK', '<!-- pagebreak -->');
// Bludit version
define('BLUDIT_VERSION', 'githubVersion');
define('BLUDIT_CODENAME', '');
define('BLUDIT_RELEASE_DATE', '');
//
// No parent character
define('NO_PARENT_CHAR', '—');
// Post per page on Manage->Posts
define('POSTS_PER_PAGE_ADMIN', 10);
// Multibyte string / UTF-8
define('MB_STRING', extension_loaded('mbstring'));
// Check if JSON encode and decode are enabled.
define('JSON', function_exists('json_encode'));
// TRUE if new posts hand-made set published, or FALSE for draft.
define('HANDMADE_PUBLISHED', true);
// Charset, default UTF-8.
define('CHARSET', 'UTF-8');
// Multibyte string extension loaded.
define('MB_STRING', extension_loaded('mbstring'));
if(MB_STRING)
{
// Tell PHP that we're using UTF-8 strings until the end of the script.
// Set internal character encoding.
mb_internal_encoding(CHARSET);
// Tell PHP that we'll be outputting UTF-8 to the browser.
// Set HTTP output character encoding.
mb_http_output(CHARSET);
}
// Abstract Classes
// Inclde Abstract Classes
include(PATH_ABSTRACT.'dbjson.class.php');
include(PATH_ABSTRACT.'filecontent.class.php');
include(PATH_ABSTRACT.'plugin.class.php');
// Inclde Classes
include(PATH_KERNEL.'dbposts.class.php');
include(PATH_KERNEL.'dbpages.class.php');
include(PATH_KERNEL.'dbusers.class.php');
include(PATH_KERNEL.'dblanguage.class.php');
include(PATH_KERNEL.'dbsite.class.php');
include(PATH_KERNEL.'post.class.php');
include(PATH_KERNEL.'page.class.php');
include(PATH_KERNEL.'url.class.php');
include(PATH_KERNEL.'login.class.php');
include(PATH_KERNEL.'parsedown.class.php');
include(PATH_KERNEL.'security.class.php');
// Helpers Classes
// Include Helpers Classes
include(PATH_HELPERS.'text.class.php');
include(PATH_HELPERS.'log.class.php');
include(PATH_HELPERS.'date.class.php');
@ -132,6 +126,7 @@ $dbUsers = new dbUsers();
$Site = new dbSite();
$Url = new Url();
$Parsedown = new Parsedown();
$Security = new Security();
// HTML PATHs
$base = (dirname(getenv('SCRIPT_NAME'))==DS)?'/':dirname(getenv('SCRIPT_NAME')).'/';
@ -146,7 +141,7 @@ define('HTML_PATH_ADMIN_ROOT', HTML_PATH_ROOT.'admin/');
define('HTML_PATH_UPLOADS', HTML_PATH_ROOT.'content/uploads/');
define('HTML_PATH_PLUGINS', HTML_PATH_ROOT.'plugins/');
// PHP PATHs with dependency
// PHP paths with dependency
define('PATH_THEME', PATH_ROOT.'themes/'.$Site->theme().'/');
// Objects with dependency

View File

@ -74,7 +74,7 @@ function build_page($key)
$user = $dbUsers->getDb( $Page->username() );
$Page->setField('authorFirstName', $user['firstName'], false);
$Page->setField('authorLastName', $user['lastName'], false);
}
@ -167,14 +167,13 @@ if( ($Url->whereAmI()==='page') && ($Url->notFound()===false) )
// Default homepage
if($Url->notFound()===false)
{
if( ($Site->homepage()!=='home') && ($Url->whereAmI()==='home') )
if( Text::isNotEmpty($Site->homepage()) && ($Url->whereAmI()==='home') )
{
$Url->setWhereAmI('page');
$Page = build_page( $Site->homepage() );
if($Page===false)
{
if($Page===false) {
$Url->setWhereAmI('home');
}
}

View File

@ -5,5 +5,3 @@ if($Url->notFound())
{
header('HTTP/1.0 404 Not Found');
}
?>

View File

@ -12,12 +12,14 @@ include(PATH_RULES.'99.themes.php');
Theme::plugins('beforeSiteLoad');
// Theme init.php
if( Sanitize::pathFile(PATH_THEMES, $Site->theme().DS.'init.php') )
if( Sanitize::pathFile(PATH_THEMES, $Site->theme().DS.'init.php') ) {
include(PATH_THEMES.$Site->theme().DS.'init.php');
}
// Theme HTML
if( Sanitize::pathFile(PATH_THEMES, $Site->theme().DS.'index.php') )
if( Sanitize::pathFile(PATH_THEMES, $Site->theme().DS.'index.php') ) {
include(PATH_THEMES.$Site->theme().DS.'index.php');
}
// Plugins after site loaded
Theme::plugins('afterSiteLoad');

View File

@ -4,24 +4,27 @@ class dbLanguage extends dbJSON
{
public $data;
public $db;
public $currentLocale;
function __construct($language)
function __construct($locale)
{
$this->data = array();
$this->db = array();
$this->currentLocale = 'en_US';
// Default language en_US
$filename = PATH_LANGUAGES.'en_US.json';
if(file_exists($filename))
if( Sanitize::pathFile($filename) )
{
$Tmp = new dbJSON($filename, false);
$this->db = array_merge($this->db, $Tmp->db);
}
// User language
$filename = PATH_LANGUAGES.$language.'.json';
if( file_exists($filename) && ($language!=="en_US") )
$filename = PATH_LANGUAGES.$locale.'.json';
if( Sanitize::pathFile($filename) && ($locale!=="en_US") )
{
$this->currentLocale = $locale;
$Tmp = new dbJSON($filename, false);
$this->db = array_merge($this->db, $Tmp->db);
}
@ -30,6 +33,11 @@ class dbLanguage extends dbJSON
unset($this->db['language-data']);
}
public function getCurrentLocale()
{
return $this->currentLocale;
}
// Return the translation, if the translation does'n exist then return the English translation.
public function get($string)
{
@ -73,7 +81,7 @@ class dbLanguage extends dbJSON
return $this->data[$key];
}
return '';
return '';
}
// Returns an array with all dictionaries.

View File

@ -5,14 +5,14 @@ class dbPages extends dbJSON
private $parentKeyList = array();
private $dbFields = array(
'title'=> array('inFile'=>true, 'value'=>''),
'content'=> array('inFile'=>true, 'value'=>''),
'title'=> array('inFile'=>true, 'value'=>''),
'content'=> array('inFile'=>true, 'value'=>''),
'description'=> array('inFile'=>false, 'value'=>''),
'username'=> array('inFile'=>false, 'value'=>''),
'tags'=> array('inFile'=>false, 'value'=>''),
'status'=> array('inFile'=>false, 'value'=>'draft'),
'tags'=> array('inFile'=>false, 'value'=>''),
'status'=> array('inFile'=>false, 'value'=>'draft'),
'unixTimeCreated'=> array('inFile'=>false, 'value'=>0),
'unixTimeModified'=>array('inFile'=>false, 'value'=>0),
'unixTimeModified'=> array('inFile'=>false, 'value'=>0),
'position'=> array('inFile'=>false, 'value'=>0)
);

View File

@ -65,7 +65,7 @@ class Login {
$user = $this->dbUsers->getDb($username);
if($user==false) {
Log::set(__METHOD__.LOG_SEP.'Username not exist: '.$username);
Log::set(__METHOD__.LOG_SEP.'Username does not exist: '.$username);
return false;
}
@ -78,7 +78,7 @@ class Login {
return true;
}
else {
Log::set(__METHOD__.LOG_SEP.'Password are differents.');
Log::set(__METHOD__.LOG_SEP.'Password incorrect.');
}
return false;
@ -113,4 +113,4 @@ class Login {
return Session::destroy();
}
}
}

View File

@ -4,7 +4,8 @@ class Security extends dbJSON
{
private $dbFields = array(
'minutesBlocked'=>5,
'numberFailures'=>10
'numberFailuresAllowed'=>10,
'blackList'=>array()
);
function __construct()
@ -12,14 +13,58 @@ class Security extends dbJSON
parent::__construct(PATH_DATABASES.'security.php');
}
public function isBlocked()
{
$ip = $this->getUserIp();
if(!isset($this->db['blackList'][$ip])) {
return false;
}
$currentTime = time();
$userBlack = $this->db['blackList'][$ip];
$numberFailures = $userBlack['numberFailures'];
$lastFailure = $userBlack['lastFailure'];
// Check if the IP is expired, then is not blocked.
if($currentTime > $lastFailure + ($this->db['minutesBlocked']*60)) {
return false;
}
// The IP has more failures than number of failures, then the IP is blocked.
if($numberFailures >= $this->db['numberFailuresAllowed']) {
Log::set(__METHOD__.LOG_SEP.'IP Blocked:'.$ip);
return true;
}
// Otherwise the IP is not blocked.
return false;
}
public function addLoginFail()
{
$ip = $this->getUserIp();
$currentTime = time();
$numberFailures = 1;
if(isset($this->db['blackList'][$ip]))
{
$userBlack = $this->db['blackList'][$ip];
$lastFailure = $userBlack['lastFailure'];
// Check if the IP is expired, then renew the number of failures.
if($currentTime <= $lastFailure + ($this->db['minutesBlocked']*60))
{
$numberFailures = $userBlack['numberFailures'];
$numberFailures = $numberFailures + 1;
}
}
$this->db['blackList'][$ip] = array('lastFailure'=>$currentTime, 'numberFailures'=>$numberFailures);
Log::set(__METHOD__.LOG_SEP.'Blacklist, IP:'.$ip.', Number of failures:'.$numberFailures);
// Save the database
$this->db[$ip] = (int)$this->db[$ip] + 1;
if( $this->save() === false ) {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.');
return false;
@ -28,6 +73,18 @@ class Security extends dbJSON
return true;
}
public function getNumberFailures($ip=null)
{
if(empty($ip)) {
$ip = $this->getUserIp();
}
if(isset($this->db['blackList'][$ip])) {
$userBlack = $this->db['blackList'][$ip];
return $userBlack['numberFailures'];
}
}
public function getUserIp()
{
// User IP

18
languages/en_US.json Normal file → Executable file
View File

@ -108,7 +108,7 @@
"you-can-choose-the-users-privilege": "You can choose the user's privilege. The editor role only can write pages and posts.",
"email-will-not-be-publicly-displayed": "Email will not be publicly displayed. Recommended for recovery password and notifications.",
"use-this-field-to-name-your-site": "Use this field to name your site, it will appear at the top of every page of your site.",
"use-this-field-to-add-a-catchy-prhase": "Use this field to add a catchy prhase on your site.",
"use-this-field-to-add-a-catchy-phrase": "Use this field to add a catchy phrase on your site.",
"you-can-add-a-site-description-to-provide": "You can add a site description to provide a short bio or description of your site.",
"you-can-add-a-small-text-on-the-bottom": "You can add a small text on the bottom of every page. eg: copyright, owner, dates, etc.",
"number-of-posts-to-show-per-page": "Number of posts to show per page.",
@ -144,6 +144,18 @@
"read-the-documentation-for-more-information": "Read the [documentation](http://docs.bludit.com) for more information",
"share-with-your-friends-and-enjoy": "Share with your friends and enjoy",
"the-page-has-not-been-found": "The page has not been found.",
"error": "Error"
"error": "Error",
"bludit-installer": "Bludit Installer",
"welcome-to-the-bludit-installer": "Welcome to the Bludit installer",
"complete-the-form-choose-a-password-for-the-username-admin": "Complete the form, choose a password for the username « admin »",
"password-visible-field": "Password, visible field!",
"install": "Install",
"choose-your-language": "Choose your language",
"next": "Next",
"the-password-field-is-empty": "The password field is empty",
"your-email-address-is-invalid":"Your email address is invalid.",
"proceed-anyway": "Proceed anyway!",
"drafts":"Drafts",
"ip-address-has-been-blocked": "IP address has been blocked.",
"try-again-in-a-few-minutes": "Try again in a few minutes."
}

133
languages/es_AR.json Normal file → Executable file
View File

@ -3,13 +3,13 @@
{
"native": "Español (Argentina)",
"english-name": "Spanish",
"last-update": "2015-06-28",
"last-update": "2015-08-16",
"author": "Diego",
"email": "",
"website": ""
},
"username": "Usuario",
"username": "Nombre de usuario",
"password": "Contraseña",
"confirm-password": "Confirmar contraseña",
"editor": "Editor",
@ -24,22 +24,22 @@
"content": "Contenido",
"title": "Titulo",
"no-parent": "Sin padre",
"edit-page": "Editar pagina",
"edit-page": "Editar página",
"edit-post": "Editar post",
"add-a-new-user": "Agregar nuevo usuario",
"parent": "Padre",
"friendly-url": "URL Amistosa",
"description": "Descripcion",
"description": "Descripción",
"posted-by": "Publicado por",
"tags": "Etiquetas",
"position": "Posicion",
"position": "Posición",
"save": "Guardar",
"draft": "Borrador",
"delete": "Eliminar",
"registered": "Registrado",
"Notifications": "Notificaciones",
"profile": "Perfil",
"email": "Correo electronico",
"email": "Correo electrónico",
"settings": "Ajustes",
"general": "General",
"advanced": "Avanzado",
@ -52,30 +52,30 @@
"prev-page": "Pag. anterior",
"next-page": "Pag. siguiente",
"configure-plugin": "Configurar plugin",
"confirm-delete-this-action-cannot-be-undone": "Confirmar eliminacion, esta operacion no se puede deshacer.",
"confirm-delete-this-action-cannot-be-undone": "Confirmar eliminación, esta operación no se puede deshacer.",
"site-title": "Titulo del sitio",
"site-slogan": "Slogan del sitio",
"site-description": "Descripcion del sitio",
"footer-text": "Texto de pie de pagina",
"posts-per-page": "Posts por pagina",
"site-description": "Descripción del sitio",
"footer-text": "Texto de pie de página",
"posts-per-page": "Posts por página",
"site-url": "URL del sitio",
"writting-settings": "Ajustes de redaccion",
"writting-settings": "Ajustes de redacción",
"url-filters": "Filtros URL",
"page": "Pagina",
"pages": "Paginas",
"page": "gina",
"pages": "ginas",
"home": "Inicio",
"welcome-back": "Bienvenido",
"language": "Lenguage",
"language": "Lenguaje",
"website": "Sitio web",
"timezone": "Zona horaria",
"locale": "Locale",
"new-post": "Nuevo post",
"new-page": "Nueva pagina",
"html-and-markdown-code-supported": "Codigo HTML y Markdown soportado",
"new-page": "Nueva página",
"html-and-markdown-code-supported": "Código HTML y Markdown soportado",
"manage-posts": "Administrar posts",
"published-date": "Fecha de publicacion",
"modified-date": "Fecha de modificacion",
"empty-title": "Titulo vacio",
"published-date": "Fecha de publicación",
"modified-date": "Fecha de modificación",
"empty-title": "Titulo vacío",
"plugins": "Plugins",
"install-plugin": "Instalar plugin",
"uninstall-plugin": "Desinstalar plugin",
@ -84,65 +84,76 @@
"publish-now": "Publicar",
"first-name": "Nombre",
"last-name": "Apellido",
"bludit-version": "Bludit version",
"bludit-version": "Bludit versión",
"powered-by": "Corriendo con",
"recent-posts": "Posts recientes",
"manage-pages": "Administrar paginas",
"manage-pages": "Administrar páginas",
"advanced-options": "Opciones avanzadas",
"user-deleted": "Usuario eliminado",
"page-added-successfully": "Página agregada con éxito",
"post-added-successfully": "Post agregado con éxito ",
"the-post-has-been-deleted-successfully": "El post fue eliminado con exito",
"the-page-has-been-deleted-successfully": "La pagina fue eliminada con exito",
"username-or-password-incorrect": "Usuario o contraseña icorrectos",
"the-post-has-been-deleted-successfully": "El post fue eliminado con éxito",
"the-page-has-been-deleted-successfully": "La página fue eliminada con éxito",
"username-or-password-incorrect": "Nombre de usuario o contraseña incorrectos",
"database-regenerated": "Base de datos regenerada",
"the-changes-have-been-saved": "Los cambios fueron guardados",
"enable-more-features-at": "Habilitar más funciones en",
"username-already-exists": "El usuario ya existe",
"username-field-is-empty": "El campo usuario esta vacio",
"the-password-and-confirmation-password-do-not-match":"Las contraseña no coiniciden",
"user-has-been-added-successfully": "El usuario fue creado con exito",
"you-do-not-have-sufficient-permissions": "No tiene suficientes permisos para acceder a esta pagina, contacte al administrador.",
"settings-advanced-writting-settings": "Ajustes->Avanzado->Ajustes de redaccion",
"new-posts-and-pages-synchronized": "Nuevos posts y paginas sincronizados.",
"you-can-choose-the-users-privilege": "You can choose the user's privilege. The editor role only can write pages and posts.",
"email-will-not-be-publicly-displayed": "Email will not be publicly displayed. Recommended for recovery password and notifications.",
"use-this-field-to-name-your-site": "Use this field to name your site, it will appear at the top of every page of your site.",
"use-this-field-to-add-a-catchy-prhase": "Use this field to add a catchy prhase on your site.",
"you-can-add-a-site-description-to-provide": "You can add a site description to provide a short bio or description of your site.",
"you-can-add-a-small-text-on-the-bottom": "You can add a small text on the bottom of every page. eg: copyright, owner, dates, etc.",
"number-of-posts-to-show-per-page": "Number of posts to show per page.",
"the-url-of-your-site": "The URL of your site.",
"add-or-edit-description-tags-or": "Add or edit description, tags or modify the friendly URL.",
"select-your-sites-language": "Seleccione el lenguage de su sitio.",
"select-a-timezone-for-a-correct": "Select a timezone for a correct date/time display on your site.",
"you-can-use-this-field-to-define-a-set-of": "You can use this field to define a set of parameters related to the languege, country and special preferences.",
"you-can-modify-the-url-which-identifies":"You can modify the URL which identifies a page or post using human-readable keywords. No more than 150 characters.",
"this-field-can-help-describe-the-content": "This field can help describe the content in a few words. No more than 150 characters.",
"write-the-tags-separeted-by-comma": "Write the tags separeted by comma. eg: tag1, tag2, tag3",
"delete-the-user-and-all-its-posts":"Delete the user and all its posts",
"delete-the-user-and-associate-its-posts-to-admin-user": "Delete the user and associate its posts to admin user",
"username-already-exists": "El nombre de usuario ya existe",
"username-field-is-empty": "El campo nombre de usuario esta vacío",
"the-password-and-confirmation-password-do-not-match": "Las contraseña no coinciden",
"user-has-been-added-successfully": "El usuario fue creado con éxito",
"you-do-not-have-sufficient-permissions": "No tiene suficientes permisos para acceder a esta página, contacte al administrador.",
"settings-advanced-writting-settings": "Ajustes->Avanzado->Ajustes de redacción",
"new-posts-and-pages-synchronized": "Nuevos posts y páginas sincronizados.",
"you-can-choose-the-users-privilege": "Puede elegir los privilegios del usuario. El rol editor solo puede redactar páginas y post.",
"email-will-not-be-publicly-displayed": "El correo electrónico no será visible. Recomendado para recuperar la contraseña y notificaciones.",
"use-this-field-to-name-your-site": "Utilice este campo para nombrar su sitio, aparecerá en la parte superior de cada página de su sitio.",
"use-this-field-to-add-a-catchy-phrase": "Utilice este campo para agregar un slogan a su sitio.",
"you-can-add-a-site-description-to-provide": "Puede agregar una descripción del sitio para proporcionar una breve biografía o descripción de su sitio.",
"you-can-add-a-small-text-on-the-bottom": "Puede agregar un pequeño texto en el pie de página. ej: copyright, autor, fechas, etc.",
"number-of-posts-to-show-per-page": "Numero de posts a mostrar por página.",
"the-url-of-your-site": "URL de su sitio.",
"add-or-edit-description-tags-or": "Agregar o editar la descripción, tags y modificar la URL amigable.",
"select-your-sites-language": "Seleccione el lenguaje de su sitio.",
"select-a-timezone-for-a-correct": "Seleccione la zona horaria para una correcta visualización de las fechas.",
"you-can-use-this-field-to-define-a-set-of": "Puede utilizar este campo para definir un conjunto de parámetros relacionados con el idioma, país y preferencias especiales.",
"you-can-modify-the-url-which-identifies": "Puede modificar la dirección URL que identifica una página o post usando palabras clave legible. No mas de 150 caracteres.",
"this-field-can-help-describe-the-content": "Este campo puede ayudar a describir el contenido en pocas palabras. No mas de 150 caracteres.",
"write-the-tags-separeted-by-comma": "Escribir los tags separados por comas. ej: tag1, tag2, tag3",
"delete-the-user-and-all-its-posts": "Eliminar el usuario y sus posts",
"delete-the-user-and-associate-its-posts-to-admin-user": "Eliminar el usuario y asociar los posts al usuario admin",
"read-more": "Leer mas",
"show-blog": "Mostrar blog",
"default-home-page": "Pagina de inicio predeterminada",
"default-home-page": "gina de inicio predeterminada",
"version": "Version",
"there-are-no-drafts": "No hay borradores.",
"create-a-new-article-for-your-blog":"Create a new article for your blog.",
"create-a-new-page-for-your-website":"Create a new page for your website.",
"invite-a-friend-to-collaborate-on-your-website":"Invite a friend to collaborate on your website.",
"change-your-language-and-region-settings":"Change your language and region settings.",
"create-a-new-article-for-your-blog":"Crear un nuevo articulo para su blog.",
"create-a-new-page-for-your-website":"Crear una nueva página para su sitio web.",
"invite-a-friend-to-collaborate-on-your-website":"Invite a un amigo para colaborar en el sitio web.",
"change-your-language-and-region-settings":"Cambiar la configuración de idioma y región.",
"language-and-timezone":"Lenguage y zona horaria",
"author": "Autor",
"start-here": "Comience aqui",
"start-here": "Comience aquí",
"install-theme": "Instalar tema",
"first-post": "Primer post",
"congratulations-you-have-successfully-installed-your-bludit": "Congratulations you have successfully installed your **Bludit**",
"whats-next": "Que sigue",
"manage-your-bludit-from-the-admin-panel": "Manage your Bludit from the [admin area](./admin/)",
"congratulations-you-have-successfully-installed-your-bludit": "Felicitación, usted ha instalado **Bludit** exitosamente",
"whats-next": "Siguientes pasos",
"manage-your-bludit-from-the-admin-panel": "Administre su Bludit desde el [panel de administración](./admin/)",
"follow-bludit-on": "Siga Bludit en",
"visit-the-support-forum": "Visite el [foro](http://forum.bludit.com) para soporte",
"read-the-documentation-for-more-information": "Lea la [documentacion](http://docs.bludit.com) para mas informacion",
"share-with-your-friends-and-enjoy": "Comparti con tus amigos y a disfrutar",
"the-page-has-not-been-found": "La pagina no fue encontrada.",
"error": "Error"
"read-the-documentation-for-more-information": "Lea la [documentación](http://docs.bludit.com) para mas información",
"share-with-your-friends-and-enjoy": "Compartí con tus amigos y a disfrutar",
"the-page-has-not-been-found": "La página no fue encontrada.",
"error": "Error",
"bludit-installer": "Bludit Instalador",
"welcome-to-the-bludit-installer": "Bienvenido al asistente para la instalación de Bludit",
"complete-the-form-choose-a-password-for-the-username-admin": "Complete el formulario y elija una contraseña para el usuario « admin »",
"password-visible-field": "Contraseña, este campo es visible!",
"install": "Instalar",
"the-password-field-is-empty": "Debe completar el campo contraseña",
"your-email-address-is-invalid":"Su dirección de correo es invalida.",
"proceed-anyway": "Continuar de todas formas!",
"drafts":"Borradores",
"ip-address-has-been-blocked":"La direccion IP fue bloqueada.",
"try-again-in-a-few-minutes": "Vuelva a intentar en unos minutos."
}

2
languages/es_VE.json Normal file → Executable file
View File

@ -111,7 +111,7 @@
"you-can-choose-the-users-privilege": "Usted puede elegir los privilegios del usuario. El papel del editor sólo puede escribir páginas y mensajes.",
"email-will-not-be-publicly-displayed": "El correo electrónico no se mostrará públicamente. Recomendado para notificaciones y recuperación contraseña.",
"use-this-field-to-name-your-site": "Use este campo para el nombre de su sitio, aparecerá en la parte superior de cada página de su sitio.",
"use-this-field-to-add-a-catchy-prhase": "Use este campo para agregar una frase pegadiza en su sitio.",
"use-this-field-to-add-a-catchy-phrase": "Use este campo para agregar una frase pegadiza en su sitio.",
"you-can-add-a-site-description-to-provide": "Puede agregar una descripción del sitio para proporcionar una breve biografía o descripción de su sitio.",
"you-can-add-a-small-text-on-the-bottom": "Puede añadir un pequeño texto en la parte inferior de cada página. por ejemplo: derechos de autor, propietario, fechas, etc.",
"number-of-posts-to-show-per-page": "Número de mensajes a mostrar por página.",

View File

@ -35,7 +35,7 @@
"position": "Position",
"save": "Sauvegarder",
"draft": "Brouillon",
"delete": "Supprimer",
"delete": "Supprimer",
"registered": "Inscrit",
"Notifications": "Notifications",
"profile": "Profil",
@ -108,7 +108,7 @@
"you-can-choose-the-users-privilege": "Vous pouvez choisir les privilèges de lutilisateur. Le rôle en tant que « Rédacteur » permet uniquement de publier des pages et des articles.",
"email-will-not-be-publicly-displayed": "Votre e-mail ne sera pas publié publiquement. Il est nécessaire pour la récupération du mot de passe et recevoir les notifications.",
"use-this-field-to-name-your-site": "Utilisez ce champ pour que le nom de votre site apparaisse en haut de chaque page.",
"use-this-field-to-add-a-catchy-prhase": "Utilisez ce champ pour ajouter une phrase accrocheuse sur votre site.",
"use-this-field-to-add-a-catchy-phrase": "Utilisez ce champ pour ajouter une phrase accrocheuse sur votre site.",
"you-can-add-a-site-description-to-provide": "Vous pouvez ajouter une description du site pour fournir une courte biographie ou la description de votre site.",
"you-can-add-a-small-text-on-the-bottom": "Vous pouvez ajouter un court texte sur le pied de chaque page. par exemple: les droits d'auteurs, propriétaire, dates, etc.",
"number-of-posts-to-show-per-page": "Nombre darticles à afficher par page.",
@ -144,6 +144,10 @@
"read-the-documentation-for-more-information": "Lisez la [documentation](http://docs.bludit.com) pour plus dinformation",
"share-with-your-friends-and-enjoy": "Partagez avec vos amis et apprécier !",
"the-page-has-not-been-found": "La page na pas été trouvée.",
"error": "Erreur"
"error": "Erreur",
"bludit-installer": "Installation de Bludit",
"welcome-to-the-bludit-installer": "Bienvenue dans lassistant dinstallation de Bludit",
"complete-the-form-choose-a-password-for-the-username-admin": "Complétez le formulaire et choisissez un mot de passe pour lutilisateur « admin »",
"password-visible-field": "Mot de passe, champ visible !",
"install": "Installer"
}

0
languages/ja_JP.json Normal file → Executable file
View File

0
languages/ru_RU.json Normal file → Executable file
View File

2
languages/zh_TW.json Normal file → Executable file
View File

@ -108,7 +108,7 @@
"you-can-choose-the-users-privilege": "您可以選擇使用者的權限,作者角色只能撰寫頁面與文章",
"email-will-not-be-publicly-displayed": "Email將不會被公開顯示建議用於復原密碼或是通知",
"use-this-field-to-name-your-site": "使用這個欄位來填寫您的網站名稱,它將會被顯示在每一個頁面的最上方",
"use-this-field-to-add-a-catchy-prhase": "使用這個欄位來幫您的網站添加一個可以朗朗上口的標語吧",
"use-this-field-to-add-a-catchy-phrase": "使用這個欄位來幫您的網站添加一個可以朗朗上口的標語吧",
"you-can-add-a-site-description-to-provide": "您可以新增一段簡短的簡介來介紹您的網站",
"you-can-add-a-small-text-on-the-bottom": "您可以在每一頁的頁尾放置一些短短的文字,例如: 版權、所有人、日期...",
"number-of-posts-to-show-per-page": "每一頁會顯示幾篇文章的數量",

View File

@ -0,0 +1,16 @@
{
"plugin-data":
{
"name": "Disqus comment system",
"description": "Disqus is a blog comment hosting service for web sites. It's necesary to register on Disqus.com before using this plugin.",
"author": "Bludit",
"email": "",
"website": "http://www.bludit.com",
"version": "0.1",
"releaseDate": "2015-08-02"
},
"disqus-shortname": "Disqus shortname",
"enable-disqus-on-pages": "Enable Disqus on pages",
"enable-disqus-on-posts": "Enable Disqus on posts",
"enable-disqus-on-default-home-page": "Enable Disqus on default home page"
}

View File

@ -0,0 +1,16 @@
{
"plugin-data":
{
"name": "Disqus sistema de comentarios",
"description": "Disqus es un servicio de comentarios online. Es necesario registrarse en Disqus.com antes de utilizar este plugin.",
"author": "Bludit",
"email": "",
"website": "http://www.bludit.com",
"version": "0.1",
"releaseDate": "2015-08-17"
},
"disqus-shortname": "Disqus shortname",
"enable-disqus-on-pages": "Habilitar Disqus en las páginas",
"enable-disqus-on-posts": "Habilitar Disqus en los posts",
"enable-disqus-on-default-home-page": "Habilitar Disqus en la página de inicio"
}

124
plugins/disqus/plugin.php Normal file
View File

@ -0,0 +1,124 @@
<?php
class pluginDisqus extends Plugin {
private $disable;
public function init()
{
$this->dbFields = array(
'shortname'=>'',
'enablePages'=>false,
'enablePosts'=>true,
'enableDefaultHomePage'=>false
);
}
function __construct()
{
parent::__construct();
// Disable the plugin IF ...
global $Url;
$this->disable = false;
if( (!$this->getDbField('enablePosts')) && ($Url->whereAmI()=='post') ) {
$this->disable = true;
}
elseif( (!$this->getDbField('enablePages')) && ($Url->whereAmI()=='page') ) {
$this->disable = true;
}
elseif( !$this->getDbField('enableDefaultHomePage') && ($Url->whereAmI()=='page') )
{
global $Page;
global $Site;
if( $Site->homePage()==$Page->key() ) {
$this->disable = true;
}
}
elseif( ($Url->whereAmI()!='post') && ($Url->whereAmI()!='page') ) {
$this->disable = true;
}
}
public function form()
{
global $Language;
$html = '<div>';
$html .= '<label>'.$Language->get('Disqus shortname').'</label>';
$html .= '<input name="shortname" id="jsshortname" type="text" value="'.$this->getDbField('shortname').'">';
$html .= '</div>';
$html .= '<div>';
$html .= '<input name="enablePages" id="jsenablePages" type="checkbox" value="true" '.($this->getDbField('enablePages')?'checked':'').'>';
$html .= '<label class="forCheckbox" for="jsenablePages">'.$Language->get('Enable Disqus on pages').'</label>';
$html .= '</div>';
$html .= '<div>';
$html .= '<input name="enablePosts" id="jsenablePosts" type="checkbox" value="true" '.($this->getDbField('enablePosts')?'checked':'').'>';
$html .= '<label class="forCheckbox" for="jsenablePosts">'.$Language->get('Enable Disqus on posts').'</label>';
$html .= '</div>';
$html .= '<div>';
$html .= '<input name="enableDefaultHomePage" id="jsenableDefaultHomePage" type="checkbox" value="true" '.($this->getDbField('enableDefaultHomePage')?'checked':'').'>';
$html .= '<label class="forCheckbox" for="jsenableDefaultHomePage">'.$Language->get('Enable Disqus on default home page').'</label>';
$html .= '</div>';
return $html;
}
public function postEnd()
{
if( $this->disable ) {
return false;
}
$html = '<div id="disqus_thread"></div>';
return $html;
}
public function pageEnd()
{
if( $this->disable ) {
return false;
}
$html = '<div id="disqus_thread"></div>';
return $html;
}
public function siteHead()
{
if( $this->disable ) {
return false;
}
$html = '<style>#disqus_thread { margin: 20px 0 }</style>';
return $html;
}
public function siteBodyEnd()
{
if( $this->disable ) {
return false;
}
$html = '
<script type="text/javascript">
var disqus_shortname = "'.$this->getDbField('shortname').'";
(function() {
var dsq = document.createElement("script"); dsq.type = "text/javascript"; dsq.async = true;
dsq.src = "//" + disqus_shortname + ".disqus.com/embed.js";
(document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>';
return $html;
}
}

View File

@ -0,0 +1,15 @@
{
"plugin-data":
{
"name": "Modo mantenimiento",
"description": "Configurar el sitio en modo mantenimiento, se puede acceder al panel de administración mientras tanto.",
"author": "Bludit",
"email": "",
"website": "http://www.bludit.com",
"version": "0.1",
"releaseDate": "2015-08-02"
},
"enable-maintence-mode": "Habilitar modo mantenimiento",
"message": "Mensaje"
}

View File

@ -0,0 +1,12 @@
{
"plugin-data":
{
"name": "Open Graph",
"description": "El protocolo Open Graph sirve para publicar contenido en las redes sociales.",
"author": "Bludit",
"email": "",
"website": "http://www.bludit.com",
"version": "0.1",
"releaseDate": "2015-08-02"
}
}

View File

@ -0,0 +1,15 @@
{
"plugin-data":
{
"name": "Listado de páginas",
"description": "Muestra las paginas en orden según la posición.",
"author": "Bludit",
"email": "",
"website": "http://www.bludit.com",
"version": "0.1",
"releaseDate": "2015-08-02"
},
"home": "Página de inicio",
"show-home-link": "Mostrar página de inicio"
}

View File

@ -47,28 +47,28 @@ class pluginPages extends Plugin {
foreach($parents as $parent)
{
if($Site->homepage()!==$parent->key())
//if($Site->homepage()!==$parent->key())
{
// Print the parent
$html .= '<li><a class="parent" href="'.$parent->permalink().'">'.$parent->title().'</a></li>';
$html .= '<li><a class="parent" href="'.$parent->permalink().'">'.$parent->title().'</a>';
// Check if the parent hash children
// Check if the parent has children
if(isset($pagesParents[$parent->key()]))
{
$children = $pagesParents[$parent->key()];
// Print the children
$html .= '<li><ul>';
$html .= '<ul>';
foreach($children as $child)
{
$html .= '<li><a class="children" href="'.$child->permalink().'">'.$child->title().'</a></li>';
$html .= '<li><a class="children" href="'.$child->permalink().'">'.$child->title().'</a></li>';
}
$html .= '</ul></li>';
$html .= '</ul>';
}
}
}
$html .= '</ul>';
$html .= '</li></ul>';
$html .= '</div>';
$html .= '</div>';

View File

@ -0,0 +1,12 @@
{
"plugin-data":
{
"name": "Tinymce",
"description": "Tinymce es un editor HTML, facilita al usuario crear contenido enriquecido.",
"author": "Bludit",
"email": "",
"website": "http://www.bludit.com",
"version": "0.1",
"releaseDate": "2015-08-02"
}
}

View File

@ -64,6 +64,12 @@ code {
letter-spacing: 0.1em;
}
.content {
padding-top: 3em;
margin-right: 30px;
margin-left: 30px;
}
#layout {
padding: 0;
}
@ -268,6 +274,12 @@ div.plugin-content ul > li > ul > li {
margin: 0;
}
div.plugin-content ul > li > ul > li:before {
color: #777;
content: "—";
padding-right: 5px;
}
div.plugin-content ul > li > ul > li > a {
color: #777;
}