From 5d70ba31711f59efc7227b760e6d1b0d96110f04 Mon Sep 17 00:00:00 2001 From: dignajar Date: Sun, 16 Aug 2015 21:24:22 -0300 Subject: [PATCH 1/8] Installer improves --- admin/themes/default/css/installer.css | 10 +- index.php | 2 +- install.php | 154 +++++++++++++++---------- kernel/boot/init.php | 51 ++++---- kernel/boot/rules/99.header.php | 2 - kernel/dblanguage.class.php | 18 ++- kernel/dbpages.class.php | 10 +- languages/en_US.json | 18 +-- languages/es_AR.json | 8 +- languages/fr_FR.json | 17 ++- 10 files changed, 165 insertions(+), 125 deletions(-) diff --git a/admin/themes/default/css/installer.css b/admin/themes/default/css/installer.css index 988fe753..153f0e5f 100644 --- a/admin/themes/default/css/installer.css +++ b/admin/themes/default/css/installer.css @@ -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; diff --git a/index.php b/index.php index 75f5d69e..6fee318f 100644 --- a/index.php +++ b/index.php @@ -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); diff --git a/install.php b/install.php index 7897f835..00dd9d6b 100755 --- a/install.php +++ b/install.php @@ -6,13 +6,14 @@ * Author Diego Najar * Bludit is opensource software licensed under the MIT license. */ + // Security constant 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); @@ -30,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); @@ -38,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); } @@ -58,15 +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 -$HTTP_ACCEPT_LANGUAGE = Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']); -if (file_exists(PATH_LANGUAGES.$HTTP_ACCEPT_LANGUAGE. '.json')) { - $locale = $HTTP_ACCEPT_LANGUAGE; -} else { - $locale = 'en_US'; +$localeFromHTTP = Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']); + +if(isset($_GET['language'])) { + $localeFromHTTP = Sanitize::html($_GET['language']); } -$Language = new dbLanguage($locale); + +$Language = new dbLanguage($localeFromHTTP); // ============================================================================ // FUNCTIONS @@ -152,9 +158,9 @@ function checkSystem() return $stdOut; } -function install($adminPassword, $email, $locale) +function install($adminPassword, $email) { - $Language = new dbLanguage($locale); + global $Language; $stdOut = array(); @@ -230,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', @@ -303,10 +309,12 @@ Content: function checkPOST($args) { + global $Language; + // Check empty password if(empty($args['password'])) { - return '
The password field is empty
'; + return '
'.$Language->g('The password field is empty').'
'; } // Check invalid email @@ -369,21 +377,37 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' )
-
-
-

get('Bludit Installer') ?>

-

get('Welcome to the Bludit installer') ?>

+
+
- get('Bludit Installer') ?> +

get('Welcome to the Bludit installer') ?>

