Merge branch 'dignajar/master'

This commit is contained in:
Frédéric K 2015-08-20 09:02:16 +02:00
commit e8bcee0383
29 changed files with 502 additions and 247 deletions

View File

@ -8,6 +8,31 @@
// Functions // 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 // Main before POST
// ============================================================================ // ============================================================================
@ -18,15 +43,7 @@
if( $_SERVER['REQUEST_METHOD'] == 'POST' ) if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{ {
// Verify User sanitize the input checkPost($_POST);
if( $Login->verifyUser($_POST['username'], $_POST['password']) )
{
Redirect::page('admin', 'dashboard');
}
else
{
Alert::set($Language->g('Username or password incorrect'));
}
} }
// ============================================================================ // ============================================================================

View File

@ -16,6 +16,10 @@ div.unit-80 {
margin-left: 1% !important; margin-left: 1% !important;
} }
.tools-alert {
text-align: center;
}
/* ----------- FONTS AWESOME ----------- */ /* ----------- FONTS AWESOME ----------- */
.fa-right { .fa-right {
margin-right: 5px; margin-right: 5px;

View File

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

View File

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

View File

@ -2,10 +2,10 @@
<html> <html>
<head> <head>
<base href="<?php echo HTML_PATH_ADMIN_THEME ?>"> <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"> <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/kube.min.css?version=<?php echo BLUDIT_VERSION ?>">
<link rel="stylesheet" href="./css/default.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"> <nav class="navbar nav-fullwidth">
<h1>Bludit</h1> <h1>Bludit</h1>
<ul> <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> </ul>
</nav> </nav>
</div> </div>
@ -31,13 +31,13 @@
<div class="units-row"> <div class="units-row">
<!-- CONTENT --> <!-- CONTENT -->
<div class="unit-centered unit-40" style="max-width: 500px"> <div class="unit-centered unit-40" style="max-width: 400px">
<div id="content"> <div id="content">
<?php <?php
if(Alert::defined()) { 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 // Load view
@ -51,8 +51,6 @@
</div> </div>
<div id="footer">Bludit</div>
<!-- Plugins Login Body Begin --> <!-- Plugins Login Body Begin -->
<?php Theme::plugins('loginBodyEnd') ?> <?php Theme::plugins('loginBodyEnd') ?>

View File

@ -50,7 +50,7 @@
</div> </div>
<div class="dashboardBox"> <div class="dashboardBox">
<h2>Drafts</h2> <h2><?php $Language->p('Drafts') ?></h2>
<div class="content"> <div class="content">
<nav class="nav"> <nav class="nav">
<ul> <ul>

View File

@ -24,7 +24,7 @@
<label> <label>
<?php $Language->p('Site slogan') ?> <?php $Language->p('Site slogan') ?>
<input type="text" name="slogan" class="width-50" value="<?php echo $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>
<label> <label>

View File

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

View File

@ -6,13 +6,14 @@
* Author Diego Najar * Author Diego Najar
* Bludit is opensource software licensed under the MIT license. * Bludit is opensource software licensed under the MIT license.
*/ */
// Security constant // Security constant
define('BLUDIT', true); define('BLUDIT', true);
// Directory separator // Directory separator
define('DS', DIRECTORY_SEPARATOR); define('DS', DIRECTORY_SEPARATOR);
// PATHs // PHP paths
define('PATH_ROOT', __DIR__.DS); define('PATH_ROOT', __DIR__.DS);
define('PATH_CONTENT', PATH_ROOT.'content'.DS); define('PATH_CONTENT', PATH_ROOT.'content'.DS);
define('PATH_POSTS', PATH_CONTENT.'posts'.DS); define('PATH_POSTS', PATH_CONTENT.'posts'.DS);
@ -30,6 +31,9 @@ define('DOMAIN', getenv('HTTP_HOST'));
$base = (dirname(getenv('SCRIPT_NAME'))==DS)?'/':dirname(getenv('SCRIPT_NAME')).'/'; $base = (dirname(getenv('SCRIPT_NAME'))==DS)?'/':dirname(getenv('SCRIPT_NAME')).'/';
define('HTML_PATH_ROOT', $base); define('HTML_PATH_ROOT', $base);
// Log separator
define('LOG_SEP', ' | ');
// JSON // JSON
if(!defined('JSON_PRETTY_PRINT')) { if(!defined('JSON_PRETTY_PRINT')) {
define('JSON_PRETTY_PRINT', 128); define('JSON_PRETTY_PRINT', 128);
@ -38,17 +42,18 @@ if(!defined('JSON_PRETTY_PRINT')) {
// Check if JSON encode and decode are enabled. // Check if JSON encode and decode are enabled.
define('JSON', function_exists('json_encode')); define('JSON', function_exists('json_encode'));
// Multibyte string / UTF-8 // Charset, default UTF-8.
define('MB_STRING', extension_loaded('mbstring'));
define('CHARSET', 'UTF-8'); define('CHARSET', 'UTF-8');
// Multibyte string extension loaded.
define('MB_STRING', extension_loaded('mbstring'));
if(MB_STRING) 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); 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); mb_http_output(CHARSET);
} }
@ -58,15 +63,16 @@ include(PATH_HELPERS.'valid.class.php');
include(PATH_HELPERS.'text.class.php'); include(PATH_HELPERS.'text.class.php');
include(PATH_ABSTRACT.'dbjson.class.php'); include(PATH_ABSTRACT.'dbjson.class.php');
include(PATH_KERNEL.'dblanguage.class.php'); include(PATH_KERNEL.'dblanguage.class.php');
include(PATH_HELPERS.'log.class.php');
// Load language // Load language
$HTTP_ACCEPT_LANGUAGE = Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']); $localeFromHTTP = Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']);
if (file_exists(PATH_LANGUAGES.$HTTP_ACCEPT_LANGUAGE. '.json')) {
$locale = $HTTP_ACCEPT_LANGUAGE; if(isset($_GET['language'])) {
} else { $localeFromHTTP = Sanitize::html($_GET['language']);
$locale = 'en_US';
} }
$Language = new dbLanguage($locale);
$Language = new dbLanguage($localeFromHTTP);
// ============================================================================ // ============================================================================
// FUNCTIONS // FUNCTIONS
@ -152,9 +158,9 @@ function checkSystem()
return $stdOut; return $stdOut;
} }
function install($adminPassword, $email, $locale) function install($adminPassword, $email)
{ {
$Language = new dbLanguage($locale); global $Language;
$stdOut = array(); $stdOut = array();
@ -230,9 +236,9 @@ function install($adminPassword, $email, $locale)
'title'=>'Bludit', 'title'=>'Bludit',
'slogan'=>'cms', 'slogan'=>'cms',
'description'=>'', 'description'=>'',
'footer'=>'©2015', 'footer'=>'',
'language'=>$locale, 'language'=>$Language->getCurrentLocale(),
'locale'=>$locale, 'locale'=>$Language->getCurrentLocale(),
'timezone'=>'UTC', 'timezone'=>'UTC',
'theme'=>'pure', 'theme'=>'pure',
'adminTheme'=>'default', 'adminTheme'=>'default',
@ -267,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_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 // File plugins/pages/db.php
$data = array( $data = array(
'homeLink'=>true, 'homeLink'=>true,
@ -303,16 +319,18 @@ Content:
function checkPOST($args) function checkPOST($args)
{ {
global $Language;
// Check empty password // Check empty password
if(empty($args['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 // Check invalid email
if( !Valid::email($args['email']) && ($args['noCheckEmail']=='0') ) 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 // Sanitize email
@ -356,7 +374,7 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' )
<html lang="en"> <html lang="en">
<head> <head>
<base href="admin/themes/default/"> <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"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo $Language->get('Bludit Installer') ?></title> <title><?php echo $Language->get('Bludit Installer') ?></title>
@ -369,21 +387,37 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' )
</head> </head>
<body> <body>
<div class="units-row"> <div class="units-row">
<div class="unit-centered unit-60"> <div class="unit-centered unit-60">
<div class="main"> <div class="main">
<h1 class="title"><?php echo $Language->get('Bludit Installer') ?></h1>
<p><?php echo $Language->get('Welcome to the Bludit installer') ?></p>
<?php <h1 class="title"><?php echo $Language->get('Bludit Installer') ?></h1>
$system = checkSystem(); <p><?php echo $Language->get('Welcome to the Bludit installer') ?></p>
if(empty($system)) <?php
{
?>
<p><?php echo $Language->get('Complete the form, choose a password for the username « admin »') ?></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 <?php
if(!empty($error)) { if(!empty($error)) {
@ -394,66 +428,68 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' )
<form id="jsformInstaller" method="post" action="" class="forms" autocomplete="off"> <form id="jsformInstaller" method="post" action="" class="forms" autocomplete="off">
<input type="hidden" name="noCheckEmail" id="jsnoCheckEmail" value="0"> <input type="hidden" name="noCheckEmail" id="jsnoCheckEmail" value="0">
<input type="hidden" name="language" id="jslanguage" value="<?php echo $localeFromHTTP ?>">
<label> <label>
<input type="text" value="admin" disabled="disabled" class="width-100"> <input type="text" value="admin" disabled="disabled" class="width-100">
</label> </label>
<label> <label>
<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']:'' ?>"> <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>
<label> <label>
<input type="text" name="email" id="jsemail" placeholder="<?php echo $Language->get('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> </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"> <label for="jslanguage">
<select id="jslanguage" name="language" class="width-100" onchange="this.form.submit()"> <select id="jslanguage" name="language" class="width-100">
<?php <?php
$htmlOptions = getLanguageList(); $htmlOptions = getLanguageList();
foreach($htmlOptions as $locale=>$nativeName) { foreach($htmlOptions as $locale=>$nativeName) {
echo '<option value="'.$locale.'">'.$nativeName.'</option>'; echo '<option value="'.$locale.'"'.( ($localeFromHTTP===$locale)?' selected="selected"':'').'>'.$nativeName.'</option>';
} }
?> ?>
</select> </select>
</label> </label>
<p> <p><button class="btn btn-blue width-100"><?php echo $Language->get('Next') ?></button>
<button class="btn btn-blue width-100"><?php echo $Language->get('Install') ?></button>
</p> </p>
</form> </form>
</div> </div>
<?php
} // END else
?>
<?php </div>
} </div>
else
{
echo '<div class="unit-centered unit-50">';
echo '<table class="table-stripped">';
foreach ($system as $value) <script>
{ $(document).ready(function()
echo '<tr><td>'.$value.'</td></tr>'; {
} $("#jscompleteEmail").on("click", function() {
$("#jsnoCheckEmail").val("1");
echo '</table>'; if(!$("jspassword").val()) {
echo '</div'; $("#jsformInstaller").submit();
} }
?> });
</div> });
</div> </script>
<script>
$(document).ready(function()
{
$("#jscompleteEmail").on("click", function() {
$("#jsnoCheckEmail").val("1");
if(!$("jspassword").val()) {
$("#jsformInstaller").submit();
}
});
});
</script>
</div> </div>
</body> </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 // 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' ) ) ) if ( in_array( strtolower( ini_get( 'magic_quotes_gpc' ) ), array( '1', 'on' ) ) )
{ {
$_POST = array_map('stripslashes', $_POST); $_POST = array_map('stripslashes', $_POST);
$_GET = array_map('stripslashes', $_GET); $_GET = array_map('stripslashes', $_GET);
$_COOKIE = array_map('stripslashes', $_COOKIE); $_COOKIE = array_map('stripslashes', $_COOKIE);
} }
// AJAX // AJAX
if( $Login->isLogged() && ($layout['slug']==='ajax') ) if( $layout['slug']==='ajax' )
{ {
// Boot rules if($Login->isLogged())
// Ajax doesn't needs load rules {
// Load AJAX file
// Load AJAX file if( Sanitize::pathFile(PATH_AJAX, $layout['parameters'].'.php') ) {
if( Sanitize::pathFile(PATH_AJAX, $layout['parameters'].'.php') ) include(PATH_AJAX.$layout['parameters'].'.php');
include(PATH_AJAX.$layout['parameters'].'.php'); }
}
} }
// ADMIN AREA // ADMIN AREA
else else
@ -56,17 +57,20 @@ else
Theme::plugins('beforeAdminLoad'); Theme::plugins('beforeAdminLoad');
// Admin theme init.php // 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'); include(PATH_ADMIN_THEMES.$Site->adminTheme().DS.'init.php');
}
// Load controller // 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'); include(PATH_ADMIN_CONTROLLERS.$layout['controller'].'.php');
}
// Load view and theme // 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']); include(PATH_ADMIN_THEMES.$Site->adminTheme().DS.$layout['template']);
}
// Plugins after admin area loaded // Plugins after admin area loaded
Theme::plugins('afterAdminLoad'); Theme::plugins('afterAdminLoad');
} }

View File

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

View File

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

View File

@ -12,12 +12,14 @@ include(PATH_RULES.'99.themes.php');
Theme::plugins('beforeSiteLoad'); Theme::plugins('beforeSiteLoad');
// Theme init.php // 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'); include(PATH_THEMES.$Site->theme().DS.'init.php');
}
// Theme HTML // 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'); include(PATH_THEMES.$Site->theme().DS.'index.php');
}
// Plugins after site loaded // Plugins after site loaded
Theme::plugins('afterSiteLoad'); Theme::plugins('afterSiteLoad');

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@ class Security extends dbJSON
private $dbFields = array( private $dbFields = array(
'minutesBlocked'=>5, 'minutesBlocked'=>5,
'numberFailuresAllowed'=>10, 'numberFailuresAllowed'=>10,
'blackList'=>array('numberFailures', 'lastFailure') 'blackList'=>array()
); );
function __construct() function __construct()
@ -27,12 +27,13 @@ class Security extends dbJSON
$lastFailure = $userBlack['lastFailure']; $lastFailure = $userBlack['lastFailure'];
// Check if the IP is expired, then is not blocked. // Check if the IP is expired, then is not blocked.
if($currentTime > $lastFailure + $this->db['minutesBlocked']) { if($currentTime > $lastFailure + ($this->db['minutesBlocked']*60)) {
return false; return false;
} }
// The IP has more failures than number of failures, then the IP is blocked. // The IP has more failures than number of failures, then the IP is blocked.
if($numberFailures >= $this->db['numberFailuresAllowed']) { if($numberFailures >= $this->db['numberFailuresAllowed']) {
Log::set(__METHOD__.LOG_SEP.'IP Blocked:'.$ip);
return true; return true;
} }
@ -46,13 +47,23 @@ class Security extends dbJSON
$currentTime = time(); $currentTime = time();
$numberFailures = 1; $numberFailures = 1;
if(isset($this->db['blackList'][$ip])) { if(isset($this->db['blackList'][$ip]))
$numberFailures = $userBlack['numberFailures']; {
$numberFailures = $numberFailures + 1; $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); $this->db['blackList'][$ip] = array('lastFailure'=>$currentTime, 'numberFailures'=>$numberFailures);
Log::set(__METHOD__.LOG_SEP.'Blacklist, IP:'.$ip.', Number of failures:'.$numberFailures);
// Save the database // Save the database
if( $this->save() === false ) { if( $this->save() === false ) {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.'); Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.');
@ -62,6 +73,18 @@ class Security extends dbJSON
return true; 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() public function getUserIp()
{ {
// User IP // User IP

View File

@ -8,12 +8,7 @@
"email": "", "email": "",
"website": "" "website": ""
}, },
"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",
"username": "Username", "username": "Username",
"password": "Password", "password": "Password",
"confirm-password": "Confirm Password", "confirm-password": "Confirm Password",
@ -113,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.", "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.", "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-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-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.", "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.", "number-of-posts-to-show-per-page": "Number of posts to show per page.",
@ -149,6 +144,18 @@
"read-the-documentation-for-more-information": "Read the [documentation](http://docs.bludit.com) for more information", "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", "share-with-your-friends-and-enjoy": "Share with your friends and enjoy",
"the-page-has-not-been-found": "The page has not been found.", "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."
} }

View File

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

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.", "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.", "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-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-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.", "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.", "number-of-posts-to-show-per-page": "Número de mensajes a mostrar por página.",

View File

@ -8,12 +8,7 @@
"email": "", "email": "",
"website": "" "website": ""
}, },
"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",
"username": "Nom dutilisateur", "username": "Nom dutilisateur",
"password": "Mot de passe", "password": "Mot de passe",
"confirm-password": "Confirmation du mot de passe", "confirm-password": "Confirmation du mot de passe",
@ -40,7 +35,7 @@
"position": "Position", "position": "Position",
"save": "Sauvegarder", "save": "Sauvegarder",
"draft": "Brouillon", "draft": "Brouillon",
"delete": "Supprimer", "delete": "Supprimer",
"registered": "Inscrit", "registered": "Inscrit",
"Notifications": "Notifications", "Notifications": "Notifications",
"profile": "Profil", "profile": "Profil",
@ -113,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.", "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.", "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-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-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.", "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.", "number-of-posts-to-show-per-page": "Nombre darticles à afficher par page.",
@ -149,6 +144,10 @@
"read-the-documentation-for-more-information": "Lisez la [documentation](http://docs.bludit.com) pour plus dinformation", "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 !", "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.", "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"
} }

