diff --git a/admin/controllers/plugins.php b/admin/controllers/plugins.php new file mode 100644 index 00000000..20c8e2fb --- /dev/null +++ b/admin/controllers/plugins.php @@ -0,0 +1,26 @@ +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 +// ============================================================================ \ No newline at end of file diff --git a/admin/themes/default/css/default.css b/admin/themes/default/css/default.css index a8d4dca0..b375a66d 100644 --- a/admin/themes/default/css/default.css +++ b/admin/themes/default/css/default.css @@ -140,6 +140,7 @@ div.dashboardBox .nav { div.dashboardBox .nav a { padding: 0 !important; display: inline-block; + margin-left: 8px; } div.dashboardBox i.iconContent { @@ -154,6 +155,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 +195,7 @@ div.dashboardBox ul.menu li.description:last-child { margin-bottom: 0 !important; } + /* ----------- FORMS ----------- */ form h4 { diff --git a/admin/views/dashboard.php b/admin/views/dashboard.php index f96240a9..f76afbb9 100644 --- a/admin/views/dashboard.php +++ b/admin/views/dashboard.php @@ -63,11 +63,11 @@ { foreach($_draftPosts as $Post) { - echo '
'.$theme['name'].'
'; echo ''.$theme['description'].'
'; diff --git a/kernel/boot/rules/70.build_pages.php b/kernel/boot/rules/70.build_pages.php index d3ea1db0..3ccddac6 100644 --- a/kernel/boot/rules/70.build_pages.php +++ b/kernel/boot/rules/70.build_pages.php @@ -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'); } } diff --git a/kernel/security.class.php b/kernel/security.class.php index 90a7e38c..c4ac5a34 100644 --- a/kernel/security.class.php +++ b/kernel/security.class.php @@ -4,7 +4,8 @@ class Security extends dbJSON { private $dbFields = array( 'minutesBlocked'=>5, - 'numberFailures'=>10 + 'numberFailuresAllowed'=>10, + 'blackList'=>array('numberFailures', 'lastFailure') ); function __construct() @@ -12,14 +13,47 @@ 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']) { + return false; + } + + // The IP has more failures than number of failures, then the IP is blocked. + if($numberFailures >= $this->db['numberFailuresAllowed']) { + 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])) { + $numberFailures = $userBlack['numberFailures']; + $numberFailures = $numberFailures + 1; + } + + $this->db['blackList'][$ip] = array('lastFailure'=>$currentTime, 'numberFailures'=>$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; diff --git a/languages/zh_TW.json b/languages/zh_TW.json new file mode 100644 index 00000000..14c86c8a --- /dev/null +++ b/languages/zh_TW.json @@ -0,0 +1,149 @@ +{ + "language-data": + { + "native": "Traditional Chinese (Taiwan)", + "english-name": "Traditional Chinese", + "last-update": "2015-08-09", + "author": "Ethan Chen", + "email": "ethan42411@gmail.com", + "website": "http://single4.ml" + }, + + "username": "使用者名稱", + "password": "使用者密碼", + "confirm-password": "確認密碼", + "editor": "作者", + "dashboard": "主頁面", + "role": "角色", + "post": "文章", + "posts": "文章", + "users": "使用者", + "administrator": "管理員", + "add": "新增", + "cancel": "取消", + "content": "內容", + "title": "標題", + "no-parent": "沒有繼承頁面", + "edit-page": "編輯頁面", + "edit-post": "編輯文章", + "add-a-new-user": "新增使用者", + "parent": "繼承頁面", + "friendly-url": "友善網址", + "description": "簡介", + "posted-by": "發表由", + "tags": "標籤", + "position": "位置", + "save": "儲存", + "draft": "草稿", + "delete": "刪除", + "registered": "已註冊", + "Notifications": "通知", + "profile": "個人檔案", + "email": "Email", + "settings": "設定", + "general": "一般設定", + "advanced": "進階設定", + "regional": "區域", + "about": "關於", + "login": "登入", + "logout": "登出", + "manage": "管理", + "themes": "佈景主題", + "prev-page": "上一頁", + "next-page": "下一頁", + "configure-plugin": "設定延伸模組", + "confirm-delete-this-action-cannot-be-undone": "確認刪除? 這個動作不可復原", + "site-title": "網站標題", + "site-slogan": "網站標語", + "site-description": "網站簡介", + "footer-text": "頁尾文字", + "posts-per-page": "每頁文章數", + "site-url": "網站網址", + "writting-settings": "撰寫設定", + "url-filters": "網址過濾器", + "page": "頁面", + "pages": "頁面", + "home": "首頁", + "welcome-back": "歡迎回來", + "language": "語言", + "website": "網站", + "timezone": "時區", + "locale": "區域", + "new-post": "新文章", + "html-and-markdown-code-supported": "支援HTML與Markdown程式碼", + "new-page": "新頁面", + "manage-posts": "管理文章", + "published-date": "發表日期", + "modified-date": "修改日期", + "empty-title": "空白標題", + "plugins": "延伸模組", + "install-plugin": "安裝延伸模組", + "uninstall-plugin": "移除延伸模組", + "new-password": "新密碼", + "edit-user": "編輯使用者", + "publish-now": "立即發表", + "first-name": "名", + "last-name": "姓", + "bludit-version": "Bludit版本", + "powered-by": "Powered by", + "recent-posts": "最新文章", + "manage-pages": "管理頁面", + "advanced-options": "進階設定", + "user-deleted": "使用者已刪除", + "page-added-successfully": "頁面已成功新增", + "post-added-successfully": "文章已成功新增", + "the-post-has-been-deleted-successfully": "頁面已成功被刪除", + "the-page-has-been-deleted-successfully": "頁面已成功被刪除", + "username-or-password-incorrect": "使用者帳號或密碼不正確", + "database-regenerated": "資料庫已經重建", + "the-changes-have-been-saved": "變更已經儲存", + "enable-more-features-at": "啟用更多功能在", + "username-already-exists": "使用者名稱已經存在", + "username-field-is-empty": "使用者名稱欄位為空白", + "the-password-and-confirmation-password-do-not-match":"使用者密碼與確認密碼不符", + "user-has-been-added-successfully": "使用者已新增成功", + "you-do-not-have-sufficient-permissions": "您沒有權限存取此頁面,請聯絡管理員", + "settings-advanced-writting-settings": "設定->進階設定->撰寫設定", + "new-posts-and-pages-synchronized": "新文章與頁面已經同步完成", + "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": "使用這個欄位來幫您的網站添加一個可以朗朗上口的標語吧", + "you-can-add-a-site-description-to-provide": "您可以新增一段簡短的簡介來介紹您的網站", + "you-can-add-a-small-text-on-the-bottom": "您可以在每一頁的頁尾放置一些短短的文字,例如: 版權、所有人、日期...", + "number-of-posts-to-show-per-page": "每一頁會顯示幾篇文章的數量", + "the-url-of-your-site": "網站的網址", + "add-or-edit-description-tags-or": "新增或編輯簡介、標籤或是修改友善網址", + "select-your-sites-language": "選擇您所使用的語言", + "select-a-timezone-for-a-correct": "選擇正確的時區來顯示時間", + "you-can-use-this-field-to-define-a-set-of": "您可以使用此欄位來定義相關的語言、國家與特別的參數", + "you-can-modify-the-url-which-identifies":"您可以修改網址來讓文章或頁面的網址可以更接近人類所了解的字詞,不能超過150個字", + "this-field-can-help-describe-the-content": "這個欄位可以幫助快速理解內容,不能超過150個字", + "write-the-tags-separeted-by-comma": "撰寫使用逗號分隔的標籤,例如: 標籤1, 標籤2, 標籤3", + "delete-the-user-and-all-its-posts":"刪除使用者與他所發表的文章", + "delete-the-user-and-associate-its-posts-to-admin-user": "刪除使用者,並將他所發表的文章關連至管理員權限的使用者", + "read-more": "繼續越讀", + "show-blog": "顯示部落格", + "default-home-page": "預設首頁", + "version": "版本", + "there-are-no-drafts": "沒有草稿", + "create-a-new-article-for-your-blog":"為您的網站建立一篇新文章", + "create-a-new-page-for-your-website":"為您的網站建立一個新頁面", + "invite-a-friend-to-collaborate-on-your-website":"邀請朋友來慶祝您的新網站開張", + "change-your-language-and-region-settings":"更改您所使用的語言與地區設定", + "language-and-timezone":"語言與時區", + "author": "作者", + "start-here": "從這裡開始", + "install-theme": "安裝佈景主題", + "first-post": "第一篇文章", + "congratulations-you-have-successfully-installed-your-bludit": "恭喜您已經成功安裝您的**Bludit**", + "whats-next": "接下來", + "manage-your-bludit-from-the-admin-panel": "透過[admin area](./admin/)管理您的Bludit", + "follow-bludit-on": "Follow Bludit on", + "visit-the-support-forum": "拜訪[forum](http://forum.bludit.com)來取得支援", + "read-the-documentation-for-more-information": "閱讀[documentation](http://docs.bludit.com)來獲得更多資訊", + "share-with-your-friends-and-enjoy": "分享給您的朋友們", + "the-page-has-not-been-found": "此頁面不存在", + "error": "錯誤" + +} diff --git a/plugins/disqus/language/en_US.json b/plugins/disqus/language/en_US.json new file mode 100644 index 00000000..fd997417 --- /dev/null +++ b/plugins/disqus/language/en_US.json @@ -0,0 +1,12 @@ +{ + "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" + } +} \ No newline at end of file diff --git a/plugins/disqus/plugin.php b/plugins/disqus/plugin.php new file mode 100644 index 00000000..42f13aae --- /dev/null +++ b/plugins/disqus/plugin.php @@ -0,0 +1,65 @@ +dbFields = array( + 'shortname'=>'' + ); + } + + public function form() + { + global $Language; + + $html = '