- if(empty($system)) - { - ?> + get('Complete the form, choose a password for the username « admin »') ?>

+ $system = checkSystem(); -
+ // Missing requirements + if(!empty($system)) + { + echo '
'; + echo ''; + + foreach($system as $value) { + echo ''; + } + + echo '
'.$value.'
'; + echo '
'; + } + // Second step + elseif(isset($_GET['language'])) + { + + ?> +

get('Complete the form choose a password for the username admin') ?>

+ +
+ +

+

+ +
+ +

get('Choose your language') ?>

+ +
+ +
+ -

- +

+ - '; - echo ''; + + - foreach ($system as $value) - { - echo ''; - } - - echo '
'.$value.'
'; - echo ' -
-
- - +
diff --git a/kernel/boot/init.php b/kernel/boot/init.php index 08f30f4b..09814485 100644 --- a/kernel/boot/init.php +++ b/kernel/boot/init.php @@ -1,14 +1,16 @@ '); -// 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'); -// Helpers Classes +// Include Helpers Classes include(PATH_HELPERS.'text.class.php'); include(PATH_HELPERS.'log.class.php'); include(PATH_HELPERS.'date.class.php'); @@ -146,7 +139,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 diff --git a/kernel/boot/rules/99.header.php b/kernel/boot/rules/99.header.php index d67de305..27df4585 100644 --- a/kernel/boot/rules/99.header.php +++ b/kernel/boot/rules/99.header.php @@ -5,5 +5,3 @@ if($Url->notFound()) { header('HTTP/1.0 404 Not Found'); } - -?> diff --git a/kernel/dblanguage.class.php b/kernel/dblanguage.class.php index 4ec34ee2..7da6c0fa 100644 --- a/kernel/dblanguage.class.php +++ b/kernel/dblanguage.class.php @@ -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. diff --git a/kernel/dbpages.class.php b/kernel/dbpages.class.php index 1f47d0e4..70bd7f74 100644 --- a/kernel/dbpages.class.php +++ b/kernel/dbpages.class.php @@ -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) ); diff --git a/languages/en_US.json b/languages/en_US.json index 2e7e3dad..4b703101 100755 --- a/languages/en_US.json +++ b/languages/en_US.json @@ -8,12 +8,7 @@ "email": "", "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", "password": "Password", "confirm-password": "Confirm Password", @@ -149,6 +144,13 @@ "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" } \ No newline at end of file diff --git a/languages/es_AR.json b/languages/es_AR.json index 8fa3d00f..58fe0dba 100755 --- a/languages/es_AR.json +++ b/languages/es_AR.json @@ -144,5 +144,11 @@ "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" + "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" } \ No newline at end of file diff --git a/languages/fr_FR.json b/languages/fr_FR.json index a4faffd0..7ccc65ce 100755 --- a/languages/fr_FR.json +++ b/languages/fr_FR.json @@ -8,12 +8,7 @@ "email": "", "website": "" }, - - "bludit-installer": "Installation de Bludit", - "welcome-to-the-bludit-installer": "Bienvenue dans l’assistant d’installation de Bludit", - "complete-the-form,-choose-a-password-for-the-username-«-admin-»": "Complétez le formulaire et choisissez un mot de passe pour l’utilisateur « admin »", - "password,-visible-field!": "Mot de passe, champ visible !", - "install": "Installer", + "username": "Nom d’utilisateur", "password": "Mot de passe", "confirm-password": "Confirmation du mot de passe", @@ -40,7 +35,7 @@ "position": "Position", "save": "Sauvegarder", "draft": "Brouillon", - "delete": "Supprimer", + "delete": "Supprimer", "registered": "Inscrit", "Notifications": "Notifications", "profile": "Profil", @@ -149,6 +144,10 @@ "read-the-documentation-for-more-information": "Lisez la [documentation](http://docs.bludit.com) pour plus d’information", "share-with-your-friends-and-enjoy": "Partagez avec vos amis et apprécier !", "the-page-has-not-been-found": "La page n’a pas été trouvée.", - "error": "Erreur" - + "error": "Erreur", + "bludit-installer": "Installation de Bludit", + "welcome-to-the-bludit-installer": "Bienvenue dans l’assistant d’installation de Bludit", + "complete-the-form-choose-a-password-for-the-username-admin": "Complétez le formulaire et choisissez un mot de passe pour l’utilisateur « admin »", + "password-visible-field": "Mot de passe, champ visible !", + "install": "Installer" } \ No newline at end of file From b97b26a9778c93f555e2b75402a79ee0148cf9f9 Mon Sep 17 00:00:00 2001 From: dignajar Date: Sun, 16 Aug 2015 23:33:49 -0300 Subject: [PATCH 2/8] Installer improves --- admin/views/dashboard.php | 2 +- admin/views/settings.php | 2 +- index.php | 6 +- install.php | 2 +- kernel/boot/admin.php | 18 +++-- kernel/boot/site.php | 6 +- languages/en_US.json | 6 +- languages/es_AR.json | 105 +++++++++++++++-------------- languages/es_VE.json | 2 +- languages/fr_FR.json | 2 +- languages/zh_TW.json | 2 +- plugins/disqus/language/en_US.json | 6 +- plugins/disqus/plugin.php | 33 +++++++-- 13 files changed, 115 insertions(+), 77 deletions(-) diff --git a/admin/views/dashboard.php b/admin/views/dashboard.php index f76afbb9..9e159b1c 100644 --- a/admin/views/dashboard.php +++ b/admin/views/dashboard.php @@ -50,7 +50,7 @@
-

Drafts

+

p('Drafts') ?>