View File

@ -3,7 +3,7 @@
{ {
"native": "Traditional Chinese (Taiwan)", "native": "Traditional Chinese (Taiwan)",
"english-name": "Traditional Chinese", "english-name": "Traditional Chinese",
"last-update": "2015-08-09", "last-update": "2015-08-18",
"author": "Ethan Chen", "author": "Ethan Chen",
"email": "ethan42411@gmail.com", "email": "ethan42411@gmail.com",
"website": "http://single4.ml" "website": "http://single4.ml"
@ -108,7 +108,7 @@
"you-can-choose-the-users-privilege": "您可以選擇使用者的權限,作者角色只能撰寫頁面與文章", "you-can-choose-the-users-privilege": "您可以選擇使用者的權限,作者角色只能撰寫頁面與文章",
"email-will-not-be-publicly-displayed": "Email將不會被公開顯示建議用於復原密碼或是通知", "email-will-not-be-publicly-displayed": "Email將不會被公開顯示建議用於復原密碼或是通知",
"use-this-field-to-name-your-site": "使用這個欄位來填寫您的網站名稱,它將會被顯示在每一個頁面的最上方", "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-site-description-to-provide": "您可以新增一段簡短的簡介來介紹您的網站",
"you-can-add-a-small-text-on-the-bottom": "您可以在每一頁的頁尾放置一些短短的文字,例如: 版權、所有人、日期...", "you-can-add-a-small-text-on-the-bottom": "您可以在每一頁的頁尾放置一些短短的文字,例如: 版權、所有人、日期...",
"number-of-posts-to-show-per-page": "每一頁會顯示幾篇文章的數量", "number-of-posts-to-show-per-page": "每一頁會顯示幾篇文章的數量",
@ -144,6 +144,20 @@
"read-the-documentation-for-more-information": "閱讀[documentation](http://docs.bludit.com)來獲得更多資訊", "read-the-documentation-for-more-information": "閱讀[documentation](http://docs.bludit.com)來獲得更多資訊",
"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": "錯誤",
"bludit-installer": "Bludit 安裝程式",
"welcome-to-the-bludit-installer": "歡迎使用Bludit安裝程式",
"complete-the-form-choose-a-password-for-the-username-admin": "請完成表單,為此使用者名稱 « admin » 設定一下密碼吧",
"password-visible-field": "注意! 密碼是直接顯示",
"install": "安裝",
"choose-your-language": "選擇您所使用的語言",
"next": "下一步",
"the-password-field-is-empty": "密碼欄位是空白的",
"your-email-address-is-invalid":"您所輸入的email是無效的",
"proceed-anyway": "仍然繼續!",
"drafts":"草稿",
"ip-address-has-been-blocked": "IP 位址已被封鎖",
"try-again-in-a-few-minutes": "請過幾分鐘後再試"
} }

View File

@ -8,5 +8,9 @@
"website": "http://www.bludit.com", "website": "http://www.bludit.com",
"version": "0.1", "version": "0.1",
"releaseDate": "2015-08-02" "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"
}

View File

@ -2,48 +2,107 @@
class pluginDisqus extends Plugin { class pluginDisqus extends Plugin {
private $disable;
public function init() public function init()
{ {
$this->dbFields = array( $this->dbFields = array(
'shortname'=>'' '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() public function form()
{ {
global $Language; global $Language;
$html = '<div>'; $html = '<div>';
$html .= '<label>Disqus shortname</label>'; $html .= '<label>'.$Language->get('Disqus shortname').'</label>';
$html .= '<input name="shortname" id="jsshortname" type="text" value="'.$this->getDbField('shortname').'">'; $html .= '<input name="shortname" id="jsshortname" type="text" value="'.$this->getDbField('shortname').'">';
$html .= '</div>'; $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; return $html;
} }
public function postEnd() public function postEnd()
{ {
if( $this->disable ) {
return false;
}
$html = '<div id="disqus_thread"></div>'; $html = '<div id="disqus_thread"></div>';
return $html; return $html;
} }
public function pageEnd() public function pageEnd()
{ {
return $this->postEnd(); if( $this->disable ) {
return false;
}
$html = '<div id="disqus_thread"></div>';
return $html;
} }
public function siteHead() public function siteHead()
{ {
if( $this->disable ) {
return false;
}
$html = '<style>#disqus_thread { margin: 20px 0 }</style>'; $html = '<style>#disqus_thread { margin: 20px 0 }</style>';
return $html; return $html;
} }
public function siteBodyEnd() public function siteBodyEnd()
{ {
global $Url; if( $this->disable ) {
return false;
if( ($Url->whereAmI()!='post') && ($Url->whereAmI()!='page') ) {
return '';
} }
$html = ' $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

@ -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"
}
}