@@ -31,13 +31,13 @@
-
+
'.Alert::get().'
'; + echo '
'.Alert::get().'
'; } // Load view @@ -51,8 +51,6 @@
- - diff --git a/install.php b/install.php index d5e6fda8..6c937ad6 100755 --- a/install.php +++ b/install.php @@ -273,6 +273,16 @@ function install($adminPassword, $email) 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, @@ -364,7 +374,7 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' ) - + <?php echo $Language->get('Bludit Installer') ?> @@ -390,7 +400,7 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' ) // Missing requirements if(!empty($system)) { - echo '
'; + echo '
'; echo ''; foreach($system as $value) { diff --git a/kernel/boot/admin.php b/kernel/boot/admin.php index 954de147..3f7e2719 100644 --- a/kernel/boot/admin.php +++ b/kernel/boot/admin.php @@ -25,14 +25,14 @@ if ( in_array( strtolower( ini_get( 'magic_quotes_gpc' ) ), array( '1', 'on' ) ) } // AJAX -if( $Login->isLogged() && ($layout['slug']==='ajax') ) +if( $layout['slug']==='ajax' ) { - // Boot rules - // Ajax doesn't 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 @@ -73,4 +73,4 @@ else // Plugins after admin area loaded Theme::plugins('afterAdminLoad'); -} +} \ No newline at end of file diff --git a/kernel/boot/init.php b/kernel/boot/init.php index 09814485..afd5c70a 100644 --- a/kernel/boot/init.php +++ b/kernel/boot/init.php @@ -97,6 +97,7 @@ 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'); // Include Helpers Classes include(PATH_HELPERS.'text.class.php'); @@ -125,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')).'/'; diff --git a/kernel/login.class.php b/kernel/login.class.php index d55d118b..476c09cb 100644 --- a/kernel/login.class.php +++ b/kernel/login.class.php @@ -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(); } -} +} \ No newline at end of file diff --git a/kernel/security.class.php b/kernel/security.class.php index c4ac5a34..7fe3be21 100644 --- a/kernel/security.class.php +++ b/kernel/security.class.php @@ -5,7 +5,7 @@ class Security extends dbJSON private $dbFields = array( 'minutesBlocked'=>5, 'numberFailuresAllowed'=>10, - 'blackList'=>array('numberFailures', 'lastFailure') + 'blackList'=>array() ); function __construct() @@ -27,12 +27,13 @@ class Security extends dbJSON $lastFailure = $userBlack['lastFailure']; // 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; } // 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; } @@ -46,13 +47,23 @@ class Security extends dbJSON $currentTime = time(); $numberFailures = 1; - if(isset($this->db['blackList'][$ip])) { - $numberFailures = $userBlack['numberFailures']; - $numberFailures = $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 if( $this->save() === false ) { Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.'); diff --git a/languages/en_US.json b/languages/en_US.json index 6fdec683..23d306a8 100755 --- a/languages/en_US.json +++ b/languages/en_US.json @@ -155,5 +155,7 @@ "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" + "drafts":"Drafts", + "ip-address-has-been-blocked": "IP address has been blocked.", + "try-again-in-a-few-minutes": "Try again in a few minutes." } \ No newline at end of file diff --git a/languages/es_AR.json b/languages/es_AR.json index 8c8d6dc1..6d5643ab 100755 --- a/languages/es_AR.json +++ b/languages/es_AR.json @@ -153,5 +153,7 @@ "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" + "drafts":"Borradores", + "ip-address-has-been-blocked":"La direccion IP fue bloqueada.", + "try-again-in-a-few-minutes": "Vuelva a intentar en unos minutos." } \ No newline at end of file From 9d3de43d9ee7089e2e17f0fcf743a145acf3aa8d Mon Sep 17 00:00:00 2001 From: dignajar Date: Mon, 17 Aug 2015 23:18:57 -0300 Subject: [PATCH 7/8] Bruteforce protection --- kernel/security.class.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kernel/security.class.php b/kernel/security.class.php index 7fe3be21..3761a1e4 100644 --- a/kernel/security.class.php +++ b/kernel/security.class.php @@ -73,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 From c22730bc5f936a50b593a1222e827c38a6c93133 Mon Sep 17 00:00:00 2001 From: Ethan Chen Date: Tue, 18 Aug 2015 13:33:59 +0800 Subject: [PATCH 8/8] Update zh_TW.json Update for Bruteforce protection and Check lang in install. --- languages/zh_TW.json | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/languages/zh_TW.json b/languages/zh_TW.json index 6dc3009e..c2db7456 100755 --- a/languages/zh_TW.json +++ b/languages/zh_TW.json @@ -3,7 +3,7 @@ { "native": "Traditional Chinese (Taiwan)", "english-name": "Traditional Chinese", - "last-update": "2015-08-09", + "last-update": "2015-08-18", "author": "Ethan Chen", "email": "ethan42411@gmail.com", "website": "http://single4.ml" @@ -144,6 +144,20 @@ "read-the-documentation-for-more-information": "閱讀[documentation](http://docs.bludit.com)來獲得更多資訊", "share-with-your-friends-and-enjoy": "分享給您的朋友們", "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": "請過幾分鐘後再試" + }