Compare commits

..

60 Commits
master ... v1.6

Author SHA1 Message Date
Diego Najar 4e14bbac29 Merge pull request #445 from aleksei86/patch-2
Update en_US.json
2017-07-16 01:29:39 +02:00
Diego Najar 33c7b99fc6 Merge pull request #444 from aleksei86/patch-1
Create ru_RU.json
2017-07-16 01:29:27 +02:00
Aleksei Babii 0039bde2d5 Update en_US.json 2017-07-09 10:09:50 +03:00
Aleksei Babii 507d93cdd1 Create ru_RU.json 2017-07-09 10:03:24 +03:00
Diego Najar d17550c736 1.6.2 2017-05-27 14:10:14 +02:00
Diego Najar 7c4a0cb8b2 Merge pull request #439 from clickwork-git/master
Compatibility 1.6.1, 1.6.2
2017-05-27 13:44:06 +02:00
Edi e11fc74b88 Update metadata.json 2017-05-26 13:34:05 +02:00
Edi f8047b9b57 Update metadata.json 2017-05-26 13:33:29 +02:00
Edi bacf14f43a Update metadata.json 2017-05-26 13:32:53 +02:00
Edi 769a1445a6 Update metadata.json 2017-05-26 13:32:17 +02:00
Edi 8c4514675e Update metadata.json 2017-05-26 13:31:40 +02:00
Edi 42e780bc54 Update metadata.json 2017-05-26 13:31:00 +02:00
Edi 96f4f2f14f Update metadata.json 2017-05-26 13:30:26 +02:00
Edi 94f983da45 Update metadata.json 2017-05-26 13:29:44 +02:00
Edi 4df513ca4b Update metadata.json 2017-05-26 13:29:02 +02:00
Edi f981e893c5 Update metadata.json 2017-05-26 13:28:25 +02:00
Edi 423abcc37a Update metadata.json 2017-05-26 13:27:45 +02:00
Edi b8535d5f4e Update metadata.json 2017-05-26 13:27:09 +02:00
Edi 8157c2d6f1 Update metadata.json 2017-05-26 13:26:20 +02:00
Edi 84727dc995 Merge pull request #1 from dignajar/master
Pull request
2017-05-26 13:23:59 +02:00
Diego Najar 63e7798c15 Paypal link updated 2017-05-24 21:17:56 +02:00
Diego Najar a6f8a43f4c Merge pull request #438 from anaggh/master
Fix bug
2017-05-22 21:24:56 +02:00
anaggh 961d5bda89 Fix bug
Fixes: Fatal Error - Cannot access dashboard after updating from v1.5.2
to v1.6
2017-05-22 12:59:36 +05:30
Diego Najar bc3371ee43 Persian language updated 2017-05-21 23:05:02 +02:00
Diego Najar c174cfaa67 Merge pull request #437 from clickwork-git/master
Correction of typo
2017-05-21 22:53:32 +02:00
Edi 668570c99a Correction of typo 2017-05-21 22:44:37 +02:00
Diego Najar 68cbb031d1 Merge pull request #436 from clickwork-git/master
Responsive sidebar for settings
2017-05-21 22:02:34 +02:00
Edi eb7faaf993 Responsive sidebar for settings 2017-05-21 18:09:29 +02:00
Diego Najar 5efc1fc55e Merge pull request #435 from clickwork-git/master
Phrase "content-here-supports-markdown-and-html-code"
2017-05-21 12:29:21 +02:00
Edi 433593308a Update es_AR.json 2017-05-20 21:14:50 +02:00
Edi 4f92dd7239 Update es_AR.json 2017-05-20 21:14:08 +02:00
Edi 521acbc8b8 Update en_US.json 2017-05-20 21:13:12 +02:00
Edi 61a8f578b2 Update en_US.json 2017-05-20 21:12:32 +02:00
Edi 81f259034c Update de_CH.json 2017-05-20 21:11:32 +02:00
Edi e4609e5ed1 Update de_DE.json 2017-05-20 21:10:50 +02:00
Diego Najar a5418b8731 Build version updated 2017-05-20 11:58:58 +02:00
Diego Najar 849ccbabd3 Spanish dictionary updated 2017-05-20 11:53:22 +02:00
Diego Najar 40147ec634 Update UUID and fixed #432 2017-05-20 11:24:38 +02:00
Diego Najar 7f9094b25b Update UUID 2017-05-20 11:17:16 +02:00
Diego Najar 210f4c92d4 Fixed #429 2017-05-15 23:18:24 +02:00
Diego Najar eae8975cec Merge pull request #428 from clickwork-git/master
Additions language files
2017-05-15 13:33:39 +02:00
Edi e98a720d60 Update fr_FR.json 2017-05-15 01:31:11 +02:00
Edi b24d9df986 Update de_CH.json 2017-05-14 01:20:51 +02:00
Edi 96d4bd4bce Update de_DE.json 2017-05-14 01:19:39 +02:00
Edi 0565b670dc Update de_CH.json 2017-05-14 01:16:24 +02:00
Edi d76ed0c661 Merge pull request #6 from dignajar/master
Pull request
2017-05-14 01:12:08 +02:00
Diego Najar ce8b771300 Merge pull request #427 from tranduyhung/vietnamese-slug
Added Vietnamese characters
2017-05-11 15:42:17 +02:00
Diego Najar 62581f5f85 Plugins updated 2017-05-10 21:27:18 +02:00
Tran Duy Hung 08f3329d68 Added Vietnamese characters 2017-05-10 21:30:52 +07:00
Diego 78b14c7104 fixes for #426 2017-05-08 19:52:47 +02:00
Diego Najar 03929da6a0 Merge pull request #415 from xm74/patch-2
update to 1.6-beta
2017-05-07 15:54:02 +02:00
Diego Najar 706c41a59a Merge pull request #421 from atombugtrackdev/patch-1
Update Italian translation
2017-05-07 15:53:49 +02:00
Diego Najar 1c8c25f1ce Merge pull request #425 from clickwork-git/master
Translation of new phrases
2017-05-07 15:53:33 +02:00
Edi c7e2a8ae22 New phrases 1.6 2017-05-07 13:27:52 +02:00
Edi e922cbf271 New phrases 1.6 2017-05-07 13:26:57 +02:00
Edi 5b3facb24f Merge pull request #5 from dignajar/master
Pull request
2017-05-07 13:23:29 +02:00
atombugtrackdev 60b5901729 Update translation 2017-04-30 12:10:56 +02:00
Max Kostikov daf1be59d0 Update ru_RU.json 2017-04-28 15:53:22 +02:00
Max Kostikov 69341290bf Update ru_RU.json 2017-04-27 17:01:39 +02:00
Max Kostikov 518b43d26c update to 1.6-beta 2017-04-27 14:30:00 +02:00
824 changed files with 26150 additions and 39965 deletions

View File

@ -1,16 +0,0 @@
### Describe your problem
Complete here.
### Steps to reproduce the problem
Complete here.
### Bludit version
Complete here.
### PHP version
If you do not know delete this line.
### PHP logs
If you do not know delete this line.
The default settings of the PHP Error Log file varies from OS to OS. The location of the error log file itself can be set manually in the php.ini file. On a Windows server, in IIS, it may be something like `error_log = C:\log_files\php_errors.log` in Linux it may be a value of `/var/log/php_errors.log`.

33
.gitignore vendored
View File

@ -1,30 +1,5 @@
.DS_Store
dbgenerator.php
bl-content/*
bl-content-migrator
bl-plugins/timemachine
bl-plugins/timemachine-x
bl-plugins/discovery
bl-plugins/updater
bl-plugins/medium-editor
bl-plugins/quill
bl-plugins/yandex-metrica/
bl-plugins/domain-migrator/
bl-plugins/tail-writer/
bl-kernel/bludit.pro.php
bl-kernel/admin/themes/gris
bl-themes/docs
bl-themes/typerite
bl-themes/docsx
bl-themes/editorial
bl-themes/mediumish
bl-themes/clean-blog
bl-themes/grayscale
bl-themes/massively
bl-themes/hyperspace
bl-themes/striped
bl-themes/log
bl-themes/micro
bl-themes/tagg
bl-themes/future-imperfect
bl-themes/social-network
bl-content/databases
bl-content/pages
bl-content/posts
bl-content/uploads

View File

@ -5,15 +5,11 @@ AddDefaultCharset UTF-8
# Enable rewrite rules
RewriteEngine on
# Base directory
#RewriteBase /
# Deny direct access to the next directories
RewriteRule ^bl-content/(databases|workspaces|pages|tmp)/.*$ - [R=404,L]
# Deny direct access to .txt files
RewriteRule ^bl-content/(.*)\.txt$ - [R=404,L]
# All URL process by index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [PT,L]
</IfModule>

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2015-2020 Diego Najar
Copyright (c) 2015-2017 Diego Najar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,69 +1,51 @@
[Bludit](https://www.bludit.com/)
================================
**Simple**, **Fast** and **Flexible** CMS.
**Fast**, **simple**, **extensible** and **flat file** CMS.
Bludit is a web application to build your own **website** or **blog** in seconds, it's completely **free and open source**. Bludit uses files in JSON format to store the content, you don't need to install or configure a database. You only need a web server with PHP support.
Bludit is a **Flat-File** CMS.
Bludit supports **Markdown** and **HTML code** for the content.
Bludit is a simple web application to make your own **blog** or **site** in seconds, it's completely **free and open source**. Bludit uses flat-files to store the posts and pages, you don't need to install or configure a database. Bludit supports **Markdown** and HTML code for the content of the posts and pages.
- [Documentation](https://docs.bludit.com)
- [Help and Support](https://forum.bludit.com)
- [Plugins](https://plugins.bludit.com)
- [Themes](https://themes.bludit.com)
- [Documentation](https://docs.bludit.com)
- Help and Support [Forum](https://forum.bludit.org) and [Chat](https://gitter.im/bludit/support)
- [More plugins and themes](https://forum.bludit.com/viewforum.php?f=14)
Follow Bludit
[![Donate](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.me/bludit)
Social networks
---------------
- [Blog](https://blog.bludit.com)
- [Twitter](https://twitter.com/bludit)
- [Facebook](https://www.facebook.com/bluditcms)
- [Youtube](https://www.youtube.com/c/Bluditcms)
- [Google+](https://plus.google.com/+Bluditcms)
- [Freenode IRC](https://webchat.freenode.net) channel **#bludit**
[![Join the chat at https://gitter.im/dignajar/bludit](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dignajar/bludit?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Requirements
------------
You just need a web server with PHP support.
- PHP v5.6 or higher.
- PHP v5.3 or higher.
- PHP [mbstring](http://php.net/manual/en/book.mbstring.php) module for full UTF-8 support.
- PHP [gd](http://php.net/manual/en/book.image.php) module for image processing.
- PHP [dom](http://php.net/manual/en/book.dom.php) module for DOM manipulation.
- PHP [json](http://php.net/manual/en/book.json.php) module for JSON manipulation.
- Supported web servers:
* Bludit supports almost every web server
* PHP Built-in web server (`php -S localhost:8000`)
* PHP Built-in web server
* Apache with module [mod_rewrite](http://httpd.apache.org/docs/current/mod/mod_rewrite.html)
* Lighttpd with module [mod_rewrite](http://redmine.lighttpd.net/projects/1/wiki/docs_modrewrite)
* Nginx with module [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html)
* Other
Installation Guide
Installation guide
------------------
1. Download the latest version from the official page. [Bludit.com](https://www.bludit.com)
1. Download the latest version from https://s3.amazonaws.com/bludit-s3/bludit-builds/bludit_latest.zip
2. Extract the zip file into a directory like `bludit`.
3. Upload the directory `bludit` to your web server or hosting.
4. Visit your domain https://example.com/bludit/
5. Follow the Bludit Installer to configure the website.
Docker Image
------------
Official Docker image on Docker Hub.
- https://hub.docker.com/r/bludit/docker/
Also we provide Kubernetes deployments yaml files.
- https://github.com/bludit/docker/tree/master/kubernetes
Support Bludit!
-------
Bludit is open soruce and free, but if you really like the project and is useful for your you can contribute in [Patreon](https://www.patreon.com/bePatron?c=921115&rid=2458860), also for the supporters we provide Bludit PRO.
[![Bludit PRO](https://img.shields.io/badge/Bludit-PRO-blue.svg)](https://pro.bludit.com/)
### Golden sponsors in Patreon!
- <a href="https://www.patreon.com/clickwork" target="_blank">Clickwork</a>
- <a href="https://www.patreon.com/user/creators?u=10331784" target="_blank">KreativMind</a>
- <a href="https://www.patreon.com/user/creators?u=12261033" target="_blank">Jan Rippl</a>
- <a href="https://www.patreon.com/user/creators?u=28428918" target="_blank">Curious Activity</a>
3. Upload the directory `bludit` to your hosting server.
4. Done!
License
-------

View File

@ -0,0 +1,357 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
class Content {
public $vars;
function __construct($path)
{
if($this->build($path)===false) {
$this->vars = false;
}
}
// Return TRUE if the content is loaded correctly
public function isValid()
{
return($this->vars!==false);
}
// Returns the value from the $field, FALSE if the field doesn't exist
public function getField($field)
{
if(isset($this->vars[$field])) {
return $this->vars[$field];
}
return false;
}
// Set a value to a field
public function setField($field, $value, $overwrite=true)
{
if($overwrite || empty($this->vars[$field])) {
$this->vars[$field] = $value;
}
return true;
}
// Parse the content from the file index.txt
private function build($path)
{
if( !Sanitize::pathFile($path.FILENAME) ) {
return false;
}
$tmp = 0;
$lines = file($path.FILENAME);
foreach($lines as $lineNumber=>$line)
{
$parts = array_map('trim', explode(':', $line, 2));
// Lowercase variable
$parts[0] = Text::lowercase($parts[0]);
// If variables is content then break the foreach and process the content after.
if($parts[0]==='content')
{
$tmp = $lineNumber;
break;
}
if( !empty($parts[0]) && !empty($parts[1]) ) {
// Sanitize all fields, except Content.
$this->vars[$parts[0]] = Sanitize::html($parts[1]);
}
}
// Process the content.
if($tmp!==0)
{
// Next line after "Content:" variable
$tmp++;
// Remove lines after Content
$output = array_slice($lines, $tmp);
if(!empty($parts[1])) {
array_unshift($output, "\n");
array_unshift($output, $parts[1]);
}
$implode = implode($output);
$this->vars['content'] = $implode;
// Sanitize content.
//$this->vars['content'] = Sanitize::html($implode);
}
}
// Returns the title field
public function title()
{
return $this->getField('title');
}
// Returns the content
// This content is markdown parser
// (boolean) $fullContent, TRUE returns all content, if FALSE returns the first part of the content
// (boolean) $noSanitize, TRUE returns the content without sanitized
public function content($fullContent=true, $noSanitize=true)
{
// This content is not sanitized.
$content = $this->getField('content');
if(!$fullContent) {
$content = $this->getField('breakContent');
}
if($noSanitize) {
return $content;
}
return Sanitize::html($content);
}
// Returns the content
// This content is not markdown parser
// (boolean) $noSanitize, TRUE returns the content without sanitized
public function contentRaw($noSanitize=true)
{
// This content is not sanitized.
$content = $this->getField('contentRaw');
if($noSanitize) {
return $content;
}
return Sanitize::html($content);
}
// Returns TRUE if the content has the text splited
public function readMore()
{
return $this->getField('readMore');
}
//
public function category()
{
return $this->getField('category');
}
public function uuid()
{
return $this->getField('uuid');
}
// Returns the field key
public function key()
{
return $this->getField('key');
}
// Returns TRUE if the post/page is published, FALSE otherwise.
public function published()
{
return ($this->getField('status')==='published');
}
// Returns TRUE if the post/page is scheduled, FALSE otherwise.
public function scheduled()
{
return ($this->getField('status')==='scheduled');
}
// Returns TRUE if the post/page is draft, FALSE otherwise.
public function draft()
{
return ($this->getField('status')=='draft');
}
// Returns the file name of the cover image, FALSE there isn't a cover image setted
// (boolean) $absolute, TRUE returns the absolute path and file name, FALSE just the file name
public function coverImage($absolute=true)
{
$fileName = $this->getField('coverImage');
if(empty($fileName)) {
return false;
}
if($absolute) {
return HTML_PATH_UPLOADS.$fileName;
}
return $fileName;
}
/*
DEPRECATED ?
public function profilePicture()
{
return HTML_PATH_UPLOADS_PROFILES.$this->username().'.jpg';
}
*/
// Returns the user object
// (boolean) $field, TRUE returns the value of the field, FALSE returns the object
public function user($field=false)
{
// Get the user object.
$User = $this->getField('user');
if($field) {
return $User->getField($field);
}
return $User;
}
// Returns the username who created the post/page
public function username()
{
return $this->getField('username');
}
// Returns the description field
public function description()
{
return $this->getField('description');
}
// Returns the date according to locale settings and format settings
public function date()
{
return $this->getField('date');
}
// Returns the date according to locale settings and format as database stored
// (string) $format, you can specify the date format
public function dateRaw($format=false)
{
$date = $this->getField('dateRaw');
if($format) {
return Date::format($date, DB_DATE_FORMAT, $format);
}
return $date;
}
// Returns relative time (e.g. "1 minute ago")
// Based on http://stackoverflow.com/a/18602474
// Modified for Bludit
// $complete = false : short version
// $complete = true : full version
public function relativeTime($complete = false) {
$current = new DateTime;
$past = new DateTime($this->getField('date'));
$elapsed = $current->diff($past);
$elapsed->w = floor($elapsed->d / 7);
$elapsed->d -= $elapsed->w * 7;
$string = array(
'y' => 'year',
'm' => 'month',
'w' => 'week',
'd' => 'day',
'h' => 'hour',
'i' => 'minute',
's' => 'second',
);
foreach($string as $key => &$value) {
if($elapsed->$key) {
$value = $elapsed->$key . ' ' . $value . ($elapsed->$key > 1 ? 's' : ' ');
} else {
unset($string[$key]);
}
}
if(!$complete) {
$string = array_slice($string, 0 , 1);
}
return $string ? implode(', ', $string) . ' ago' : 'Just now';
}
// Returns the tags
// (boolean) $returnsArray, TRUE to get the tags as an array, FALSE to get the tags separeted by comma
public function tags($returnsArray=false)
{
global $Url;
$tags = $this->getField('tags');
if($returnsArray) {
if($tags==false) {
return array();
}
return $tags;
}
else {
if($tags==false) {
return false;
}
// Return string with tags separeted by comma.
return implode(', ', $tags);
}
}
// Returns the permalink
// (boolean) $absolute, TRUE returns the post/page link with the DOMAIN, FALSE without the DOMAIN
public function permalink($absolute=false)
{
global $Url;
global $Site;
$filterType = $this->getField('filterType');
$url = trim(DOMAIN_BASE,'/');
$key = $this->key();
$filter = trim($Url->filters($filterType), '/');
$htmlPath = trim(HTML_PATH_ROOT,'/');
if(empty($filter)) {
$tmp = $key;
}
else {
$tmp = $filter.'/'.$key;
}
if($absolute) {
return $url.'/'.$tmp;
}
if(empty($htmlPath)) {
return '/'.$tmp;
}
return '/'.$htmlPath.'/'.$tmp;
}
public function json($returnsArray=false)
{
$tmp['key'] = $this->key();
$tmp['title'] = $this->title();
$tmp['content'] = $this->content(); // Markdown parsed
$tmp['contentRaw'] = $this->contentRaw(); // No Markdown parsed
$tmp['description'] = $this->description();
$tmp['date'] = $this->dateRaw();
$tmp['permalink'] = $this->permalink(true);
if($returnsArray) {
return $tmp;
}
return json_encode($tmp);
}
}

View File

@ -1,14 +1,14 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
class dbJSON {
class dbJSON
{
public $db;
public $dbBackup;
public $file;
public $firstLine;
// $file, the JSON file.
// $firstLine, TRUE if you want to remove the first line, FALSE otherwise
// $firstLine, TRUE if you want to remove the first line, FALSE otherwise.
function __construct($file, $firstLine=true)
{
$this->file = $file;
@ -16,24 +16,26 @@ class dbJSON {
$this->dbBackup = array();
$this->firstLine = $firstLine;
if (file_exists($file)) {
// Read JSON file
if(file_exists($file))
{
// Read JSON file.
$lines = file($file);
// Remove the first line, the first line is for security reasons
if ($firstLine) {
// Remove the first line, the first line is for security reasons.
if($firstLine) {
unset($lines[0]);
}
// Regenerate the JSON file
// Regenerate the JSON file.
$implode = implode($lines);
// Unserialize, JSON to Array
// Unserialize, JSON to Array.
$array = $this->unserialize($implode);
if (empty($array)) {
$this->db = array();
$this->dbBackup = array();
} else {
if(empty($array)) {
Log::set(__METHOD__.LOG_SEP.'Invalid JSON file: '.$file.', cannot be decoded. Check the file content.');
}
else {
$this->db = $array;
$this->dbBackup = $array;
}
@ -43,29 +45,32 @@ class dbJSON {
public function restoreDB()
{
$this->db = $this->dbBackup;
return true;
}
// Returns the number of rows in the database
// Returns the amount of database items.
public function count()
{
return count($this->db);
}
// Returns the value from the field
// Returns the value from the field.
public function getField($field)
{
if (isset($this->db[$field])) {
if(isset($this->db[$field])) {
return $this->db[$field];
}
return $this->dbFields[$field];
return $this->dbFields[$field]['value'];
}
// Save the JSON file
// Save the JSON file.
public function save()
{
$data = '';
if ($this->firstLine) {
if($this->firstLine) {
$data = "<?php defined('BLUDIT') or die('Bludit CMS.'); ?>".PHP_EOL;
}
@ -76,45 +81,33 @@ class dbJSON {
$this->dbBackup = $this->db;
// LOCK_EX flag to prevent anyone else writing to the file at the same time.
if (file_put_contents($this->file, $data, LOCK_EX)) {
if( file_put_contents($this->file, $data, LOCK_EX) ) {
return true;
} else {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.', LOG_TYPE_ERROR);
}
else {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.');
return false;
}
}
// Returns a JSON encoded string on success or FALSE on failure
// Returns a JSON encoded string on success or FALSE on failure.
private function serialize($data)
{
if (DEBUG_MODE) {
return json_encode($data, JSON_PRETTY_PRINT);
}
return json_encode($data);
return json_encode($data, JSON_PRETTY_PRINT);
}
// Returns the value encoded in json in appropriate PHP type
// Returns the value encoded in json in appropriate PHP type.
private function unserialize($data)
{
// NULL is returned if the json cannot be decoded
// NULL is returned if the json cannot be decoded.
$decode = json_decode($data, true);
if ($decode===NULL) {
Log::set(__METHOD__.LOG_SEP.'Error trying to read the JSON file: '.$this->file, LOG_TYPE_ERROR);
// If NULL returns false.
if(empty($decode)) {
return false;
}
return $decode;
}
public function getDB()
{
return $this->db;
}
// Truncate all the rows
public function truncate()
{
$this->db = array();
return $this->save();
}
}

View File

@ -1,190 +0,0 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
/*
Database structure
{
"videos": {
"name": "Videos",
"template: "",
"description: "",
"list": [ "my-page", "second-page" ]
},
"pets": {
"name": "Pets",
"template: "",
"description: "",
"list": [ "cats-and-dogs" ]
}
}
*/
class dbList extends dbJSON
{
public $db = array();
function __construct($file)
{
parent::__construct($file);
}
public function keys()
{
return array_keys($this->db);
}
// Returns the list of keys filter by pageNumber
public function getList($key, $pageNumber, $numberOfItems)
{
if (!isset($this->db[$key])) {
Log::set(__METHOD__.LOG_SEP.'Error key does not exist '.$key);
return false;
}
// List of keys
$list = $this->db[$key]['list'];
// Returns all the items from the list
if ($numberOfItems==-1) {
return $list;
}
// The first page number is 1, so the real is 0
$realPageNumber = $pageNumber - 1;
$chunks = array_chunk($list, $numberOfItems);
if (isset($chunks[$realPageNumber])) {
return $chunks[$realPageNumber];
}
// Out of index,returns FALSE
return false;
}
public function generateKey($name)
{
global $L;
$key = Text::cleanUrl($name);
if (Text::isEmpty($key)) {
$key = $L->g('empty');
}
while (isset($this->db[$key])) {
$key++;
}
return $key;
}
// Add a new item to the dblist
// $args => 'name', 'template', 'description', list'
public function add($args)
{
$key = $this->generateKey($args['name']);
$this->db[$key]['name'] = Sanitize::removeTags($args['name']);
$this->db[$key]['template'] = isset($args['template'])?Sanitize::removeTags($args['template']):'';
$this->db[$key]['description'] = isset($args['description'])?Sanitize::removeTags($args['description']):'';
$this->db[$key]['list'] = isset($args['list'])?$args['list']:array();
$this->sortAlphanumeric();
$this->save();
return $key;
}
public function remove($key)
{
if (!isset($this->db[$key])) {
Log::set(__METHOD__.LOG_SEP.'The key does not exist, key: '.$key);
return false;
}
unset($this->db[$key]);
return $this->save();
}
// Edit an item to the dblist
// $args => 'name', 'oldkey', 'newKey', 'template', 'description'
public function edit($args)
{
if ( isset($this->db[$args['newKey']]) && ($args['newKey']!==$args['oldKey']) ) {
Log::set(__METHOD__.LOG_SEP.'The new key already exists. Key: '.$args['newKey'], LOG_TYPE_WARN);
return false;
}
$this->db[$args['newKey']]['name'] = Sanitize::removeTags($args['name']);
$this->db[$args['newKey']]['template'] = isset($args['template'])?Sanitize::removeTags($args['template']):'';
$this->db[$args['newKey']]['description'] = isset($args['description'])?Sanitize::removeTags($args['description']):'';
$this->db[$args['newKey']]['list'] = $this->db[$args['oldKey']]['list'];
// Remove the old category
if ($args['oldKey'] !== $args['newKey']) {
unset( $this->db[$args['oldKey']] );
}
$this->sortAlphanumeric();
$this->save();
return $args['newKey'];
}
// Sort the categories by "Natural order"
public function sortAlphanumeric()
{
// Sort key alphanumeric strings, a01, a10, b10, c02
return ksort($this->db);
}
// Returns the name associated to the key, FALSE if the key doesn't exist
public function getName($key)
{
if (isset($this->db[$key])) {
return $this->db[$key]['name'];
}
return false;
}
// Returns an array with key=>name of the list
public function getKeyNameArray()
{
$tmp = array();
foreach($this->db as $key=>$fields) {
$tmp[$key] = $fields['name'];
}
return $tmp;
}
// Returns the number of items in the list
public function countItems($key)
{
if (isset($this->db[$key])) {
return count($this->db[$key]['list']);
}
return 0;
}
public function exists($key)
{
return isset( $this->db[$key] );
}
public function existsName($name)
{
foreach ($this->db as $key=>$fields) {
if ($name==$fields['name']) {
return true;
}
}
return false;
}
// Returns an array with a portion of the database filtered by key
// Returns array( 'key'=>'', 'name'=>'', 'template'=>'', 'description'=>'', list'=>array() )
public function getMap($key)
{
if (isset($this->db[$key])) {
$tmp = $this->db[$key];
$tmp['key'] = $key;
return $tmp;
}
return false;
}
}

View File

@ -2,42 +2,29 @@
class Plugin {
// (string) directory name, just the name
// Ex: sitemap
// (string) Plugin's directory name
public $directoryName;
// (string) Absolute database filename and path
// Ex: /www/bludit/bl-content/plugins/sitemap/db.php
// (string) Database path and filename
public $filenameDb;
// (string) Absolute metadata filename and path
// Ex: /www/bludit/bl-plugins/sitemap/metadata.json
public $filenameMetadata;
// (array) Plugin metadata
// Ex: array('author'=>'',...., 'notes'=>'')
public $metadata;
// (string) Class name
// Ex: pluginSitemap
public $className;
// (array) Database unserialized
public $db;
// (array) Database fields, only for initialize
// (array) Database fields, only for initialize.
public $dbFields;
// (boolean) Enable or disable default Save and Cancel button on plugin settings
public $formButtons;
// (string) Plugin's class name.
public $className;
// (array) List of custom hooks
public $customHooks;
// (array) Plugin's information.
public $metadata;
function __construct()
{
$this->dbFields = array();
$this->customHooks = array();
$reflector = new ReflectionClass(get_class($this));
@ -47,12 +34,10 @@ class Plugin {
// Class Name
$this->className = $reflector->getName();
$this->formButtons = true;
// Call the method init() from the children
// Initialize dbFields from the children.
$this->init();
// Init empty database with default values
// Init empty database
$this->db = $this->dbFields;
$this->filenameDb = PATH_PLUGINS_DATABASES.$this->directoryName.DS.'db.php';
@ -62,46 +47,19 @@ class Plugin {
$metadataString = file_get_contents($this->filenameMetadata);
$this->metadata = json_decode($metadataString, true);
// If the plugin is installed then get the database
if ($this->installed()) {
// If the plugin is installed then get the database.
if($this->installed())
{
$Tmp = new dbJSON($this->filenameDb);
$this->db = $Tmp->db;
}
}
public function save()
{
$tmp = new dbJSON($this->filenameDb);
$tmp->db = $this->db;
return $tmp->save();
}
public function includeCSS($filename)
{
return '<link rel="stylesheet" type="text/css" href="'.$this->domainPath().'css/'.$filename.'?version='.BLUDIT_VERSION.'">'.PHP_EOL;
}
public function includeJS($filename)
{
return '<script charset="utf-8" src="'.$this->domainPath().'js/'.$filename.'?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
}
// Returns absolute URL and path of the plugin directory
// This function helps to include CSS or Javascript files with absolute URL
public function domainPath()
{
return DOMAIN_PLUGINS.$this->directoryName.'/';
}
// Returns relative path of the plugin directory
// This function helps to include CSS or Javascript files with relative URL
public function htmlPath()
{
return HTML_PATH_PLUGINS.$this->directoryName.'/';
}
// Returns absolute path of the plugin directory
// This function helps to include PHP libraries or some file at server level
public function phpPath()
{
return PATH_PLUGINS.$this->directoryName.DS;
@ -112,41 +70,64 @@ class Plugin {
return PATH_PLUGINS_DATABASES.$this->directoryName.DS;
}
// Returns the value of the key from the metadata of the plugin, FALSE if the key doesn't exist
// Returns the item from plugin-data.
public function getMetadata($key)
{
if(isset($this->metadata[$key])) {
return $this->metadata[$key];
}
return false;
return '';
}
// Set a key / value on the metadata of the plugin
public function setMetadata($key, $value)
{
$this->metadata[$key] = $value;
return true;
}
// Returns the value of the field from the database
// (string) $field
// (boolean) $html, TRUE returns the value sanitized, FALSE unsanitized
public function getValue($field, $html=true)
public function getDbField($key, $html=true)
{
if (isset($this->db[$field])) {
if ($html) {
return $this->db[$field];
} else {
return Sanitize::htmlDecode($this->db[$field]);
if(isset($this->db[$key])) {
if($html) {
// All fields from DBField are sanitized.
return $this->db[$key];
}
else {
// Decode HTML tags, this action unsanitized the variable.
return Sanitize::htmlDecode($this->db[$key]);
}
}
return $this->dbFields[$field];
return '';
}
public function label()
public function setDb($args)
{
return $this->getMetadata('label');
$tmp = $this->db;
foreach($this->dbFields as $key=>$value)
{
if(isset($args[$key]))
{
// Sanitize value
$tmpValue = Sanitize::html( $args[$key] );
// Set type
settype($tmpValue, gettype($value));
// Set value
$tmp[$key] = $tmpValue;
}
}
$this->db = $tmp;
// Save db on file
$Tmp = new dbJSON($this->filenameDb);
$Tmp->db = $tmp;
$Tmp->save();
}
public function name()
@ -174,11 +155,6 @@ class Plugin {
return $this->getMetadata('website');
}
public function position()
{
return $this->getValue('position');
}
public function version()
{
return $this->getMetadata('version');
@ -194,22 +170,11 @@ class Plugin {
return $this->className;
}
public function formButtons()
{
return $this->formButtons;
}
public function isCompatible()
{
$bluditRoot = explode('.', BLUDIT_VERSION);
$compatible = explode(',', $this->getMetadata('compatible'));
foreach( $compatible as $version ) {
$root = explode('.', $version);
if( $root[0]==$bluditRoot[0] && $root[1]==$bluditRoot[1] ) {
return true;
}
}
return false;
$explode = explode(',', $this->getMetadata('compatible'));
return in_array(BLUDIT_VERSION, $explode);
}
public function directoryName()
@ -218,122 +183,43 @@ class Plugin {
}
// Return TRUE if the installation success, otherwise FALSE.
public function install($position=1)
public function install($position=0)
{
if ($this->installed()) {
if($this->installed()) {
return false;
}
// Create workspace
$workspace = $this->workspace();
mkdir($workspace, DIR_PERMISSIONS, true);
// Create plugin directory for the database
mkdir(PATH_PLUGINS_DATABASES.$this->directoryName, DIR_PERMISSIONS, true);
// Create plugin directory for databases and other files
mkdir(PATH_PLUGINS_DATABASES.$this->directoryName, 0755, true);
// Create database
$this->dbFields['position'] = $position;
// Sanitize default values to store in the file
foreach ($this->dbFields as $key=>$value) {
$value = Sanitize::html($value);
settype($value, gettype($this->dbFields[$key]));
$this->db[$key] = $value;
}
// Create the database
return $this->save();
}
public function uninstall()
{
// Delete database
$path = PATH_PLUGINS_DATABASES.$this->directoryName;
Filesystem::deleteRecursive($path);
// Delete workspace
$workspace = $this->workspace();
Filesystem::deleteRecursive($workspace);
$this->setDb($this->dbFields);
return true;
}
// Returns TRUE if the plugin is installed
// This function just check if the database of the plugin is created
public function uninstall()
{
// Delete all files.
$files = Filesystem::listFiles( $this->phpPathDB() );
foreach($files as $file) {
unlink($file);
}
// Delete the directory.
rmdir(PATH_PLUGINS_DATABASES.$this->directoryName);
}
public function installed()
{
return file_exists($this->filenameDb);
}
public function workspace()
{
return PATH_WORKSPACES.$this->directoryName.DS;
}
public function init()
{
// This method is used on children classes.
// The user can define his own field of the database
}
public function post()
{
$args = $_POST;
foreach ($this->dbFields as $field=>$value) {
if (isset($args[$field])) {
$finalValue = Sanitize::html( $args[$field] );
if ($finalValue==='false') { $finalValue = false; }
elseif ($finalValue==='true') { $finalValue = true; }
settype($finalValue, gettype($value));
$this->db[$field] = $finalValue;
}
}
return $this->save();
}
public function setField($field, $value)
{
$this->db[$field] = Sanitize::html($value);
return $this->save();
}
public function setPosition($position)
{
return $this->setField('position', $position);
}
// Returns the parameters after the URI, FALSE if the URI doesn't match with the webhook
// Example: https://www.mybludit.com/api/foo/bar
public function webhook($URI=false, $returnsAfterURI=false, $fixed=true)
{
global $url;
if (empty($URI)) {
return false;
}
// Check URI start with the webhook
$startString = HTML_PATH_ROOT.$URI;
$URI = $url->uri();
$length = mb_strlen($startString, CHARSET);
if (mb_substr($URI, 0, $length)!=$startString) {
return false;
}
$afterURI = mb_substr($URI, $length);
if (!empty($afterURI)) {
if ($fixed) {
return false;
}
if ($afterURI[0]!='/') {
return false;
}
}
if ($returnsAfterURI) {
return $afterURI;
}
Log::set(__METHOD__.LOG_SEP.'Webhook requested.');
return true;
// This method is used on childre classes.
// The user can define your own dbFields.
}
}

View File

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

View File

@ -0,0 +1,86 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// ============================================================================
// Check role
// ============================================================================
if($Login->role()!=='admin') {
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
Redirect::page('admin', 'dashboard');
}
// ============================================================================
// Functions
// ============================================================================
function addUser($args)
{
global $dbUsers;
global $Language;
// Check empty username
if( Text::isEmpty($args['new_username']) )
{
Alert::set($Language->g('username-field-is-empty'), ALERT_STATUS_FAIL);
return false;
}
// Check already exist username
if( $dbUsers->userExists($args['new_username']) )
{
Alert::set($Language->g('username-already-exists'), ALERT_STATUS_FAIL);
return false;
}
// Password length
if( strlen($args['new_password']) < 6 )
{
Alert::set($Language->g('Password must be at least 6 characters long'), ALERT_STATUS_FAIL);
return false;
}
// Check new password and confirm password are equal
if( $args['new_password'] != $args['confirm_password'] )
{
Alert::set($Language->g('The password and confirmation password do not match'), ALERT_STATUS_FAIL);
return false;
}
// Filter form fields
$tmp = array();
$tmp['username'] = $args['new_username'];
$tmp['password'] = $args['new_password'];
$tmp['role'] = $args['role'];
$tmp['email'] = $args['email'];
// Add the user to the database
if( $dbUsers->add($tmp) )
{
Alert::set($Language->g('user-has-been-added-successfully'), ALERT_STATUS_OK);
return true;
}
else
{
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to create the account.');
return false;
}
}
// ============================================================================
// Main before POST
// ============================================================================
// ============================================================================
// POST Method
// ============================================================================
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
if( addUser($_POST) ) {
Redirect::page('admin', 'users');
}
}
// ============================================================================
// Main after POST
// ============================================================================

View File

@ -4,8 +4,6 @@
// Check role
// ============================================================================
checkRole(array('admin'));
// ============================================================================
// Functions
// ============================================================================
@ -21,6 +19,3 @@ checkRole(array('admin'));
// ============================================================================
// Main after POST
// ============================================================================
// Title of the page
$layout['title'] .= ' - '.$L->g('Categories');

View File

@ -4,7 +4,10 @@
// Check role
// ============================================================================
checkRole(array('admin'));
if($Login->role()!=='admin') {
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
Redirect::page('admin', 'dashboard');
}
// ============================================================================
// Functions
@ -13,41 +16,39 @@ checkRole(array('admin'));
// ============================================================================
// Main before POST
// ============================================================================
$plugin = false;
$_Plugin = false;
$pluginClassName = $layout['parameters'];
// Check if the plugin exists
if (isset($plugins['all'][$pluginClassName])) {
$plugin = $plugins['all'][$pluginClassName];
} else {
Redirect::page('plugins');
foreach($plugins['all'] as $P)
{
if($P->className()==$pluginClassName) {
$_Plugin = $P;
}
}
// Check if the plugin exists.
if($_Plugin===false) {
Redirect::page('admin', 'plugins');
}
// Check if the plugin has the method form()
if (!method_exists($plugin, 'form')) {
Redirect::page('plugins');
if(!method_exists($_Plugin, 'form')) {
Redirect::page('admin', 'plugins');
}
// ============================================================================
// POST Method
// ============================================================================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Add to syslog
$syslog->add(array(
'dictionaryKey'=>'plugin-configured',
'notes'=>$plugin->name()
));
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
$_Plugin->setDb($_POST);
// Call the method post of the plugin
$plugin->post();
Alert::set( $L->g('The changes have been saved') );
Redirect::page('configure-plugin/'.$plugin->className());
Theme::plugins('afterFormSave');
Alert::set($Language->g('the-changes-have-been-saved'));
}
// ============================================================================
// Main after POST
// ============================================================================
// Title of the page
$layout['title'] = $L->g('Plugin').' - '.$plugin->name().' - '.$layout['title'];

View File

@ -1,60 +0,0 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// ============================================================================
// Check role
// ============================================================================
checkRole(array('admin', 'editor', 'author'));
// ============================================================================
// Functions
// ============================================================================
// Returns the content belongs to the current user if the user has the role Editor
function filterContentOwner($list) {
global $login;
global $pages;
$tmp = array();
foreach ($list as $pageKey) {
if ($pages->db[$pageKey]['username']==$login->username()) {
array_push($tmp, $pageKey);
}
}
return $tmp;
}
// ============================================================================
// Main before POST
// ============================================================================
// ============================================================================
// POST Method
// ============================================================================
// ============================================================================
// Main after POST
// ============================================================================
$published = $pages->getList($url->pageNumber(), ITEMS_PER_PAGE_ADMIN);
$drafts = $pages->getDraftDB(true);
$scheduled = $pages->getScheduledDB(true);
$static = $pages->getStaticDB(true);
$sticky = $pages->getStickyDB(true);
$autosave = $pages->getAutosaveDB(true);
// If the user is an Author filter the content he/she can edit
if (checkRole(array('author'), false)) {
$published = filterContentOwner($published);
$drafts = filterContentOwner($drafts);
$scheduled = filterContentOwner($scheduled);
$static = filterContentOwner($static);
$sticky = filterContentOwner($sticky);
}
// Check if out of range the pageNumber
if (empty($published) && $url->pageNumber()>1) {
Redirect::page('content');
}
// Title of the page
$layout['title'] .= ' - '.$L->g('Manage content');

View File

@ -3,47 +3,98 @@
// ============================================================================
// Functions
// ============================================================================
function updateBludit() {
global $site;
global $syslog;
function updateBludit()
{
global $Site;
global $dbPosts;
global $dbPages;
// New installation
if ($site->currentBuild()==0) {
$site->set(array('currentBuild'=>BLUDIT_BUILD));
}
// Check if Bludit need to be update.
if( ($Site->currentBuild() < BLUDIT_BUILD) || isset($_GET['update']) )
{
// LOG
Log::set('UPDATE SYSTEM - Starting...');
// Check if Bludit need to be update
if ( ($site->currentBuild() < BLUDIT_BUILD) || isset($_GET['update']) ) {
Log::set('UPDATE SYSTEM - Starting.');
// LOG
Log::set('UPDATE SYSTEM - Checking posts.');
// Updates only for version less than Bludit v3.0 rc-3
if ($site->currentBuild()<='20180910') {
@mkdir(PATH_WORKSPACES, DIR_PERMISSIONS, true);
$plugins = array('simple-stats', 'pluginRSS', 'pluginSitemap', 'pluginTimeMachineX', 'pluginBackup');
foreach ($plugins as $plugin) {
if (pluginActivated($plugin)) {
Log::set('UPDATE SYSTEM - Re-enable plugin: '.$plugin);
deactivatePlugin($plugin);
activatePlugin($plugin);
}
// Update posts
foreach($dbPosts->db as $key=>$post) {
// Dates
$date = Date::format($post['date'], 'Y-m-d H:i', DB_DATE_FORMAT);
if($date !== false) {
$dbPosts->setPostDb($key, 'date', $date);
}
// Checksum
if( empty($post['md5file']) ) {
$checksum = md5_file(PATH_POSTS.$key.DS.FILENAME);
$dbPosts->setPostDb($key, 'md5file', $checksum);
}
// UUID
if( empty($post['uuid']) ) {
$uuid = uniqid();
$dbPosts->setPostDb($key, 'uuid', $uuid);
}
}
// Updates only for version less than Bludit v3.1
if ($site->currentBuild()<='20180921') {
@mkdir(PATH_UPLOADS_PAGES, DIR_PERMISSIONS, true);
$site->set(array('imageRelativeToAbsolute'=>true, 'imageRestrict'=>false));
$dbPosts->save();
// LOG
Log::set('UPDATE SYSTEM - Checking pages.');
// Update pages
foreach($dbPages->db as $key=>$page) {
$date = Date::format($page['date'], 'Y-m-d H:i', DB_DATE_FORMAT);
if($date !== false) {
$dbPages->setPageDb($key, 'date', $date);
}
// Checksum
if( empty($page['md5file']) ) {
$checksum = md5_file(PATH_PAGES.$key.DS.FILENAME);
$dbPages->setPageDb($key, 'md5file', $checksum);
}
// UUID
if( empty($page['uuid']) ) {
$uuid = uniqid();
$dbPages->setPageDb($key, 'uuid', $uuid);
}
}
// Set the current build number
$site->set(array('currentBuild'=>BLUDIT_BUILD));
Log::set('UPDATE SYSTEM - Finished.');
$dbPages->save();
// Add to syslog
$syslog->add(array(
'dictionaryKey'=>'system-updated',
'notes'=>'Bludit v'.BLUDIT_VERSION
));
// LOG
Log::set('UPDATE SYSTEM - Checking directories.');
// --- Update directories ---
$directories = array(
PATH_POSTS,
PATH_PAGES,
PATH_PLUGINS_DATABASES,
PATH_UPLOADS_PROFILES,
PATH_UPLOADS_THUMBNAILS,
PATH_TMP
);
foreach($directories as $dir) {
// Check if the directory is already created.
if(!file_exists($dir)) {
// Create the directory recursive.
mkdir($dir, DIR_PERMISSIONS, true);
}
}
// Set and save the database.
$Site->set(array('currentBuild'=>BLUDIT_BUILD));
// LOG
Log::set('UPDATE SYSTEM - Updated...');
}
}
@ -62,5 +113,24 @@ function updateBludit() {
// Try update Bludit
updateBludit();
// Title of the page
$layout['title'] .= ' - '.$L->g('Dashboard');
// Get draft posts and schedules
$_draftPosts = array();
$_scheduledPosts = array();
foreach($posts as $Post)
{
if($Post->draft()) {
array_push($_draftPosts, $Post);
}
elseif($Post->scheduled()) {
array_push($_scheduledPosts, $Post);
}
}
// Get draft pages
$_draftPages = array();
foreach($pages as $Page)
{
if(!$Page->published()) {
array_push($_draftPages, $Page);
}
}

View File

@ -4,12 +4,51 @@
// Check role
// ============================================================================
checkRole(array('admin'));
if($Login->role()!=='admin') {
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
Redirect::page('admin', 'dashboard');
}
// ============================================================================
// Functions
// ============================================================================
function edit($oldCategoryKey, $newCategory)
{
global $Language;
global $dbPosts;
global $dbPages;
global $dbCategories;
if( Text::isEmpty($oldCategoryKey) || Text::isEmpty($newCategory) ) {
Alert::set($Language->g('Empty field'));
Redirect::page('admin', 'categories');
}
if( $dbCategories->edit($oldCategoryKey, $newCategory) == false ) {
Alert::set($Language->g('Already exist a category'));
}
else {
$dbPages->changeCategory($oldCategoryKey, $newCategory);
$dbPosts->changeCategory($oldCategoryKey, $newCategory);
Alert::set($Language->g('The changes have been saved'));
}
Redirect::page('admin', 'categories');
}
function delete($categoryKey)
{
global $Language;
global $dbCategories;
$dbCategories->remove($categoryKey);
Alert::set($Language->g('The changes have been saved'));
Redirect::page('admin', 'categories');
}
// ============================================================================
// Main before POST
// ============================================================================
@ -18,27 +57,27 @@ checkRole(array('admin'));
// POST Method
// ============================================================================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['action']=='delete') {
deleteCategory($_POST);
} elseif ($_POST['action']=='edit') {
editCategory($_POST);
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
if( isset($_POST['delete']) ) {
delete($_POST['categoryKey']);
}
elseif( isset($_POST['edit']) ) {
edit($_POST['categoryKey'], $_POST['category']);
}
Redirect::page('categories');
}
// ============================================================================
// Main after POST
// ============================================================================
$categoryKey = $layout['parameters'];
if (!$categories->exists($categoryKey)) {
if(!$dbCategories->exists($categoryKey)) {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to get the category: '.$categoryKey);
Redirect::page('categories');
Redirect::page('admin', 'categories');
}
$categoryMap = $categories->getMap($categoryKey);
$category = $dbCategories->getName($layout['parameters']);
// Title of the page
$layout['title'] .= ' - '.$L->g('Edit Category').' [ '.$categoryMap['name'] . ' ] ';
$layout['title'] .= ' - '.$Language->g('Edit category').' - '.$category;

View File

@ -1,86 +0,0 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// ============================================================================
// Check role
// ============================================================================
if (checkRole(array('author'), false)) {
try {
$pageKey = isset($_POST['key']) ? $_POST['key'] : $layout['parameters'];
$page = new Page($pageKey);
} catch (Exception $e) {
Alert::set($L->g('You do not have sufficient permissions'));
Redirect::page('dashboard');
}
if ($page->username()!==$login->username()) {
// Add to syslog
$syslog->add(array(
'dictionaryKey'=>'access-denied',
'notes'=>$login->username()
));
Alert::set($L->g('You do not have sufficient permissions'));
Redirect::page('dashboard');
}
}
// ============================================================================
// Functions
// ============================================================================
// ============================================================================
// Main before POST
// ============================================================================
// ============================================================================
// POST Method
// ============================================================================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['type']==='delete') {
if (deletePage($_POST['key'])) {
Alert::set( $L->g('The changes have been saved') );
}
} else {
$key = editPage($_POST);
if ($key!==false) {
Alert::set( $L->g('The changes have been saved') );
Redirect::page('edit-content/'.$key);
}
}
Redirect::page('content');
}
// ============================================================================
// Main after POST
// ============================================================================
try {
$pageKey = $layout['parameters'];
$page = new Page($pageKey);
} catch (Exception $e) {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to get the page: '.$pageKey, LOG_TYPE_ERROR);
Redirect::page('content');
}
// Images prefix directory
define('PAGE_IMAGES_KEY', $page->uuid());
// Images and thubmnails directories
if (IMAGE_RESTRICT) {
define('PAGE_IMAGES_DIRECTORY', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : HTML_PATH_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/'));
define('PAGE_IMAGES_URL', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : DOMAIN_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/'));
define('PAGE_THUMBNAILS_DIRECTORY', PATH_UPLOADS_PAGES.PAGE_IMAGES_KEY.DS.'thumbnails'.DS);
define('PAGE_THUMBNAILS_HTML', HTML_PATH_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/thumbnails/');
define('PAGE_THUMBNAILS_URL', DOMAIN_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/thumbnails/');
} else {
define('PAGE_IMAGES_DIRECTORY', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : HTML_PATH_UPLOADS));
define('PAGE_IMAGES_URL', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : DOMAIN_UPLOADS));
define('PAGE_THUMBNAILS_DIRECTORY', PATH_UPLOADS_THUMBNAILS);
define('PAGE_THUMBNAILS_HTML', HTML_PATH_UPLOADS_THUMBNAILS);
define('PAGE_THUMBNAILS_URL', DOMAIN_UPLOADS_THUMBNAILS);
}
// Title of the page
$layout['title'] .= ' - '.$L->g('Edit content').' - '.$page->title();

View File

@ -0,0 +1,90 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// ============================================================================
// Check role
// ============================================================================
// ============================================================================
// Functions
// ============================================================================
function editPage($args)
{
global $dbPages;
global $Language;
if(!isset($args['parent'])) {
$args['parent'] = NO_PARENT_CHAR;
}
// Add the page, if the $key is FALSE the creation of the post failure.
$key = $dbPages->edit($args);
if($key)
{
$dbPages->regenerateCli();
// Re index categories
//reIndexCategoriesPages();
// Call the plugins after page created.
Theme::plugins('afterPageModify');
// Alert the user
Alert::set($Language->g('The changes have been saved'));
Redirect::page('admin', 'edit-page/'.$args['slug']);
}
else
{
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to edit the page.');
}
}
function deletePage($key)
{
global $dbPages;
global $Language;
if( $dbPages->delete($key) )
{
// Call the plugins after post created.
Theme::plugins('afterPageDelete');
Alert::set($Language->g('The page has been deleted successfully'));
Redirect::page('admin', 'manage-pages');
}
else
{
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to delete the page.');
}
}
// ============================================================================
// Main before POST
// ============================================================================
// ============================================================================
// POST Method
// ============================================================================
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
if( isset($_POST['delete-page']) ) {
deletePage($_POST['key']);
}
else {
editPage($_POST);
}
}
// ============================================================================
// Main after POST
// ============================================================================
if(!$dbPages->pageExists($layout['parameters']))
{
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to get the page: '.$layout['parameters']);
Redirect::page('admin', 'manage-pages');
}
$_Page = $pages[$layout['parameters']];

View File

@ -0,0 +1,94 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// ============================================================================
// Check role
// ============================================================================
// ============================================================================
// Functions
// ============================================================================
function editPost($args)
{
global $dbPosts;
global $Language;
// Add the page, if the $key is FALSE the creation of the post failure.
$key = $dbPosts->edit($args);
if($key)
{
// Reindex tags, this function is in 70.posts.php
reIndexTagsPosts();
// Re index categories
//reIndexCategoriesPosts();
// Call the plugins after post created.
Theme::plugins('afterPostModify');
// Alert the user
Alert::set($Language->g('The changes have been saved'));
Redirect::page('admin', 'edit-post/'.$args['slug']);
}
else
{
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to edit the post.');
}
return false;
}
function deletePost($key)
{
global $dbPosts;
global $Language;
if( $dbPosts->delete($key) )
{
// Reindex tags, this function is in 70.posts.php
reIndexTagsPosts();
// Call the plugins after post created.
Theme::plugins('afterPostDelete');
Alert::set($Language->g('The post has been deleted successfully'));
Redirect::page('admin', 'manage-posts');
}
else
{
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to delete the post.');
}
}
// ============================================================================
// Main before POST
// ============================================================================
// ============================================================================
// POST Method
// ============================================================================
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
if( isset($_POST['delete-post']) ) {
deletePost($_POST['key']);
}
else {
editPost($_POST);
}
}
// ============================================================================
// Main after POST
// ============================================================================
if(!$dbPosts->postExists($layout['parameters']))
{
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to get the post: '.$layout['parameters']);
Redirect::page('admin', 'manage-posts');
}
$_Post = buildPost($layout['parameters']);
$layout['title'] .= ' - '.$Language->g('Edit post').' - '.$_Post->title();

View File

@ -4,6 +4,70 @@
// Functions
// ============================================================================
function disableUser($username) {
global $dbUsers;
global $Language;
global $Login;
// The editors can't disable users
if($Login->role()!=='admin') {
return false;
}
if( $dbUsers->disableUser($username) ) {
Alert::set($Language->g('The changes have been saved'));
}
else {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to edit the user.');
}
}
function editUser($args)
{
global $dbUsers;
global $Language;
if( $dbUsers->set($args) ) {
Alert::set($Language->g('The changes have been saved'));
}
else {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to edit the user.');
}
}
function deleteUser($args, $deleteContent=false)
{
global $dbUsers;
global $dbPosts;
global $Language;
global $Login;
// The user admin cannot be deleted.
if($args['username']=='admin') {
return false;
}
// The editors cannot delete users.
if($Login->role()!=='admin') {
return false;
}
if($deleteContent) {
$dbPosts->deletePostsByUser($args['username']);
}
else {
$dbPosts->linkPostsToUser($args['username'], 'admin');
}
if( $dbUsers->delete($args['username']) ) {
Alert::set($Language->g('User deleted'));
}
else {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to delete the user.');
}
}
// ============================================================================
// Main before POST
// ============================================================================
@ -12,49 +76,40 @@
// POST Method
// ============================================================================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Prevent non-administrators to change other users
if ($login->role()!=='admin') {
$_POST['username'] = $login->username();
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
// Prevent editors to administrate other users.
if($Login->role()!=='admin')
{
$_POST['username'] = $Login->username();
unset($_POST['role']);
}
if (isset($_POST['deleteUserAndDeleteContent']) && ($login->role()==='admin')) {
$_POST['deleteContent'] = true;
deleteUser($_POST);
} elseif (isset($_POST['deleteUserAndKeepContent']) && ($login->role()==='admin')) {
$_POST['deleteContent'] = false;
deleteUser($_POST);
} elseif (isset($_POST['disableUser']) && ($login->role()==='admin')) {
disableUser(array('username'=>$_POST['username']));
} else {
if(isset($_POST['delete-user-all'])) {
deleteUser($_POST, true);
}
elseif(isset($_POST['delete-user-associate'])) {
deleteUser($_POST, false);
}
elseif(isset($_POST['disable-user'])) {
disableUser($_POST['username']);
}
else {
editUser($_POST);
}
Alert::set($L->g('The changes have been saved'));
if ($login->role()==='admin') {
Redirect::page('users');
}
Redirect::page('edit-user/'.$login->username());
}
// ============================================================================
// Main after POST
// ============================================================================
$username = $layout['parameters'];
// Prevent non-administrators to change other users
if ($login->role()!=='admin') {
$username = $login->username();
if($Login->role()!=='admin') {
$layout['parameters'] = $Login->username();
}
try {
$user = new User($username);
} catch (Exception $e) {
Redirect::page('users');
}
$_User = $dbUsers->getUser($layout['parameters']);
// Title of the page
$layout['title'] = $L->g('Edit user').' - '.$layout['title'];
// If the user doesn't exist, redirect to the users list.
if($_User===false) {
Redirect::page('admin', 'users');
}

View File

@ -4,7 +4,10 @@
// Check role
// ============================================================================
checkRole(array('admin'));
if($Login->role()!=='admin') {
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
Redirect::page('admin', 'dashboard');
}
// ============================================================================
// Functions
@ -22,18 +25,12 @@ checkRole(array('admin'));
// Main after POST
// ============================================================================
$pluginClassName = $layout['parameters'];
if (!activatePlugin($pluginClassName)) {
Log::set('Fail when try to activate the plugin.', LOG_TYPE_ERROR);
foreach($plugins['all'] as $P)
{
if($P->className()==$pluginClassName) {
$P->install();
}
}
if (isset($plugins['all'][$pluginClassName])) {
$plugin = $plugins['all'][$pluginClassName];
} else {
Redirect::page('plugins');
}
if (method_exists($plugin, 'form')) {
Redirect::page('configure-plugin/'.$pluginClassName);
}
Redirect::page('plugins#'.$pluginClassName);
Redirect::page('admin', 'plugins');

View File

@ -4,7 +4,10 @@
// Check role
// ============================================================================
checkRole(array('admin'));
if($Login->role()!=='admin') {
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
Redirect::page('admin', 'dashboard');
}
// ============================================================================
// Functions
@ -21,10 +24,16 @@ checkRole(array('admin'));
// ============================================================================
// Main after POST
// ============================================================================
$themeDirectory = $layout['parameters'];
$themeDirname = $layout['parameters'];
// Activate theme
activateTheme($themeDirectory);
if( Sanitize::pathFile(PATH_THEMES.$themeDirname) )
{
$Site->set(array('theme'=>$themeDirname));
Alert::set($Language->g('The changes have been saved'));
}
else
{
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to install the theme: '.$themeDirname);
}
// Redirect
Redirect::page('themes');
Redirect::page('admin', 'themes');

View File

@ -0,0 +1,123 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// ============================================================================
// Check role
// ============================================================================
// ============================================================================
// Functions
// ============================================================================
function checkPost($args)
{
global $Security;
global $Language;
global $dbUsers;
global $Site;
if($Security->isBlocked()) {
Alert::set($Language->g('IP address has been blocked').'<br>'.$Language->g('Try again in a few minutes'));
return false;
}
// Remove illegal characters from email
$email = Sanitize::email($args['email']);
if(Valid::email($email))
{
// Get username associated to an email.
$username = $dbUsers->getByEmail($email);
if($username!=false)
{
// Generate the token and the token expiration date.
$token = $dbUsers->generateTokenEmail($username);
// ---- EMAIL ----
$link = $Site->url().'admin/login-email?tokenEmail='.$token.'&username='.$username;
$subject = $Language->g('BLUDIT Login access code');
$message = Text::replaceAssoc(
array(
'{{WEBSITE_NAME}}'=>$Site->title(),
'{{LINK}}'=>'<a href="'.$link.'">'.$link.'</a>'
),
$Language->g('email-notification-login-access-code')
);
$sent = Email::send(array(
'from'=>$Site->emailFrom(),
'fromName'=>$Site->title(),
'to'=>$email,
'subject'=>$subject,
'message'=>$message
));
if($sent) {
Alert::set($Language->g('check-your-inbox-for-your-login-access-code'));
return true;
}
else {
Alert::set($Language->g('There was a problem sending the email'));
return false;
}
}
}
// Bruteforce protection, add IP to blacklist.
$Security->addLoginFail();
Alert::set($Language->g('check-your-inbox-for-your-login-access-code'));
return false;
}
function checkGet($args)
{
global $Security;
global $Language;
global $Login;
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->verifyUserByToken($args['username'], $args['tokenEmail']) )
{
// Renew the tokenCRFS. This token will be the same inside the session for multiple forms.
$Security->generateTokenCSRF();
Redirect::page('admin', 'dashboard');
return true;
}
// Bruteforce protection, add IP to blacklist.
$Security->addLoginFail();
return false;
}
// ============================================================================
// Main before POST
// ============================================================================
// ============================================================================
// GET Method
// ============================================================================
if( !empty($_GET['tokenEmail']) && !empty($_GET['username']) )
{
checkGet($_GET);
}
// ============================================================================
// POST Method
// ============================================================================
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
checkPost($_POST);
}
// ============================================================================
// Main after POST
// ============================================================================

View File

@ -8,53 +8,30 @@
// Functions
// ============================================================================
function checkLogin($args)
function checkPost($args)
{
global $security;
global $login;
global $L;
global $Security;
global $Login;
global $Language;
if ($security->isBlocked()) {
Alert::set($L->g('IP address has been blocked').'<br>'.$L->g('Try again in a few minutes'), ALERT_STATUS_FAIL);
if($Security->isBlocked()) {
Alert::set($Language->g('IP address has been blocked').'<br>'.$Language->g('Try again in a few minutes'));
return false;
}
if ($login->verifyUser($_POST['username'], $_POST['password'])) {
if (isset($_POST['remember'])) {
$login->setRememberMe($_POST['username']);
}
// Verify User sanitize the input
if( $Login->verifyUser($_POST['username'], $_POST['password']) )
{
// Renew the token. This token will be the same inside the session for multiple forms.
$security->generateTokenCSRF();
$Security->generateTokenCSRF();
if (isset($_GET['enableAPI'])) {
Redirect::page('api');
}
Redirect::page('dashboard');
Redirect::page('admin', 'dashboard');
return true;
}
// Bruteforce protection, add IP to the blacklist
$security->addToBlacklist();
// Create alert
Alert::set($L->g('Username or password incorrect'), ALERT_STATUS_FAIL);
return false;
}
function checkRememberMe()
{
global $security;
global $login;
if ($security->isBlocked()) {
return false;
}
if ($login->verifyUserByRemember()) {
$security->generateTokenCSRF();
Redirect::page('dashboard');
return true;
}
// Bruteforce protection, add IP to blacklist.
$Security->addLoginFail();
Alert::set($Language->g('Username or password incorrect'));
return false;
}
@ -63,16 +40,13 @@ function checkRememberMe()
// Main before POST
// ============================================================================
if ($_SERVER['REQUEST_METHOD']!=='POST') {
checkRememberMe();
}
// ============================================================================
// POST Method
// ============================================================================
if ($_SERVER['REQUEST_METHOD']=='POST') {
checkLogin($_POST);
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
checkPost($_POST);
}
// ============================================================================

View File

@ -20,6 +20,7 @@
// Main after POST
// ============================================================================
if ($login->logout()) {
Redirect::admin();
if( $Login->logout())
{
Redirect::home();
}

View File

@ -4,8 +4,6 @@
// Check role
// ============================================================================
checkRole(array('admin'));
// ============================================================================
// Functions
// ============================================================================
@ -18,15 +16,6 @@ checkRole(array('admin'));
// POST Method
// ============================================================================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (createUser($_POST)) {
Redirect::page('users');
}
}
// ============================================================================
// Main after POST
// ============================================================================
// Title of the page
$layout['title'] .= ' - '.$L->g('Add a new user');

View File

@ -4,8 +4,6 @@
// Check role
// ============================================================================
checkRole(array('admin'));
// ============================================================================
// Functions
// ============================================================================
@ -13,10 +11,7 @@ checkRole(array('admin'));
// ============================================================================
// Main before POST
// ============================================================================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
changePluginsPosition(explode(',',$_POST['plugin-list']));
Redirect::page('plugins-position');
}
// ============================================================================
// POST Method
// ============================================================================
@ -24,6 +19,3 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// ============================================================================
// Main after POST
// ============================================================================
// Title of the page
$layout['title'] .= ' - '.$L->g('Plugins');

View File

@ -4,12 +4,35 @@
// Check role
// ============================================================================
checkRole(array('admin'));
if($Login->role()!=='admin') {
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
Redirect::page('admin', 'dashboard');
}
// ============================================================================
// Functions
// ============================================================================
function add($category)
{
global $dbCategories;
global $Language;
if( Text::isEmpty($category) ) {
Alert::set($Language->g('Category name is empty'), ALERT_STATUS_FAIL);
return false;
}
if( $dbCategories->add($category) ) {
Alert::set($Language->g('Category added'), ALERT_STATUS_OK);
return true;
}
else {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to create the category.');
return false;
}
}
// ============================================================================
// Main before POST
// ============================================================================
@ -18,15 +41,13 @@ checkRole(array('admin'));
// POST Method
// ============================================================================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (createCategory($_POST)) {
Redirect::page('categories');
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
if( add($_POST['category']) ) {
Redirect::page('admin', 'categories');
}
}
// ============================================================================
// Main after POST
// ============================================================================
// Title of the page
$layout['title'] .= ' - '.$L->g('New category');

View File

@ -1,52 +0,0 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// ============================================================================
// Check role
// ============================================================================
checkRole(array('admin', 'editor', 'author'));
// ============================================================================
// Functions
// ============================================================================
// ============================================================================
// Main before POST
// ============================================================================
// ============================================================================
// POST Method
// ============================================================================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
createPage($_POST);
Redirect::page('content');
}
// ============================================================================
// Main after POST
// ============================================================================
// UUID of the page is need it for autosave and media manager
$uuid = $pages->generateUUID();
// Images prefix directory
define('PAGE_IMAGES_KEY', $uuid);
// Images and thubmnails directories
if (IMAGE_RESTRICT) {
define('PAGE_IMAGES_DIRECTORY', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : HTML_PATH_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/'));
define('PAGE_IMAGES_URL', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : DOMAIN_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/'));
define('PAGE_THUMBNAILS_DIRECTORY', PATH_UPLOADS_PAGES.PAGE_IMAGES_KEY.DS.'thumbnails'.DS);
define('PAGE_THUMBNAILS_HTML', HTML_PATH_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/thumbnails/');
define('PAGE_THUMBNAILS_URL', DOMAIN_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/thumbnails/');
} else {
define('PAGE_IMAGES_DIRECTORY', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : HTML_PATH_UPLOADS));
define('PAGE_IMAGES_URL', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : DOMAIN_UPLOADS));
define('PAGE_THUMBNAILS_DIRECTORY', PATH_UPLOADS_THUMBNAILS);
define('PAGE_THUMBNAILS_HTML', HTML_PATH_UPLOADS_THUMBNAILS);
define('PAGE_THUMBNAILS_URL', DOMAIN_UPLOADS_THUMBNAILS);
}
// Title of the page
$layout['title'] = $L->g('New content').' - '.$layout['title'];

View File

@ -4,12 +4,36 @@
// Check role
// ============================================================================
checkRole(array('admin'));
// ============================================================================
// Functions
// ============================================================================
function addPage($args)
{
global $dbPages;
global $Language;
// Add the page, if the $key is FALSE the creation of the post failure.
$key = $dbPages->add($args);
if($key)
{
// Re index categories
//reIndexCategoriesPages();
// Call the plugins after page created.
Theme::plugins('afterPageCreate');
// Alert the user
Alert::set($Language->g('Page added successfully'));
Redirect::page('admin', 'manage-pages');
}
else
{
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to create the page.');
}
}
// ============================================================================
// Main before POST
// ============================================================================
@ -18,23 +42,11 @@ checkRole(array('admin'));
// POST Method
// ============================================================================
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
addPage($_POST);
}
// ============================================================================
// Main after POST
// ============================================================================
activatePlugin('pluginAPI');
$apiURL = DOMAIN_BASE.'api/';
$pluginAPI = getPlugin('pluginAPI');
$apiToken = $pluginAPI->getToken();
$username = $login->username();
$admin = new User($username);
$authToken = $admin->tokenAuth();
$output = array(
'apiURL'=>$apiURL,
'username'=>$username,
'apiToken'=>$apiToken,
'authToken'=>$authToken
);
exit(json_encode($output));
?>

View File

@ -4,36 +4,38 @@
// Check role
// ============================================================================
checkRole(array('admin'));
// ============================================================================
// Functions
// ============================================================================
function addPost($args)
{
global $dbPosts;
global $Language;
// This function is used on the VIEW to show the tables
function printTable($title, $array) {
echo '<h2 class="mb-2 mt-4">'.$title.'</h2>';
echo '<table class="table table-striped mt-3">
<tbody>
';
// Add the page, if the $key is FALSE the creation of the post failure.
$key = $dbPosts->add($args);
foreach ($array as $key=>$value) {
if($value===false) { $value = 'false'; }
elseif($value===true) { $value = 'true'; }
echo '<tr>';
echo '<td>'.$key.'</td>';
if (is_array($value)) {
echo '<td>'.json_encode($value).'</td>';
} else {
echo '<td>'.Sanitize::html($value).'</td>';
}
echo '</tr>';
if($key) {
// Reindex tags, this function is in 70.posts.php
reIndexTagsPosts();
// Re index categories
//reIndexCategoriesPosts();
// Call the plugins after post creation
Theme::plugins('afterPostCreate');
// Alert for the user
Alert::set($Language->g('Post added successfully'));
Redirect::page('admin', 'manage-posts');
}
else {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to create the post.');
Log::set(__METHOD__.LOG_SEP.'Cleaning database...');
$dbPosts->delete($key);
}
echo '
</tbody>
</table>
';
return false;
}
// ============================================================================
@ -44,8 +46,11 @@ function printTable($title, $array) {
// POST Method
// ============================================================================
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
addPost($_POST);
}
// ============================================================================
// Main after POST
// ============================================================================
$layout['title'] .= ' - '.$L->g('Developers');

View File

@ -4,7 +4,10 @@
// Check role
// ============================================================================
checkRole(array('admin'));
if($Login->role()!=='admin') {
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
Redirect::page('admin', 'dashboard');
}
// ============================================================================
// Functions
@ -21,6 +24,3 @@ checkRole(array('admin'));
// ============================================================================
// Main after POST
// ============================================================================
// Title of the page
$layout['title'] .= ' - '.$L->g('Plugins');

View File

@ -0,0 +1,78 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// ============================================================================
// Check role
// ============================================================================
if($Login->role()!=='admin') {
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
Redirect::page('admin', 'dashboard');
}
// ============================================================================
// Functions
// ============================================================================
function setSettings($args)
{
global $Site;
global $Language;
// Add slash at the begin and end.
// This fields are in the settings->advanced mode
$args['url'] = Text::addSlashes($args['url'],false,true);
$args['uriPost'] = Text::addSlashes($args['uriPost']);
$args['uriPage'] = Text::addSlashes($args['uriPage']);
$args['uriTag'] = Text::addSlashes($args['uriTag']);
if(($args['uriPost']==$args['uriPage']) || ($args['uriPost']==$args['uriTag']) || ($args['uriPage']==$args['uriTag']) )
{
$args = array();
}
if( $Site->set($args) ) {
Alert::set($Language->g('the-changes-have-been-saved'));
}
else {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the settings.');
}
return true;
}
// ============================================================================
// Main after POST
// ============================================================================
// ============================================================================
// POST Method
// ============================================================================
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
setSettings($_POST);
Redirect::page('admin', $layout['controller']);
}
// ============================================================================
// Main after POST
// ============================================================================
// Default home page
$_homePageList = array(''=>$Language->g('Show blog'));
foreach($pagesParents as $parentKey=>$pageList)
{
foreach($pageList as $Page)
{
if($parentKey!==NO_PARENT_CHAR) {
$parentTitle = $pages[$Page->parentKey()]->title().'->';
}
else {
$parentTitle = '';
}
if($Page->published()) {
$_homePageList[$Page->key()] = $Language->g('Page').': '.$parentTitle.$Page->title();
}
}
}

View File

@ -0,0 +1,80 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// ============================================================================
// Check role
// ============================================================================
if($Login->role()!=='admin') {
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
Redirect::page('admin', 'dashboard');
}
// ============================================================================
// Functions
// ============================================================================
function setSettings($args)
{
global $Site;
global $Language;
// Add slash at the begin and end.
// This fields are in the settings->advanced mode
if(isset($args['form-advanced'])) {
$args['url'] = Text::addSlashes($args['url'],false,true);
$args['uriPost'] = Text::addSlashes($args['uriPost']);
$args['uriPage'] = Text::addSlashes($args['uriPage']);
$args['uriTag'] = Text::addSlashes($args['uriTag']);
if(($args['uriPost']==$args['uriPage']) || ($args['uriPost']==$args['uriTag']) || ($args['uriPage']==$args['uriTag']) )
{
$args = array();
}
}
if( $Site->set($args) ) {
Alert::set($Language->g('the-changes-have-been-saved'));
}
else {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the settings.');
}
return true;
}
// ============================================================================
// Main after POST
// ============================================================================
// ============================================================================
// POST Method
// ============================================================================
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
setSettings($_POST);
Redirect::page('admin', $layout['controller']);
}
// ============================================================================
// Main after POST
// ============================================================================
// Default home page
$_homePageList = array(''=>$Language->g('Show blog'));
foreach($pagesParents as $parentKey=>$pageList)
{
foreach($pageList as $Page)
{
if($parentKey!==NO_PARENT_CHAR) {
$parentTitle = $pages[$Page->parentKey()]->title().'->';
}
else {
$parentTitle = '';
}
if($Page->published()) {
$_homePageList[$Page->key()] = $Language->g('Page').': '.$parentTitle.$Page->title();
}
}
}

View File

@ -0,0 +1,80 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// ============================================================================
// Check role
// ============================================================================
if($Login->role()!=='admin') {
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
Redirect::page('admin', 'dashboard');
}
// ============================================================================
// Functions
// ============================================================================
function setSettings($args)
{
global $Site;
global $Language;
// Add slash at the begin and end.
// This fields are in the settings->advanced mode
if(isset($args['form-advanced'])) {
$args['url'] = Text::addSlashes($args['url'],false,true);
$args['uriPost'] = Text::addSlashes($args['uriPost']);
$args['uriPage'] = Text::addSlashes($args['uriPage']);
$args['uriTag'] = Text::addSlashes($args['uriTag']);
if(($args['uriPost']==$args['uriPage']) || ($args['uriPost']==$args['uriTag']) || ($args['uriPage']==$args['uriTag']) )
{
$args = array();
}
}
if( $Site->set($args) ) {
Alert::set($Language->g('the-changes-have-been-saved'));
}
else {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the settings.');
}
return true;
}
// ============================================================================
// Main after POST
// ============================================================================
// ============================================================================
// POST Method
// ============================================================================
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
setSettings($_POST);
Redirect::page('admin', $layout['controller']);
}
// ============================================================================
// Main after POST
// ============================================================================
// Default home page
$_homePageList = array(''=>$Language->g('Show blog'));
foreach($pagesParents as $parentKey=>$pageList)
{
foreach($pageList as $Page)
{
if($parentKey!==NO_PARENT_CHAR) {
$parentTitle = $pages[$Page->parentKey()]->title().'->';
}
else {
$parentTitle = '';
}
if($Page->published()) {
$_homePageList[$Page->key()] = $Language->g('Page').': '.$parentTitle.$Page->title();
}
}
}

View File

@ -4,12 +4,44 @@
// Check role
// ============================================================================
checkRole(array('admin'));
if($Login->role()!=='admin') {
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
Redirect::page('admin', 'dashboard');
}
// ============================================================================
// Functions
// ============================================================================
function setSettings($args)
{
global $Site;
global $Language;
// Add slash at the begin and end.
// This fields are in the settings->advanced mode
if(isset($args['form-advanced'])) {
$args['url'] = Text::addSlashes($args['url'],false,true);
$args['uriPost'] = Text::addSlashes($args['uriPost']);
$args['uriPage'] = Text::addSlashes($args['uriPage']);
$args['uriTag'] = Text::addSlashes($args['uriTag']);
if(($args['uriPost']==$args['uriPage']) || ($args['uriPost']==$args['uriTag']) || ($args['uriPage']==$args['uriTag']) )
{
$args = array();
}
}
if( $Site->set($args) ) {
Alert::set($Language->g('the-changes-have-been-saved'));
}
else {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the settings.');
}
return true;
}
// ============================================================================
// Main after POST
// ============================================================================
@ -18,14 +50,31 @@ checkRole(array('admin'));
// POST Method
// ============================================================================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
editSettings($_POST);
Redirect::page('settings');
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
setSettings($_POST);
Redirect::page('admin', $layout['controller']);
}
// ============================================================================
// Main after POST
// ============================================================================
// Title of the page
$layout['title'] .= ' - '.$L->g('Advanced Settings');
// Default home page
$_homePageList = array(''=>$Language->g('Show blog'));
foreach($pagesParents as $parentKey=>$pageList)
{
foreach($pageList as $Page)
{
if($parentKey!==NO_PARENT_CHAR) {
$parentTitle = $pages[$Page->parentKey()]->title().'->';
}
else {
$parentTitle = '';
}
if($Page->published()) {
$_homePageList[$Page->key()] = $Language->g('Page').': '.$parentTitle.$Page->title();
}
}
}

View File

@ -4,7 +4,10 @@
// Check role
// ============================================================================
checkRole(array('admin'));
if($Login->role()!=='admin') {
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
Redirect::page('admin', 'dashboard');
}
// ============================================================================
// Main after POST
@ -19,6 +22,3 @@ checkRole(array('admin'));
// ============================================================================
$themes = buildThemes();
// Title of the page
$layout['title'] .= ' - '.$L->g('Themes');

View File

@ -4,14 +4,17 @@
// Check role
// ============================================================================
checkRole(array('admin'));
if($Login->role()!=='admin') {
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
Redirect::page('admin', 'dashboard');
}
// ============================================================================
// Functions
// ============================================================================
// ============================================================================
// Main before POST
// Main after POST
// ============================================================================
// ============================================================================
@ -22,5 +25,8 @@ checkRole(array('admin'));
// Main after POST
// ============================================================================
$pluginClassName = $layout['parameters'];
deactivatePlugin($pluginClassName);
Redirect::page('plugins');
$Plugin = new $pluginClassName;
$Plugin->uninstall();
Redirect::page('admin', 'plugins');

View File

@ -4,6 +4,35 @@
// Functions
// ============================================================================
function setPassword($username, $new_password, $confirm_password)
{
global $dbUsers;
global $Language;
// Password length
if( strlen($new_password) < 6 )
{
Alert::set($Language->g('Password must be at least 6 characters long'), ALERT_STATUS_FAIL);
return false;
}
if($new_password===$confirm_password)
{
if( $dbUsers->setPassword($username, $new_password) ) {
Alert::set($Language->g('The changes have been saved'), ALERT_STATUS_OK);
return true;
}
else {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to change the user password.');
return false;
}
}
else {
Alert::set($Language->g('The password and confirmation password do not match'), ALERT_STATUS_FAIL);
return false;
}
}
// ============================================================================
// Main before POST
// ============================================================================
@ -12,22 +41,17 @@
// POST Method
// ============================================================================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Prevent non-administrators to change other users
$username = $_POST['username'];
if ($login->role()!=='admin') {
$username = $login->username();
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
// Prevent editors to administrate other users.
if($Login->role()!=='admin')
{
$_POST['username'] = $Login->username();
unset($_POST['role']);
}
if (changeUserPassword(array(
'username'=>$username,
'newPassword'=>$_POST['newPassword'],
'confirmPassword'=>$_POST['confirmPassword']
))) {
if ($login->role()==='admin') {
Redirect::page('users');
}
Redirect::page('edit-user/'.$login->username());
if( setPassword($_POST['username'], $_POST['new_password'], $_POST['confirm_password']) ) {
Redirect::page('admin', 'users');
}
}
@ -35,17 +59,15 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Main after POST
// ============================================================================
// Prevent non-administrators to change other users
if ($login->role()!=='admin') {
$layout['parameters'] = $login->username();
if($Login->role()!=='admin') {
$layout['parameters'] = $Login->username();
}
try {
$username = $layout['parameters'];
$user = new User($username);
} catch (Exception $e) {
Redirect::page('users');
$_user = $dbUsers->getDb($layout['parameters']);
// If the user doesn't exist, redirect to the users list.
if($_user===false) {
Redirect::page('admin', 'users');
}
// Title of the page
$layout['title'] = $L->g('Change password').' - '.$layout['title'];
$_user['username'] = $layout['parameters'];

View File

@ -4,7 +4,10 @@
// Check role
// ============================================================================
checkRole(array('admin'));
if($Login->role()!=='admin') {
Alert::set($Language->g('you-do-not-have-sufficient-permissions'));
Redirect::page('admin', 'dashboard');
}
// ============================================================================
// Functions
@ -20,12 +23,9 @@ checkRole(array('admin'));
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
$site->set($_POST);
$Site->set($_POST);
}
// ============================================================================
// Main after POST
// ============================================================================
// Title of the page
$layout['title'] .= ' - '.$L->g('Users');

View File

@ -1,62 +0,0 @@
a {
color: #0078D4;
}
a:hover {
color: #003f6f;
text-decoration: none;
}
.bg-success {
background-color: #8BC34A!important;
}
.text-primary {
color: #0078D4!important;
}
.text-danger {
color: #D40000!important;
}
a.text-danger:focus,
a.text-danger:hover {
color: #790000!important;
}
/* Buttons */
.btn {
border-radius: 2px;
}
.btn-primary {
background-color: #0078D4;
border-color: #0078D4;
}
.btn-primary:hover {
background-color: #4585CF;
border-color: #4a90e2;
}
.btn-light.focus, .btn-light:focus {
box-shadow: none;
}
.btn.focus, .btn:focus {
box-shadow: none;
}
/* Form */
.form-control:focus {
box-shadow: none;
}
/* Tables */
.table-striped tbody tr:nth-of-type(odd) {
background-color: rgba(0, 0, 0, 0.02);
}
.table thead th {
font-size: 0.8em;
text-transform: uppercase!important;
}

View File

@ -1,364 +0,0 @@
html {
height: 100%;
font-size: 0.9rem;
background: #fcfcfc;
}
body {
background: #fcfcfc;
}
/* Prevent events in iframes */
/* iframe{
pointer-events: none;
} */
/*
ICONS
*/
.fa {
padding-right: 2px;
line-height: inherit;
}
/*
SIDEBAR
*/
div.sidebar .nav-item a {
padding-left:0;
padding-right:0;
color: #555;
padding-top: 5px;
padding-bottom: 5px;
}
div.sidebar .nav-item a:hover {
color: #0078D4;
}
div.sidebar .nav-item h4 {
font-size: 1.2em;
text-transform: uppercase;
font-weight: 400;
margin-top: 10px;
}
/*
AUTOCOMPLETE SEARCH
*/
.search-suggestion {
padding: 5px;
}
.search-suggestion-options {
font-size: 0.9em;
padding-top: 2px;
}
/*
BOOTSTRAP Hacks
*/
@media (min-width: 1200px) {
.container {
max-width: 1250px;
}
}
/* for small devices */
@media (max-width: 575.98px) {
#jsmediaManagerButton,
#jscategoryButton,
#jsdescriptionButton {
width: 100%;
text-align: left;
}
}
.btn-light {
color: #212529;
background-color: #f3f3f3;
border-color: #ced4d9;
}
.btn-form {
background-color: #F3F3F3;
border-color: #DDD;
color: #000;
}
.btn-form:hover {
background-color: rgb(228, 228, 228);
border-color: #DDD;
color: #000;
}
code {
padding: 3px 5px 2px;
margin: 0 1px;
background: #eaeaea;
background: rgba(0,0,0,.07);
color: #444;
}
.list-group-sortable {
cursor: pointer;
}
.modal-body {
padding: 2rem;
}
.modal-footer {
background-color: rgb(247, 247, 247);
}
.modal-dialog .btn-link {
color: #000;
}
/*
LOGIN
*/
body.login {
background: rgb(255,255,255);
background: linear-gradient(0deg, rgba(255,255,255,1) 0%, rgba(250,250,250,1) 53%);
height: 100%;
}
/*
DASHBOARD
*/
#dashboard ul.list-group.list-group-striped li {
border: none;
word-break: break-word;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
#dashboard ul.list-group.list-group-striped li:nth-of-type(even) {
background: #f1f1f1;
}
#dashboard div.quick-links-icons {
font-size: 3em;
width: 100%;
}
#dashboard a.quick-links {
color: #777;
}
#dashboard a.quick-links:hover {
text-decoration: none;
color: #4586d4;
}
#hello-message {
padding: 10px 0;
color: #777;
margin-bottom: 20px;
}
#hello-message span.oi {
top: 3px;
}
.ct-series-a .ct-line {
/* Set the colour of this series line */
stroke: #4a90e2;
/* Control the thikness of your lines */
stroke-width: 2px;
/* Create a dashed line with a pattern */
}
.ct-series-a .ct-point {
/* Colour of your points */
stroke: #4a90e2;
/* Size of your points */
stroke-width: 8px;
}
/*
ALERT
*/
#alert {
display: none;
position: fixed;
text-align: center;
border-radius: 0px;
border: 0;
z-index: 1000;
bottom: 0;
right: 0;
margin: 0;
}
.alert-success {
background-color: #4586d4;
border-left: 6px solid #abd1ff !important;
color: #ffffff;
}
.alert-danger {
background-color: #d44545;
border-left: 6px solid #ff9c9c !important;
color: #ffffff;
}
/*
PLUGINS
*/
.plugin-form label {
display: block;
margin-top: 1rem !important;
}
.plugin-form input[type="text"],
.plugin-form textarea,
.plugin-form select {
display: block;
width: 100%;
padding: .375rem .75rem;
font-size: 1rem;
line-height: 1.5;
color: #495057;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #ced4da;
border-radius: .25rem;
transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}
.plugin-form textarea {
min-height: 120px;
}
.plugin-form span.tip {
display: block;
font-size: 80%;
font-weight: 400;
margin-top: .25rem;
color: #6c757d !important;
}
/*
Manage > Content
*/
td.child {
padding-left: 30px;
}
/*
Manage > New Content
*/
#jseditor {
background: #fff;
padding: 10px 5% !important;
font-size: 16px;
line-height: 1.5em;
border: 1px solid #ced4da;
}
#jseditorSidebar {
display: none;
height: calc(100% - 45px);
width: 50%;
max-width: 350px;
position: absolute;
z-index: 50;
top: 45px;
right: 15px;
background-color: #fff;
overflow-x: hidden;
transition: 0.5s;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
border-top: 1px solid #ccc;
}
@media (max-width: 575.98px) {
#jseditorSidebar {
width: 100%;
max-width: 100%;
right: 0;
}
#jseditorToolbarRight button {
font-size: 0px !important;
}
#jseditorToolbarRight button span {
font-size: 16px !important;
}
.contentTools .btn {
font-size: 0px !important;
margin-right: 5px;
}
.contentTools .btn span {
font-size: 16px !important;
}
}
#jseditorSidebar nav {
background: #f3f3f3;
}
#jseditorSidebar nav a {
color: #000;
}
#jseditorSidebar .nav-tabs .nav-link {
border: none;
}
#jseditorSidebar .nav-link.active {
background: none;
border: none;
border-bottom: 3px solid #ccc;
}
#jsshadow {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: rgba(72,72,72,0.7);
z-index: 10;
display: none;
}
img.profilePicture {
width: 30px;
height: 30px;
border-radius: 30px;
border: 1px solid #ccc;
}
/* Switch button */
.switch-button {
font-size: 0.9em;
text-transform: uppercase;
cursor: pointer;
}
.switch-icon-publish {
color: #1cb11c;
}

View File

@ -1,17 +0,0 @@
<script charset="utf-8">
function showAlert(text) {
console.log("[INFO] Function showAlert() called.");
$("#alert").html(text);
$("#alert").slideDown().delay(<?php echo ALERT_DISAPPEAR_IN*1000 ?>).slideUp();
}
<?php if (Alert::defined()): ?>
setTimeout(function(){ showAlert("<?php echo Alert::get() ?>") }, 500);
<?php endif; ?>
$(window).click(function() {
$("#alert").hide();
});
</script>
<div id="alert" class="alert <?php echo (Alert::status()==ALERT_STATUS_FAIL)?'alert-danger':'alert-success' ?>"></div>

View File

@ -1,260 +0,0 @@
<?php
// Preload the first 10 files to not call via AJAX when the user open the first time the media manager
$listOfFilesByPage = Filesystem::listFiles(PAGE_THUMBNAILS_DIRECTORY, '*', '*', MEDIA_MANAGER_SORT_BY_DATE, MEDIA_MANAGER_NUMBER_OF_FILES);
$preLoadFiles = array();
if (!empty($listOfFilesByPage[0])) {
foreach ($listOfFilesByPage[0] as $file) {
$filename = Filesystem::filename($file);
array_push($preLoadFiles, $filename);
}
}
// Amount of pages for the paginator
$numberOfPages = count($listOfFilesByPage);
?>
<div id="jsmediaManagerModal" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="container-fluid">
<div class="row">
<div class="col p-3">
<!--
UPLOAD INPUT
-->
<h3 class="mt-2 mb-3"><i class="fa fa-image"></i> <?php $L->p('Images'); ?></h3>
<div id="jsalertMedia" class="alert alert-warning d-none" role="alert"></div>
<!-- Form and Input file -->
<form name="bluditFormUpload" id="jsbluditFormUpload" enctype="multipart/form-data">
<div class="custom-file">
<input type="file" class="custom-file-input" id="jsimages" name="images[]" multiple>
<label class="custom-file-label" for="jsimages"><?php $L->p('Choose images to upload'); ?></label>
</div>
</form>
<!-- Progress bar -->
<div class="progress mt-2">
<div id="jsbluditProgressBar" class="progress-bar bg-primary" role="progressbar" style="width:0%"></div>
</div>
<!--
IMAGES LIST
-->
<!-- Table for list files -->
<table id="jsbluditMediaTable" class="table mt-2">
<tr>
<td><?php $L->p('There are no images'); ?></td>
</tr>
</table>
<!-- Paginator -->
<nav id="jsbluditMediaTablePagination"></nav>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
<?php
echo 'var preLoadFiles = '.json_encode($preLoadFiles).';';
?>
function openMediaManager() {
$('#jsmediaManagerModal').modal('show');
}
function closeMediaManager() {
$('#jsmediaManagerModal').modal('hide');
}
// Remove all files from the table
function cleanTable() {
$('#jsbluditMediaTable').empty();
}
function showMediaAlert(message) {
$("#jsalertMedia").html(message).removeClass('d-none');
}
function hideMediaAlert() {
$("#jsalertMedia").addClass('d-none');
}
// Show the files in the table
function displayFiles(files, numberOfPages = <?= $numberOfPages ?>) {
if (!Array.isArray(files)) {
return false;
}
// Clean table
cleanTable();
// Regenerate the table
if (files.length > 0) {
$.each(files, function(key, filename) {
var thumbnail = "<?php echo PAGE_THUMBNAILS_URL; ?>"+filename;
var image = "<?php echo PAGE_IMAGES_URL; ?>"+filename;
tableRow = '<tr id="js'+filename+'">'+
'<td style="width:80px"><img class="img-thumbnail" alt="200x200" src="'+thumbnail+'" style="width: 50px; height: 50px;"><\/td>'+
'<td class="information">'+
'<div class="text-primary pb-2">'+filename+'<\/div>'+
'<div>'+
'<a href="#" class="mr-3 text-secondary" onClick="editorInsertMedia(\''+image+'\'); closeMediaManager();"><i class="fa fa-plus"></i><?php $L->p('Insert') ?><\/a>'+
'<a href="#" class="text-secondary" onClick="setCoverImage(\''+filename+'\'); closeMediaManager();"><i class="fa fa-square-o"></i><?php $L->p('Set as cover image') ?><\/button>'+
'<a href="#" class="float-right text-danger" onClick="deleteMedia(\''+filename+'\')"><i class="fa fa-trash-o"></i><?php $L->p('Delete') ?><\/a>'+
'<\/div>'+
'<\/td>'+
'<\/tr>';
$('#jsbluditMediaTable').append(tableRow);
});
mediaPagination = '<ul class="pagination justify-content-center flex-wrap">';
for (var i = 1; i <= numberOfPages; i++) {
mediaPagination += '<li class="page-item"><button type="button" class="btn btn-link page-link" onClick="getFiles('+i+')">'+i+'</button></li>';
}
mediaPagination += '</ul>';
$('#jsbluditMediaTablePagination').html(mediaPagination);
}
if (files.length == 0) {
$('#jsbluditMediaTable').html("<p><?php (IMAGE_RESTRICT ? $L->p('There are no images for the page') : $L->p('There are no images')) ?></p>");
$('#jsbluditMediaTablePagination').html('');
}
}
// Get the list of files via AJAX, filter by the page number
function getFiles(pageNumber) {
$.post(HTML_PATH_ADMIN_ROOT+"ajax/list-images",
{ tokenCSRF: tokenCSRF,
pageNumber: pageNumber,
uuid: "<?php echo PAGE_IMAGES_KEY ?>",
path: "thumbnails" // the paths are defined in ajax/list-images
},
function(data) { // success function
if (data.status==0) {
displayFiles(data.files, data.numberOfPages);
} else {
console.log(data.message);
}
}
);
}
// Delete the file and the thumbnail if exist
function deleteMedia(filename) {
$.post(HTML_PATH_ADMIN_ROOT+"ajax/delete-image",
{ tokenCSRF: tokenCSRF,
filename: filename,
uuid: "<?php echo PAGE_IMAGES_KEY; ?>"
},
function(data) { // success function
if (data.status==0) {
getFiles(1);
} else {
console.log(data.message);
}
}
);
}
function setCoverImage(filename) {
var image = "<?php echo PAGE_IMAGES_URL; ?>"+filename;
$("#jscoverImage").val(filename);
$("#jscoverImagePreview").attr("src", image);
}
function uploadImages() {
// Remove current alerts
hideMediaAlert();
var images = $("#jsimages")[0].files;
for (var i=0; i < images.length; i++) {
// Check file type/extension
const validImageTypes = ['image/gif', 'image/jpeg', 'image/png', 'image/svg+xml'];
if (!validImageTypes.includes(images[i].type)) {
showMediaAlert("<?php echo $L->g('File type is not supported. Allowed types:').' '.implode(', ',$GLOBALS['ALLOWED_IMG_EXTENSION']) ?>");
return false;
}
// Check file size and compare with PHP upload_max_filesize
if (images[i].size > UPLOAD_MAX_FILESIZE) {
showMediaAlert("<?php echo $L->g('Maximum load file size allowed:').' '.ini_get('upload_max_filesize') ?>");
return false;
}
};
// Clean progress bar
$("#jsbluditProgressBar").removeClass().addClass("progress-bar bg-primary");
$("#jsbluditProgressBar").width("0");
// Data to send via AJAX
var formData = new FormData($("#jsbluditFormUpload")[0]);
formData.append("uuid", "<?php echo PAGE_IMAGES_KEY ?>");
formData.append("tokenCSRF", tokenCSRF);
$.ajax({
url: HTML_PATH_ADMIN_ROOT+"ajax/upload-images",
type: "POST",
data: formData,
cache: false,
contentType: false,
processData: false,
xhr: function() {
var xhr = $.ajaxSettings.xhr();
if (xhr.upload) {
xhr.upload.addEventListener("progress", function(e) {
if (e.lengthComputable) {
var percentComplete = (e.loaded / e.total)*100;
$("#jsbluditProgressBar").width(percentComplete+"%");
}
}, false);
}
return xhr;
}
}).done(function(data) {
if (data.status==0) {
$("#jsbluditProgressBar").removeClass("bg-primary").addClass("bg-success");
// Get the files for the first page, this include the files uploaded
getFiles(1);
} else {
$("#jsbluditProgressBar").removeClass("bg-primary").addClass("bg-danger");
showMediaAlert(data.message);
}
});
}
$(document).ready(function() {
// Display the files preloaded for the first time
displayFiles(preLoadFiles);
// Select image event
$("#jsimages").on("change", function(e) {
uploadImages();
});
// Drag and drop image
$(window).on("dragover dragenter", function(e) {
e.preventDefault();
e.stopPropagation();
openMediaManager();
});
// Drag and drop image
$(window).on("drop", function(e) {
e.preventDefault();
e.stopPropagation();
$("#jsimages").prop("files", e.originalEvent.dataTransfer.files);
uploadImages();
});
});
</script>

View File

@ -1,58 +0,0 @@
<nav class="navbar navbar-expand-lg navbar-dark bg-dark text-uppercase d-block d-lg-none">
<div class="container">
<span class="navbar-brand">
<?php echo (defined('BLUDIT_PRO'))?'BLUDIT PRO':'BLUDIT' ?></span>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'dashboard' ?>">
<?php $L->p('Dashboard') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ROOT ?>">
<?php $L->p('Website') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'new-content' ?>">
<?php $L->p('New content') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'content' ?>">
<?php $L->p('Content') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'categories' ?>">
<?php $L->p('Categories') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>">
<?php $L->p('Users') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'settings' ?>">
<?php $L->p('Settings') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'plugins' ?>">
<?php $L->p('Plugins') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'themes' ?>">
<?php $L->p('Themes') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'about' ?>">
<?php $L->p('About') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'logout' ?>">
<?php $L->p('Logout') ?></a>
</li>
</ul>
</div>
</div>
</nav>

View File

@ -1,80 +0,0 @@
<!-- Use .flex-column to set a vertical direction -->
<ul class="nav flex-column pt-4">
<li class="nav-item mb-4" style="margin-left: -4px;">
<img src="<?php echo HTML_PATH_CORE_IMG ?>logo.svg" width="20" height="20" alt="bludit-logo"><span class="ml-2 align-middle"><?php echo (defined('BLUDIT_PRO'))?'BLUDIT PRO':'BLUDIT' ?></span>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'dashboard' ?>"><span class="fa fa-dashboard"></span><?php $L->p('Dashboard') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" target="_blank" href="<?php echo HTML_PATH_ROOT ?>"><span class="fa fa-home"></span><?php $L->p('Website') ?></a>
</li>
<li class="nav-item mt-3">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'new-content' ?>"><span style="color: #0078D4;" class="fa fa-plus-circle"></span><?php $L->p('New content') ?></a>
</li>
<?php if (!checkRole(array('admin'),false)): ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'content' ?>"><span class="fa fa-archive"></span><?php $L->p('Content') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'edit-user/'.$login->username() ?>"><span class="fa fa-user"></span><?php $L->p('Profile') ?></a>
</li>
<?php endif; ?>
<?php if (checkRole(array('admin'),false)): ?>
<li class="nav-item mt-3">
<h4><?php $L->p('Manage') ?></h4>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'content' ?>"><?php $L->p('Content') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'categories' ?>"><?php $L->p('Categories') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>"><?php $L->p('Users') ?></a>
</li>
<li class="nav-item mt-3">
<h4><?php $L->p('Settings') ?></h4>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'settings' ?>"><?php $L->p('General') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'plugins' ?>"><?php $L->p('Plugins') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'themes' ?>"><?php $L->p('Themes') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'about' ?>"><?php $L->p('About') ?></a>
</li>
<?php endif; ?>
<?php if (checkRole(array('admin', 'editor'),false)): ?>
<?php
if (!empty($plugins['adminSidebar'])) {
echo '<li class="nav-item"><hr></li>';
foreach ($plugins['adminSidebar'] as $pluginSidebar) {
echo '<li class="nav-item">';
echo $pluginSidebar->adminSidebar();
echo '</li>';
}
}
?>
<?php endif; ?>
<li class="nav-item mt-5">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'logout' ?>"><span class="fa fa-arrow-circle-right"></span><?php $L->p('Logout') ?></a>
</li>
</ul>

View File

@ -1,96 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title><?php echo $layout['title'] ?></title>
<meta charset="<?php echo CHARSET ?>">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="robots" content="noindex,nofollow">
<meta name="generator" content="Bludit">
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="<?php echo HTML_PATH_CORE_IMG.'favicon.png?version='.BLUDIT_VERSION ?>">
<!-- CSS -->
<?php
echo Theme::cssBootstrap();
echo Theme::cssLineAwesome();
echo Theme::css(array(
'bludit.css',
'bludit.bootstrap.css'
), DOMAIN_ADMIN_THEME_CSS);
echo Theme::css(array(
'jquery.datetimepicker.min.css',
'select2.min.css',
'select2-bootstrap4.min.css'
), DOMAIN_CORE_CSS);
?>
<!-- Javascript -->
<?php
echo Theme::jquery();
echo Theme::jsBootstrap();
echo Theme::jsSortable();
echo Theme::js(array(
'jquery.datetimepicker.full.min.js',
'select2.full.min.js',
'functions.js'
), DOMAIN_CORE_JS);
?>
<!-- Plugins -->
<?php Theme::plugins('adminHead') ?>
</head>
<body class="h-100">
<!-- Plugins -->
<?php Theme::plugins('adminBodyBegin') ?>
<!-- Javascript dynamic generated by PHP -->
<?php
echo '<script charset="utf-8">'.PHP_EOL;
include(PATH_CORE_JS.'variables.php');
echo '</script>'.PHP_EOL;
echo '<script charset="utf-8">'.PHP_EOL;
include(PATH_CORE_JS.'bludit-ajax.php');
echo '</script>'.PHP_EOL;
?>
<!-- Overlay background -->
<div id="jsshadow"></div>
<!-- Alert -->
<?php include('html/alert.php'); ?>
<!-- Navbar, only for small devices -->
<?php include('html/navbar.php'); ?>
<div class="container h-100">
<!-- 25%/75% split on large devices, small, medium devices hide -->
<div class="row h-100">
<!-- LEFT SIDEBAR - Display only on large devices -->
<div class="sidebar col-lg-2 d-none d-lg-block">
<?php include('html/sidebar.php'); ?>
</div>
<!-- RIGHT MAIN -->
<div class="col-lg-10 pt-3 pb-1 h-100">
<?php
if (Sanitize::pathFile(PATH_ADMIN_VIEWS, $layout['view'].'.php')) {
include(PATH_ADMIN_VIEWS.$layout['view'].'.php');
} else {
echo '<h1 class="text-center">'.$L->g('Page not found').'</h1>';
echo '<h2 class="text-center">'.$L->g('Choose a page from the sidebar.').'</h2>';
}
?>
</div>
</div>
</div>
<!-- Plugins -->
<?php Theme::plugins('adminBodyEnd') ?>
</body>
</html>

View File

@ -1,401 +0,0 @@
<?php
class Bootstrap {
public static function modal($args) {
$buttonSecondary = $args['buttonSecondary'];
$buttonSecondaryClass = $args['buttonSecondaryClass'];
$buttonPrimary = $args['buttonPrimary'];
$buttonPrimaryClass = $args['buttonPrimaryClass'];
$modalText = $args['modalText'];
$modalTitle = $args['modalTitle'];
$modalId = $args['modalId'];
return <<<EOF
<div id="$modalId" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
<h3>$modalTitle</h3>
<p>$modalText</p>
</div>
<div class="modal-footer">
<button type="button" class="btn $buttonSecondaryClass" data-dismiss="modal">$buttonSecondary</button>
<button type="button" class="btn $buttonPrimaryClass">$buttonPrimary</button>
</div>
</div>
</div>
</div>
EOF;
}
public static function link($args)
{
$options = 'href="'.$args['href'].'"';
if (isset($args['class'])) {
$options .= ' class="'.$args['class'].'"';
}
if (isset($args['target'])) {
$options .= ' target="'.$args['target'].'"';
}
if (isset($args['icon'])) {
return '<a '.$options.'><span class="fa fa-'.$args['icon'].'"></span>'.$args['title'].'</a>';
}
return '<a '.$options.'>'.$args['title'].'</a>';
}
public static function pageTitle($args)
{
$icon = $args['icon'];
$title = $args['title'];
return <<<EOF
<h2 class="mt-0 mb-3">
<span class="fa fa-$icon" style="font-size: 0.9em;"></span><span>$title</span>
</h2>
EOF;
}
public static function formOpen($args)
{
$class = empty($args['class'])?'':'class="'.$args['class'].'"';
$id = empty($args['id'])?'':'id="'.$args['id'].'"';
$enctype = empty($args['enctype'])?'':'enctype="'.$args['enctype'].'"';
$action = empty($args['action'])?'action=""':'action="'.$args['action'].'"';
$method = empty($args['method'])?'method="post"':'method="'.$args['method'].'"';
$style = empty($args['style'])?'':'style="'.$args['style'].'"';
return <<<EOF
<form $class $enctype $id $method $action $style autocomplete="off">
EOF;
}
public static function formClose()
{
return <<<EOF
</form>
<script>
$(document).ready(function() {
// Prevent the form submit when press enter key.
$("form").keypress(function(e) {
if ((e.which == 13) && (e.target.type !== "textarea")) {
return false;
}
});
});
</script>
EOF;
}
public static function formTitle($args)
{
$title = $args['title'];
return <<<EOF
<h6 class="mt-4 mb-2 pb-2 border-bottom text-uppercase">$title</h6>
EOF;
}
public static function formInputTextBlock($args)
{
$name = $args['name'];
$disabled = empty($args['disabled'])?'':'disabled';
$placeholder = isset($args['placeholder'])?$args['placeholder']:'';
$value = isset($args['value'])?$args['value']:'';
$id = 'js'.$name;
if (isset($args['id'])) {
$id = $args['id'];
}
$tip = '';
if (!empty($args['tip'])) {
$tip = '<small class="form-text text-muted">'.$args['tip'].'</small>';
}
$class = 'form-group m-0';
if (isset($args['class'])) {
$class = $args['class'];
}
$labelClass = 'mt-4 mb-2 pb-2 border-bottom text-uppercase w-100';
if (isset($args['labelClass'])) {
$labelClass = $args['labelClass'];
}
$label = '';
if (!empty($args['label'])) {
$label = '<label class="'.$labelClass.'" for="'.$id.'">'.$args['label'].'</label>';
}
$type = 'text';
if (isset($args['type'])) {
$type = $args['type'];
}
return <<<EOF
<div class="$class">
$label
<input type="text" value="$value" class="form-control" id="$id" name="$name" placeholder="$placeholder" $disabled>
$tip
</div>
EOF;
}
public static function formInputFile($args)
{
$id = 'js'.$args['name'];
if (isset($args['id'])) {
$id = $args['id'];
}
$class = 'custom-file';
if (isset($args['class'])) {
$class = $class.' '.$args['class'];
}
$html = '<div class="'.$class.'">';
$html .= '<input type="file" class="custom-file-input" id="'.$id.'">';
$html .= '<label class="custom-file-label" for="'.$id.'">'.$args['label'].'</label>';
$html .= '</div>';
return $html;
}
public static function formTextarea($args)
{
$id = 'js'.$args['name'];
if (isset($args['id'])) {
$id = $args['id'];
}
$class = 'form-control';
if (isset($args['class'])) {
$class = $class.' '.$args['class'];
}
$html = '<div class="form-group row">';
if (!empty($args['label'])) {
$html .= '<label for="'.$id.'" class="col-sm-2 col-form-label">'.$args['label'].'</label>';
}
$html .= '<div class="col-sm-10">';
$html .= '<textarea class="'.$class.'" id="'.$id.'" name="'.$args['name'].'" rows="'.$args['rows'].'" placeholder="'.$args['placeholder'].'">'.$args['value'].'</textarea>';
if (isset($args['tip'])) {
$html .= '<small class="form-text text-muted">'.$args['tip'].'</small>';
}
$html .= '</div>';
$html .= '</div>';
return $html;
}
public static function formTextareaBlock($args)
{
$id = 'js'.$args['name'];
if (isset($args['id'])) {
$id = $args['id'];
}
$class = 'form-control';
if (!empty($args['class'])) {
$class = $class.' '.$args['class'];
}
$html = '<div class="form-group m-0">';
if (!empty($args['label'])) {
$html .= '<label class="mt-4 mb-2 pb-2 border-bottom text-uppercase w-100" for="'.$id.'">'.$args['label'].'</label>';
}
$html .= '<textarea class="'.$class.'" id="'.$id.'" name="'.$args['name'].'" rows="'.$args['rows'].'" placeholder="'.$args['placeholder'].'">'.$args['value'].'</textarea>';
if (!empty($args['tip'])) {
$html .= '<small class="form-text text-muted">'.$args['tip'].'</small>';
}
$html .= '</div>';
return $html;
}
public static function formInputText($args)
{
$name = $args['name'];
$disabled = empty($args['disabled'])?'':'disabled';
$readonly = empty($args['readonly'])?'':'readonly';
$placeholder = isset($args['placeholder'])?$args['placeholder']:'';
$value = isset($args['value'])?$args['value']:'';
$id = 'js'.$name;
if (isset($args['id'])) {
$id = $args['id'];
}
$tip = '';
if (isset($args['tip'])) {
$tip = '<small class="form-text text-muted">'.$args['tip'].'</small>';
}
$label = '';
if (isset($args['label'])) {
$label = '<label for="'.$id.'" class="col-sm-2 col-form-label">'.$args['label'].'</label>';
}
$class = 'form-control';
if (isset($args['class'])) {
$class = $class.' '.$args['class'];
}
$type = 'text';
if (isset($args['type'])) {
$type = $args['type'];
}
return <<<EOF
<div class="form-group row">
$label
<div class="col-sm-10">
<input class="$class" id="$id" name="$name" value="$value" placeholder="$placeholder" type="$type" $disabled $readonly>
$tip
</div>
</div>
EOF;
}
public static function formCheckbox($args)
{
$labelForCheckbox = isset($args['labelForCheckbox'])?$args['labelForCheckbox']:'';
$placeholder = isset($args['placeholder'])?$args['placeholder']:'';
$tip = isset($args['tip'])?'<small class="form-text text-muted">'.$args['tip'].'</small>':'';
$value = isset($args['value'])?$args['value']:'';
$name = $args['name'];
$id = 'js'.$name;
if (isset($args['id'])) {
$id = $args['id'];
}
$disabled = isset($args['disabled'])?'disabled':'';
$class = 'form-group m-0';
if (isset($args['class'])) {
$class = $args['class'];
}
$labelClass = 'mt-4 mb-2 pb-2 border-bottom text-uppercase w-100';
if (isset($args['labelClass'])) {
$labelClass = $args['labelClass'];
}
$type = 'text';
if (isset($args['type'])) {
$type = $args['type'];
}
$label = '';
if (!empty($args['label'])) {
$label = '<label class="'.$labelClass.'">'.$args['label'].'</label>';
}
$checked = $args['checked']?'checked':'';
$value = $checked?'1':'0';
return <<<EOF
<div class="$class">
$label
<div class="form-check">
<input type="hidden" name="$name" value="$value"><input id="$id" type="checkbox" class="form-check-input" onclick="this.previousSibling.value=1-this.previousSibling.value" $checked>
<label class="form-check-label" for="$id">$labelForCheckbox</label>
$tip
</div>
</div>
EOF;
}
public static function formSelect($args)
{
$id = 'js'.$args['name'];
if (isset($args['id'])) {
$id = $args['id'];
}
$class = 'custom-select';
if (isset($args['class'])) {
$class = $class.' '.$args['class'];
}
$html = '<div class="form-group row">';
if (isset($args['label'])) {
$html .= '<label for="'.$id.'" class="col-sm-2 col-form-label">'.$args['label'].'</label>';
}
$html .= '<div class="col-sm-10">';
$html .= '<select id="'.$id.'" name="'.$args['name'].'" class="'.$class.'">';
foreach ($args['options'] as $key=>$value) {
$html .= '<option '.(($key==$args['selected'])?'selected':'').' value="'.$key.'">'.$value.'</option>';
}
$html .= '</select>';
if (isset($args['tip'])) {
$html .= '<small class="form-text text-muted">'.$args['tip'].'</small>';
}
$html .= '</div>';
$html .= '</div>';
return $html;
}
public static function formSelectBlock($args)
{
$id = 'js'.$args['name'];
if (isset($args['id'])) {
$id = $args['id'];
}
$class = 'custom-select';
if (!empty($args['class'])) {
$class = $class.' '.$args['class'];
}
$html = '<div class="form-group m-0">';
if (!empty($args['label'])) {
$html .= '<label class="mt-4 mb-2 pb-2 border-bottom text-uppercase w-100" for="'.$id.'">'.$args['label'].'</label>';
}
$html .= '<select id="'.$id.'" name="'.$args['name'].'" class="'.$class.'">';
if (!empty($args['emptyOption'])) {
$html .= '<option value="">'.$args['emptyOption'].'</option>';
}
foreach ($args['options'] as $key=>$value) {
$html .= '<option '.(($key==$args['selected'])?'selected':'').' value="'.$key.'">'.$value.'</option>';
}
$html .= '</select>';
if (!empty($args['tip'])) {
$html .= '<small class="form-text text-muted">'.$args['tip'].'</small>';
}
$html .= '</div>';
return $html;
}
public static function formInputHidden($args)
{
return '<input type="hidden" id="js'.$args['name'].'" name="'.$args['name'].'" value="'.$args['value'].'">';
}
public static function alert($args)
{
$class = 'alert';
if (!empty($args['class'])) {
$class = $class.' '.$args['class'];
}
$text = $args['text'];
return <<<EOF
<div class="$class" role="alert">$text</div>
EOF;
}
}

View File

@ -1,54 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Bludit</title>
<meta charset="<?php echo CHARSET ?>">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="robots" content="noindex,nofollow">
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="<?php echo HTML_PATH_CORE_IMG.'favicon.png?version='.BLUDIT_VERSION ?>">
<!-- CSS -->
<?php
echo Theme::cssBootstrap();
echo Theme::css(array(
'bludit.css',
'bludit.bootstrap.css'
), DOMAIN_ADMIN_THEME_CSS);
?>
<!-- Javascript -->
<?php
echo Theme::jquery();
echo Theme::jsBootstrap();
?>
<!-- Plugins -->
<?php Theme::plugins('loginHead') ?>
</head>
<body class="login">
<!-- Plugins -->
<?php Theme::plugins('loginBodyBegin') ?>
<!-- Alert -->
<?php include('html/alert.php'); ?>
<div class="container">
<div class="row justify-content-md-center pt-5">
<div class="col-md-4 pt-5">
<?php
if (Sanitize::pathFile(PATH_ADMIN_VIEWS, $layout['view'].'.php')) {
include(PATH_ADMIN_VIEWS.$layout['view'].'.php');
}
?>
</div>
</div>
</div>
<!-- Plugins -->
<?php Theme::plugins('loginBodyEnd') ?>
</body>
</html>

View File

@ -0,0 +1,705 @@
/* UIKIT HACKs
---------------------------------------------------------------- */
.uk-width-1-4 {
width: 20%;
}
.uk-width-3-4 {
width: 80%;
}
.label-draft,
.label-empty-title,
.label-time {
background: #A979D1 none repeat scroll 0 0;
border-radius: 2px;
color: #ffffff;
display: inline-block;
padding: 0 8px;
text-align: center;
vertical-align: middle;
margin-right: 5px;
font-size: 0.8em;
}
.label-empty-title {
background: #53D192;
}
.label-time {
font-style: italic;
background: #A979D1;
}
.uk-tab-responsive > a::before {
content: "\f078";
padding-right: 3px;
}
/* UIKIT HACKs tabs
---------------------------------------------------------------- */
.uk-nav-dropdown > li > a:focus,
.uk-nav-dropdown > li > a:hover {
background-color: #007add !important;
}
/* UIKIT HACKs buttons
---------------------------------------------------------------- */
.uk-button {
border-radius: 2px !important;
padding: 1px 20px !important;
}
.uk-button-primary {
background-color: #007add !important;
}
.uk-button-primary:hover,
.uk-button-primary:focus {
background-color: #0069BE !important;
}
/* CSS defaults
---------------------------------------------------------------- */
body {
overflow-y: scroll;
}
#bl-container {
margin: 0 auto 20px;
max-width: 1800px;
}
/* TOPBAR
---------------------------------------------------------------- */
.bl-navbar-bg {
background: #222;
color: #fff;
}
#bl-navbar {
margin: 0 auto 20px;
max-width: 1800px;
}
#bl-navbar a {
color: #fff;
}
#bl-navbar a.bl-brand {
font-size: 20px;
line-height: 60px;
margin: 0 0 0 35px;
text-transform: uppercase;
color: #fff;
}
#bl-navbar a.bl-brand:hover {
text-decoration: none;
}
#bl-navbar .bl-navbar-right {
float: right;
line-height: 60px;
margin: 0 35px 0 0;
}
/* SIDEBAR
---------------------------------------------------------------- */
#bl-sidebar {
max-width: 250px;
}
#bl-sidebar a {
color: #777 !important;
}
#bl-sidebar a:hover {
color: #007add !important;
}
#bl-sidebar li.uk-active {
border-left: 3px solid #007add;
}
#bl-sidebar li.uk-active a {
color: #007add !important;
}
#bl-sidebar .uk-nav {
margin: 0px 0 0 20px !important;
}
#bl-sidebar .uk-nav-header {
font-weight: normal !important;
font-size: 16px;
}
.uk-navbar-toggle {
margin-top: 10px;
text-shadow: 0 !important;
color: #fff;
}
/* VIEW
---------------------------------------------------------------- */
#bl-view {
padding-right: 10px;
}
#bl-view .uk-width-2-10 {
}
.plugin-incompatible,
.theme-incompatible {
background: #ffdc7d;
border: 1px dashed #eec24a;
color: #826106;
display: table-cell;
font-size: 12px;
margin-top: 6px;
padding: 1px 10px;
}
/* DASHBOARD
---------------------------------------------------------------- */
#dashboard-panel .uk-panel {
background-color: #fafafa !important;
border: 1px solid #f8f8f8;
box-shadow: 5px 1px 1px #fdfdfd;
padding: 10px !important;
}
#dashboard-panel .uk-panel h4.panel-title {
text-transform: uppercase;
font-size: 14px !important;
}
div.dashboard-links {
background-color: #fafafa !important;
border: 1px solid #f8f8f8;
box-shadow: 5px 1px 1px #fdfdfd;
margin-bottom: 10px;
padding: 50px 20px;
}
div.dashboard-links h4 {
margin-bottom: -8px !important;
}
/* FORM
---------------------------------------------------------------- */
.uk-form input:not([type]), .uk-form input[type="text"], .uk-form input[type="password"], .uk-form input[type="email"], .uk-form input[type="url"], .uk-form input[type="search"], .uk-form input[type="tel"], .uk-form input[type="number"], .uk-form input[type="datetime"], .uk-form input[type="datetime-local"], .uk-form input[type="date"], .uk-form input[type="month"], .uk-form input[type="time"], .uk-form input[type="week"], .uk-form input[type="color"], .uk-form select, .uk-form textarea {
border-radius: 2px !important;
}
.uk-form-help-block {
color: #777 !important;
font-size: 0.9em !important;
}
.bl-publish-sidebar ul {
margin: 0;
padding: 0;
}
.bl-publish-sidebar li {
margin: 0;
padding: 0;
list-style: none;
}
.bl-publish-sidebar li:not(:first-child) {
margin-top: 10px;
}
.bl-publish-sidebar .uk-form-label {
font-size: 0.9em;
text-transform: uppercase;
font-weight: normal;
}
.bl-publish-sidebar .sidebar-view {
display: none;
}
.bl-publish-sidebar h2.sidebar-button {
font-size: 0.9em;
text-transform: uppercase;
border-bottom: 1px solid #ddd;
cursor: pointer;
}
.uk-form legend {
margin-top: 20px;
}
.uk-form legend.first-child {
margin-top: 0 !important;
}
button.aslink {
background: rgba(0, 0, 0, 0) none repeat scroll 0 0;
border: 0 none;
color: #07d;
cursor: pointer;
display: block;
font-size: 1em;
margin: 0 !important;
padding: 0 !important;
}
button.aslink:hover {
text-decoration: underline;
}
/* TABLE
---------------------------------------------------------------- */
.uk-table td.children {
padding-left: 20px;
}
.uk-table td, .uk-table th {
padding: 14px 8px !important;
}
/* RESPONSIVE
---------------------------------------------------------------- */
@media (max-width: 960px) {
.uk-grid {
margin: 0 !important;
}
#bl-container {
margin: 0 10px !important;
}
#bl-view {
width: 100% !important;
padding: 0 !important;
}
.bl-brand {
margin: 0 !important;
}
.bl-publish-sidebar {
width: 100%;
padding-left: 0;
margin: 20px 0;
}
.bl-publish-view {
width: 100% !important;
padding: 0 !important;
}
}
/* OLD
---------------------------------------------------------------- */
#logo {
background: #f4f4f4;
padding:20px 0;
}
h2.title {
margin: 0 0 20px 0;
}
button.delete-button {
background: none;
border: 0 none;
color: #da2727;
cursor: pointer;
font-size: 0.9em;
display: block;
margin-bottom: 10px;
}
button.delete-button:hover {
text-decoration: underline;
}
#jscontent {
height: 400px;
}
table.statistics tr:last-child td {
border-bottom: none !important;
}
/* ----------- ALERT ----------- */
#alert {
top: 0;
color: #ffffff;
padding: 20px 60px;
display: none;
position: fixed;
text-align: center;
z-index: 100;
right: 0;
}
.alert-ok {
background: #4374C1;
}
.alert-fail {
background: #c14343;
}
/* ----------- FORM ----------- */
#bludit-tags {
margin-top: 15px;
}
#bludit-tags .uk-button {
margin-top: 5px;
}
#jstagList {
margin-top: 15px;
font-size: 0.9em;
}
#jstagList span.unselect,
#jstagList span.select {
margin-top: 7px;
margin-right: 7px;
padding: 1px 15px;
cursor: pointer;
display: inline-block;
border-radius: 3px;
background: #f1f1f1;
vertical-align: middle;
}
#jstagList span.unselect:before {
font-family: FontAwesome;
content: "\f067";
padding-right: 5px;
}
#jstagList span.unselect {
color: #AAA;
}
#jstagList span.unselect:hover {
color: #888;
}
#jstagList span.select:before {
font-family: FontAwesome;
content: "\f00c";
padding-right: 5px;
}
#jstagList span.select {
color: #2196f3;
padding: 2px 13px;
}
/* ----------- BLUDIT IMAGES V8 ----------- */
#bludit-images-v8 {
}
#bludit-images-v8 .bludit-thumbnail {
border: 1px solid #ddd;
border-radius: 4px;
box-sizing: border-box;
display: inline-block;
height: auto;
margin: 2px;
padding: 0;
width: 15% !important;
}
#bludit-images-v8-upload {
width: 100%;
padding: 0;
margin-bottom: 15px !important;
}
#bludit-images-v8-drag-drop {
padding: 20px;
}
#bludit-images-v8-progressbar {
display: none;
margin: 20px;
}
#bludit-images-v8-thumbnails {
max-height: 350px;
overflow: auto;
font-size: 0;
}
/* Bludit Menu v8 */
#bludit-menuV8 {
display: none;
z-index: 1020;
position: absolute;
overflow: hidden;
border: 1px solid #CCC;
background: #FFF;
color: #333;
border-radius: 2px;
list-style-type: none;
padding: 5px;
margin: 0;
}
#bludit-menuV8 li {
padding: 8px 12px;
cursor: pointer;
}
#bludit-menuV8 li:hover {
background-color: #2672ec;
color: #fff;
}
#bludit-menuV8 li i {
margin-right: 10px;
}
/* ----------- BLUDIT QUICK IMAGES ----------- */
#bludit-quick-images {
}
#bludit-quick-images a.moreImages {
margin: 15px 0 0;
width: 100%;
background: #F5F5F5 !important;
color: #555;
}
#bludit-quick-images h4.label {
background: #f8f8f8;
color: #aaa;
padding: 2px 5px;
font-size: 0.9em;
}
#bludit-quick-images-thumbnails {
font-size: 0;
}
#bludit-quick-images .bludit-thumbnail {
border: 1px solid #ddd;
border-radius: 4px;
box-sizing: border-box;
display: inline-block;
height: auto;
margin: 2px;
padding: 0;
width: 31% !important;
}
/* ----------- BLUDIT COVER IMAGE ----------- */
#bludit-cover-image {
}
#cover-image-thumbnail {
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
color: #666;
height: 130px;
padding: 0;
width: 100%;
}
#cover-image-upload {
color: #999;
position: relative;
top: 35%;
}
#cover-image-delete {
background: rgba(255, 255, 255, 0.7);
bottom: 0;
color: #000;
display: none;
font-size: 2.2em;
padding: 4px 10px;
position: absolute;
right: 0;
cursor: pointer;
}
#cover-image-progressbar {
display: none;
left: 5%;
position: relative;
top: 33%;
width: 90%;
}
/* ----------- BLUDIT PROFILE PICTURE ----------- */
#bludit-profile-picture-drag-drop {
width: 100%;
padding: 15px 0;
}
#bludit-profile-picture-progressbar {
display: none;
margin: 15px 0 0;
width: 100%;
}
/* ----------- LOGIN FORM ----------- */
div.login-box > h1 {
font-weight: lighter;
letter-spacing: 4px;
margin-bottom: 50px;
}
div.login-form {
background: #f1f1f1 none repeat scroll 0 0;
padding: 20px;
width: 400px;
}
/* ----------- PLUGIN LIST / THEME LIST ----------- */
tr.plugin-installed,
tr.theme-installed {
background: #F2F7FF !important;
}
div.plugin-name i.settings-icon {
float: right;
margin-top: 3px;
margin-left: 3px;
}
i.incompatible-warning {
color: #FFC425;
padding-right: 5px;
}
div.plugin-links > a {
display: inline-block;
margin-top: 5px;
}
div.plugin-links > span.separator {
color: #ccc;
}
/* ----------- PAGINATOR ----------- */
#paginator ul {
list-style-type: none;
margin: 15px 0;
padding: 0;
font-size: 0.9em;
text-align: center;
}
#paginator a {
color: #2672ec;
}
#paginator li {
display: inline;
float: none !important;
}
#paginator li.left {
margin-right: 10px;
}
#paginator li.list {
background: #e0e0e0;
color: #747474;
padding: 2px 11px;
margin: 0px 15px;
}
#paginator li.right {
margin-left: 10px;
}
#paginator li.next {
margin-right: 1em;
}
#paginator li.previous {
margin-left: 1em;
}
/* ----------- PLUGINS FORM ----------- */
#jsformplugin div {
margin-bottom: 1.1em;
}
#jsformplugin label {
margin: 0 0 5px 0 !important;
display: block;
}
#jsformplugin div.tip {
font-size: 0.9em;
color: #AAAAAA;
}
#jsformplugin textarea {
min-width: 400px;
width: 60%;
min-height: 100px;
}
#jsformplugin input[type=text] {
min-width: 400px;
width: 60%;
height: 37px;
}
#jsformplugin input[type="checkbox"] {
vertical-align: middle;
margin-left: 0px;
margin-right: 10px;
}
#jsformplugin label.forCheckbox {
margin-left: 3px;
margin-bottom: 0px !important;
display: inline-block;
}
#jsformplugin p {
margin-bottom: 0;
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,68 @@
/* ----------- UIKIT HACKs FOR BLUDIT ----------- */
html {
background: #F7F7F7;
}
.uk-form * {
border-radius: 2px !important;
}
.uk-button-primary {
background: #444;
}
.uk-button-primary:hover {
background: #333;
}
input[type="text"],
input[type="password"] {
border-color: #EBEBEB !important;
border-radius: 2px !important;
color: #333;
}
input:disabled {
background: #ccc;
}
.uk-vertical-align-middle {
margin-top: -150px;
}
.uk-panel {
background: #ffffff;
display: block;
margin: 20px 0;
padding: 20px;
position: relative;
text-align: left;
}
/* ----------- BLUDIT ----------- */
h1.title {
font-weight: lighter;
letter-spacing: 4px;
text-transform: uppercase;
}
h3 {
margin-top: 0px !important;
}
.content {
}
#jsshowPassword {
color: #999;
cursor: pointer;
font-size: 1em;
margin-top: 10px;
}
#jscompleteEmail {
cursor: pointer;
text-decoration: underline;
}

View File

@ -0,0 +1,568 @@
.xdsoft_datetimepicker {
box-shadow: 0 5px 15px -5px rgba(0, 0, 0, 0.506);
background: #fff;
border-bottom: 1px solid #bbb;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
border-top: 1px solid #ccc;
color: #333;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
padding: 8px;
padding-left: 0;
padding-top: 2px;
position: absolute;
z-index: 9999;
-moz-box-sizing: border-box;
box-sizing: border-box;
display: none;
}
.xdsoft_datetimepicker.xdsoft_rtl {
padding: 8px 0 8px 8px;
}
.xdsoft_datetimepicker iframe {
position: absolute;
left: 0;
top: 0;
width: 75px;
height: 210px;
background: transparent;
border: none;
}
/*For IE8 or lower*/
.xdsoft_datetimepicker button {
border: none !important;
}
.xdsoft_noselect {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
.xdsoft_noselect::selection { background: transparent }
.xdsoft_noselect::-moz-selection { background: transparent }
.xdsoft_datetimepicker.xdsoft_inline {
display: inline-block;
position: static;
box-shadow: none;
}
.xdsoft_datetimepicker * {
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 0;
margin: 0;
}
.xdsoft_datetimepicker .xdsoft_datepicker, .xdsoft_datetimepicker .xdsoft_timepicker {
display: none;
}
.xdsoft_datetimepicker .xdsoft_datepicker.active, .xdsoft_datetimepicker .xdsoft_timepicker.active {
display: block;
}
.xdsoft_datetimepicker .xdsoft_datepicker {
width: 224px;
float: left;
margin-left: 8px;
}
.xdsoft_datetimepicker.xdsoft_rtl .xdsoft_datepicker {
float: right;
margin-right: 8px;
margin-left: 0;
}
.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_datepicker {
width: 256px;
}
.xdsoft_datetimepicker .xdsoft_timepicker {
width: 58px;
float: left;
text-align: center;
margin-left: 8px;
margin-top: 0;
}
.xdsoft_datetimepicker.xdsoft_rtl .xdsoft_timepicker {
float: right;
margin-right: 8px;
margin-left: 0;
}
.xdsoft_datetimepicker .xdsoft_datepicker.active+.xdsoft_timepicker {
margin-top: 8px;
margin-bottom: 3px
}
.xdsoft_datetimepicker .xdsoft_mounthpicker {
position: relative;
text-align: center;
}
.xdsoft_datetimepicker .xdsoft_label i,
.xdsoft_datetimepicker .xdsoft_prev,
.xdsoft_datetimepicker .xdsoft_next,
.xdsoft_datetimepicker .xdsoft_today_button {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Q0NBRjI1NjM0M0UwMTFFNDk4NkFGMzJFQkQzQjEwRUIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6Q0NBRjI1NjQ0M0UwMTFFNDk4NkFGMzJFQkQzQjEwRUIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpDQ0FGMjU2MTQzRTAxMUU0OTg2QUYzMkVCRDNCMTBFQiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpDQ0FGMjU2MjQzRTAxMUU0OTg2QUYzMkVCRDNCMTBFQiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PoNEP54AAAIOSURBVHja7Jq9TsMwEMcxrZD4WpBYeKUCe+kTMCACHZh4BFfHO/AAIHZGFhYkBBsSEqxsLCAgXKhbXYOTxh9pfJVP+qutnZ5s/5Lz2Y5I03QhWji2GIcgAokWgfCxNvcOCCGKqiSqhUp0laHOne05vdEyGMfkdxJDVjgwDlEQgYQBgx+ULJaWSXXS6r/ER5FBVR8VfGftTKcITNs+a1XpcFoExREIDF14AVIFxgQUS+h520cdud6wNkC0UBw6BCO/HoCYwBhD8QCkQ/x1mwDyD4plh4D6DDV0TAGyo4HcawLIBBSLDkHeH0Mg2yVP3l4TQMZQDDsEOl/MgHQqhMNuE0D+oBh0CIr8MAKyazBH9WyBuKxDWgbXfjNf32TZ1KWm/Ap1oSk/R53UtQ5xTh3LUlMmT8gt6g51Q9p+SobxgJQ/qmsfZhWywGFSl0yBjCLJCMgXail3b7+rumdVJ2YRss4cN+r6qAHDkPWjPjdJCF4n9RmAD/V9A/Wp4NQassDjwlB6XBiCxcJQWmZZb8THFilfy/lfrTvLghq2TqTHrRMTKNJ0sIhdo15RT+RpyWwFdY96UZ/LdQKBGjcXpcc1AlSFEfLmouD+1knuxBDUVrvOBmoOC/rEcN7OQxKVeJTCiAdUzUJhA2Oez9QTkp72OTVcxDcXY8iKNkxGAJXmJCOQwOa6dhyXsOa6XwEGAKdeb5ET3rQdAAAAAElFTkSuQmCC);
}
.xdsoft_datetimepicker .xdsoft_label i {
opacity: 0.5;
background-position: -92px -19px;
display: inline-block;
width: 9px;
height: 20px;
vertical-align: middle;
}
.xdsoft_datetimepicker .xdsoft_prev {
float: left;
background-position: -20px 0;
}
.xdsoft_datetimepicker .xdsoft_today_button {
float: left;
background-position: -70px 0;
margin-left: 5px;
}
.xdsoft_datetimepicker .xdsoft_next {
float: right;
background-position: 0 0;
}
.xdsoft_datetimepicker .xdsoft_next,
.xdsoft_datetimepicker .xdsoft_prev ,
.xdsoft_datetimepicker .xdsoft_today_button {
background-color: transparent;
background-repeat: no-repeat;
border: 0 none;
cursor: pointer;
display: block;
height: 30px;
opacity: 0.5;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
outline: medium none;
overflow: hidden;
padding: 0;
position: relative;
text-indent: 100%;
white-space: nowrap;
width: 20px;
min-width: 0;
}
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev,
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_next {
float: none;
background-position: -40px -15px;
height: 15px;
width: 30px;
display: block;
margin-left: 14px;
margin-top: 7px;
}
.xdsoft_datetimepicker.xdsoft_rtl .xdsoft_timepicker .xdsoft_prev,
.xdsoft_datetimepicker.xdsoft_rtl .xdsoft_timepicker .xdsoft_next {
float: none;
margin-left: 0;
margin-right: 14px;
}
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev {
background-position: -40px 0;
margin-bottom: 7px;
margin-top: 0;
}
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box {
height: 151px;
overflow: hidden;
border-bottom: 1px solid #ddd;
}
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div {
background: #f5f5f5;
border-top: 1px solid #ddd;
color: #666;
font-size: 12px;
text-align: center;
border-collapse: collapse;
cursor: pointer;
border-bottom-width: 0;
height: 25px;
line-height: 25px;
}
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div > div:first-child {
border-top-width: 0;
}
.xdsoft_datetimepicker .xdsoft_today_button:hover,
.xdsoft_datetimepicker .xdsoft_next:hover,
.xdsoft_datetimepicker .xdsoft_prev:hover {
opacity: 1;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
}
.xdsoft_datetimepicker .xdsoft_label {
display: inline;
position: relative;
z-index: 9999;
margin: 0;
padding: 5px 3px;
font-size: 14px;
line-height: 20px;
font-weight: bold;
background-color: #fff;
float: left;
width: 182px;
text-align: center;
cursor: pointer;
}
.xdsoft_datetimepicker .xdsoft_label:hover>span {
text-decoration: underline;
}
.xdsoft_datetimepicker .xdsoft_label:hover i {
opacity: 1.0;
}
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select {
border: 1px solid #ccc;
position: absolute;
right: 0;
top: 30px;
z-index: 101;
display: none;
background: #fff;
max-height: 160px;
overflow-y: hidden;
}
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_monthselect{ right: -7px }
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_yearselect{ right: 2px }
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover {
color: #fff;
background: #ff8000;
}
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option {
padding: 2px 10px 2px 5px;
text-decoration: none !important;
}
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current {
background: #33aaff;
box-shadow: #178fe5 0 1px 3px 0 inset;
color: #fff;
font-weight: 700;
}
.xdsoft_datetimepicker .xdsoft_month {
width: 100px;
text-align: right;
}
.xdsoft_datetimepicker .xdsoft_calendar {
clear: both;
}
.xdsoft_datetimepicker .xdsoft_year{
width: 48px;
margin-left: 5px;
}
.xdsoft_datetimepicker .xdsoft_calendar table {
border-collapse: collapse;
width: 100%;
}
.xdsoft_datetimepicker .xdsoft_calendar td > div {
padding-right: 5px;
}
.xdsoft_datetimepicker .xdsoft_calendar th {
height: 25px;
}
.xdsoft_datetimepicker .xdsoft_calendar td,.xdsoft_datetimepicker .xdsoft_calendar th {
width: 14.2857142%;
background: #f5f5f5;
border: 1px solid #ddd;
color: #666;
font-size: 12px;
text-align: right;
vertical-align: middle;
padding: 0;
border-collapse: collapse;
cursor: pointer;
height: 25px;
}
.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar td,.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar th {
width: 12.5%;
}
.xdsoft_datetimepicker .xdsoft_calendar th {
background: #f1f1f1;
}
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_today {
color: #33aaff;
}
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_highlighted_default {
background: #ffe9d2;
box-shadow: #ffb871 0 1px 4px 0 inset;
color: #000;
}
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_highlighted_mint {
background: #c1ffc9;
box-shadow: #00dd1c 0 1px 4px 0 inset;
color: #000;
}
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_default,
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current,
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current {
background: #33aaff;
box-shadow: #178fe5 0 1px 3px 0 inset;
color: #fff;
font-weight: 700;
}
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month,
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled,
.xdsoft_datetimepicker .xdsoft_time_box >div >div.xdsoft_disabled {
opacity: 0.5;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
cursor: default;
}
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month.xdsoft_disabled {
opacity: 0.2;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)";
}
.xdsoft_datetimepicker .xdsoft_calendar td:hover,
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div:hover {
color: #fff !important;
background: #ff8000 !important;
box-shadow: none !important;
}
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current.xdsoft_disabled:hover,
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box>div>div.xdsoft_current.xdsoft_disabled:hover {
background: #33aaff !important;
box-shadow: #178fe5 0 1px 3px 0 inset !important;
color: #fff !important;
}
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled:hover,
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_disabled:hover {
color: inherit !important;
background: inherit !important;
box-shadow: inherit !important;
}
.xdsoft_datetimepicker .xdsoft_calendar th {
font-weight: 700;
text-align: center;
color: #999;
cursor: default;
}
.xdsoft_datetimepicker .xdsoft_copyright {
color: #ccc !important;
font-size: 10px;
clear: both;
float: none;
margin-left: 8px;
}
.xdsoft_datetimepicker .xdsoft_copyright a { color: #eee !important }
.xdsoft_datetimepicker .xdsoft_copyright a:hover { color: #aaa !important }
.xdsoft_time_box {
position: relative;
border: 1px solid #ccc;
}
.xdsoft_scrollbar >.xdsoft_scroller {
background: #ccc !important;
height: 20px;
border-radius: 3px;
}
.xdsoft_scrollbar {
position: absolute;
width: 7px;
right: 0;
top: 0;
bottom: 0;
cursor: pointer;
}
.xdsoft_datetimepicker.xdsoft_rtl .xdsoft_scrollbar {
left: 0;
right: auto;
}
.xdsoft_scroller_box {
position: relative;
}
.xdsoft_datetimepicker.xdsoft_dark {
box-shadow: 0 5px 15px -5px rgba(255, 255, 255, 0.506);
background: #000;
border-bottom: 1px solid #444;
border-left: 1px solid #333;
border-right: 1px solid #333;
border-top: 1px solid #333;
color: #ccc;
}
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box {
border-bottom: 1px solid #222;
}
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div {
background: #0a0a0a;
border-top: 1px solid #222;
color: #999;
}
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label {
background-color: #000;
}
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select {
border: 1px solid #333;
background: #000;
}
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover {
color: #000;
background: #007fff;
}
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current {
background: #cc5500;
box-shadow: #b03e00 0 1px 3px 0 inset;
color: #000;
}
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label i,
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_prev,
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_next,
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_today_button {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUExQUUzOTA0M0UyMTFFNDlBM0FFQTJENTExRDVBODYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUExQUUzOTE0M0UyMTFFNDlBM0FFQTJENTExRDVBODYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQTFBRTM4RTQzRTIxMUU0OUEzQUVBMkQ1MTFENUE4NiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQTFBRTM4RjQzRTIxMUU0OUEzQUVBMkQ1MTFENUE4NiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pp0VxGEAAAIASURBVHja7JrNSgMxEMebtgh+3MSLr1T1Xn2CHoSKB08+QmR8Bx9A8e7RixdB9CKCoNdexIugxFlJa7rNZneTbLIpM/CnNLsdMvNjM8l0mRCiQ9Ye61IKCAgZAUnH+mU3MMZaHYChBnJUDzWOFZdVfc5+ZFLbrWDeXPwbxIqrLLfaeS0hEBVGIRQCEiZoHQwtlGSByCCdYBl8g8egTTAWoKQMRBRBcZxYlhzhKegqMOageErsCHVkk3hXIFooDgHB1KkHIHVgzKB4ADJQ/A1jAFmAYhkQqA5TOBtocrKrgXwQA8gcFIuAIO8sQSA7hidvPwaQGZSaAYHOUWJABhWWw2EMIH9QagQERU4SArJXo0ZZL18uvaxejXt/Em8xjVBXmvFr1KVm/AJ10tRe2XnraNqaJvKE3KHuUbfK1E+VHB0q40/y3sdQSxY4FHWeKJCunP8UyDdqJZenT3ntVV5jIYCAh20vT7ioP8tpf6E2lfEMwERe+whV1MHjwZB7PBiCxcGQWwKZKD62lfGNnP/1poFAA60T7rF1UgcKd2id3KDeUS+oLWV8DfWAepOfq00CgQabi9zjcgJVYVD7PVzQUAUGAQkbNJTBICDhgwYTjDYD6XeW08ZKh+A4pYkzenOxXUbvZcWz7E8ykRMnIHGX1XPl+1m2vPYpL+2qdb8CDAARlKFEz/ZVkAAAAABJRU5ErkJggg==);
}
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td,
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th {
background: #0a0a0a;
border: 1px solid #222;
color: #999;
}
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th {
background: #0e0e0e;
}
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_today {
color: #cc5500;
}
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_highlighted_default {
background: #ffe9d2;
box-shadow: #ffb871 0 1px 4px 0 inset;
color:#000;
}
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_highlighted_mint {
background: #c1ffc9;
box-shadow: #00dd1c 0 1px 4px 0 inset;
color:#000;
}
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_default,
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_current,
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current {
background: #cc5500;
box-shadow: #b03e00 0 1px 3px 0 inset;
color: #000;
}
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td:hover,
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div:hover {
color: #000 !important;
background: #007fff !important;
}
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th {
color: #666;
}
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright { color: #333 !important }
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright a { color: #111 !important }
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright a:hover { color: #555 !important }
.xdsoft_dark .xdsoft_time_box {
border: 1px solid #333;
}
.xdsoft_dark .xdsoft_scrollbar >.xdsoft_scroller {
background: #333 !important;
}
.xdsoft_datetimepicker .xdsoft_save_selected {
display: block;
border: 1px solid #dddddd !important;
margin-top: 5px;
width: 100%;
color: #454551;
font-size: 13px;
}
.xdsoft_datetimepicker .blue-gradient-button {
font-family: "museo-sans", "Book Antiqua", sans-serif;
font-size: 12px;
font-weight: 300;
color: #82878c;
height: 28px;
position: relative;
padding: 4px 17px 4px 33px;
border: 1px solid #d7d8da;
background: -moz-linear-gradient(top, #fff 0%, #f4f8fa 73%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fff), color-stop(73%, #f4f8fa));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #fff 0%, #f4f8fa 73%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #fff 0%, #f4f8fa 73%);
/* Opera 11.10+ */
background: -ms-linear-gradient(top, #fff 0%, #f4f8fa 73%);
/* IE10+ */
background: linear-gradient(to bottom, #fff 0%, #f4f8fa 73%);
/* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fff', endColorstr='#f4f8fa',GradientType=0 );
/* IE6-9 */
}
.xdsoft_datetimepicker .blue-gradient-button:hover, .xdsoft_datetimepicker .blue-gradient-button:focus, .xdsoft_datetimepicker .blue-gradient-button:hover span, .xdsoft_datetimepicker .blue-gradient-button:focus span {
color: #454551;
background: -moz-linear-gradient(top, #f4f8fa 0%, #FFF 73%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f4f8fa), color-stop(73%, #FFF));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #f4f8fa 0%, #FFF 73%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #f4f8fa 0%, #FFF 73%);
/* Opera 11.10+ */
background: -ms-linear-gradient(top, #f4f8fa 0%, #FFF 73%);
/* IE10+ */
background: linear-gradient(to bottom, #f4f8fa 0%, #FFF 73%);
/* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f8fa', endColorstr='#FFF',GradientType=0 );
/* IE6-9 */
}

View File

@ -0,0 +1,59 @@
/* ----------- UIKIT HACKs FOR BLUDIT ----------- */
html {
background: #F7F7F7;
}
* {
border-radius: 2px !important;
}
.uk-button-primary {
background: #444;
}
.uk-button-primary:hover {
background: #333;
}
input[type="text"],
input[type="password"] {
border-color: #EBEBEB !important;
border-radius: 2px !important;
color: #333;
}
.uk-alert {
padding: 22px 0 !important;
}
/* ----------- BLUDIT ----------- */
div.login-box {
width: 400px;
max-width: calc(100% - 40px);
}
div.login-box > h1 {
font-weight: lighter;
letter-spacing: 4px;
margin-bottom: 50px;
margin-top: -100px;
}
div.login-form {
text-align: left;
}
div.login-form > h2 {
color: #777;
margin-bottom: 30px;
}
a.login-email {
border: 0;
color: #777;
display: block;
margin: 20px 0;
padding: 0;
text-align: left;
}

View File

@ -0,0 +1,2 @@
/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
.uk-form-file{display:inline-block;vertical-align:middle;position:relative;overflow:hidden}.uk-form-file input[type=file]{position:absolute;top:0;z-index:1;width:100%;opacity:0;cursor:pointer;left:0;font-size:500px}

View File

@ -0,0 +1,2 @@
/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
.uk-placeholder{margin-bottom:15px;padding:15px;border:1px dashed #ddd;background:#fafafa;color:#444}*+.uk-placeholder{margin-top:15px}.uk-placeholder>:last-child{margin-bottom:0}.uk-placeholder-large{padding-top:80px;padding-bottom:80px}

View File

@ -0,0 +1,2 @@
/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
.uk-progress{box-sizing:border-box;height:20px;margin-bottom:15px;background:#f5f5f5;overflow:hidden;line-height:20px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.06);border-radius:4px}*+.uk-progress{margin-top:15px}.uk-progress-bar{width:0;height:100%;background:#00a8e6;float:left;-webkit-transition:width .6s ease;transition:width .6s ease;font-size:12px;color:#fff;text-align:center;box-shadow:inset 0 0 5px rgba(0,0,0,.05);text-shadow:0 -1px 0 rgba(0,0,0,.1)}.uk-progress-mini{height:6px}.uk-progress-small{height:12px}.uk-progress-success .uk-progress-bar{background-color:#8cc14c}.uk-progress-warning .uk-progress-bar{background-color:#faa732}.uk-progress-danger .uk-progress-bar{background-color:#da314b}.uk-progress-striped .uk-progress-bar{background-image:-webkit-linear-gradient(-45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(-45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-size:30px 30px}.uk-progress-striped.uk-active .uk-progress-bar{-webkit-animation:uk-progress-bar-stripes 2s linear infinite;animation:uk-progress-bar-stripes 2s linear infinite}@-webkit-keyframes uk-progress-bar-stripes{0%{background-position:0 0}100%{background-position:30px 0}}@keyframes uk-progress-bar-stripes{0%{background-position:0 0}100%{background-position:30px 0}}.uk-progress-mini,.uk-progress-small{border-radius:500px}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,2 @@
/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
.uk-dragover{box-shadow:0 0 20px rgba(100,100,100,.3)}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1005 B

View File

@ -0,0 +1,181 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="<?php echo CHARSET ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noindex,nofollow">
<title><?php echo $layout['title'] ?></title>
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="<?php echo HTML_PATH_ADMIN_THEME.'img/favicon.png' ?>">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_ADMIN_THEME.'css/uikit/uikit.almost-flat.min.css?version='.BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_ADMIN_THEME.'css/uikit/upload.almost-flat.min.css?version='.BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_ADMIN_THEME.'css/uikit/form-file.almost-flat.min.css?version='.BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_ADMIN_THEME.'css/uikit/placeholder.almost-flat.min.css?version='.BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_ADMIN_THEME.'css/uikit/progress.almost-flat.min.css?version='.BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_ADMIN_THEME.'css/default.css?version='.BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_ADMIN_THEME.'css/jquery.datetimepicker.css?version='.BLUDIT_VERSION ?>">
<!-- Javascript -->
<script charset="utf-8" src="<?php echo HTML_PATH_ADMIN_THEME.'js/jquery.min.js?version='.BLUDIT_VERSION ?>"></script>
<script charset="utf-8" src="<?php echo HTML_PATH_ADMIN_THEME.'js/uikit/uikit.min.js?version='.BLUDIT_VERSION ?>"></script>
<script charset="utf-8" src="<?php echo HTML_PATH_ADMIN_THEME.'js/uikit/upload.min.js?version='.BLUDIT_VERSION ?>"></script>
<script charset="utf-8" src="<?php echo HTML_PATH_ADMIN_THEME.'js/jquery.datetimepicker.js?version='.BLUDIT_VERSION ?>"></script>
<!-- Plugins -->
<?php Theme::plugins('adminHead') ?>
</head>
<body>
<!-- Plugins -->
<?php Theme::plugins('adminBodyBegin') ?>
<!-- Alert -->
<script>
$(document).ready(function() {
<?php
if( Alert::defined() ) {
echo '$("#alert").slideDown().delay(3500).slideUp();';
}
?>
$(window).click(function() {
$("#alert").hide();
});
});
</script>
<div id="alert" class="<?php echo (Alert::status()==ALERT_STATUS_OK)?'alert-ok':'alert-fail'; ?>">
<?php Alert::p() ?>
</div>
<!-- Offcanvas for Mobile -->
<a href="#offcanvas" class="uk-navbar-toggle uk-hidden-large" data-uk-offcanvas></a>
<div id="offcanvas" class="uk-offcanvas">
<div class="uk-offcanvas-bar">
<ul class="uk-nav uk-nav-offcanvas">
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'dashboard' ?>"><?php $L->p('Dashboard') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'new-post' ?>"><?php $L->p('New post') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'new-page' ?>"><?php $L->p('New page') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'manage-posts' ?>"><?php $L->p('Manage posts') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'manage-pages' ?>"><?php $L->p('Manage pages') ?></a></li>
<?php if($Login->role() == 'admin') { ?>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>"><?php $L->p('Manage users') ?></a></li>
<!-- <li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'categories' ?>"><?php $L->p('Manage categories') ?></a></li> -->
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'settings-general' ?>"><?php $L->p('General settings') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'settings-advanced' ?>"><?php $L->p('Advanced settings') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'settings-regional' ?>"><?php $L->p('Language and timezone') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'plugins' ?>"><?php $L->p('Plugins') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'themes' ?>"><?php $L->p('Themes') ?></a></li>
<li><a href="<?php echo HTML_PATH_ADMIN_ROOT.'about' ?>"><?php $L->p('About') ?></a></li>
<?php } ?>
</ul>
</div>
</div>
<div class="bl-navbar-bg">
<nav id="bl-navbar">
<a href="" class="bl-brand">BLUDIT</a>
<div class="bl-navbar-right">
<?php $L->p('Welcome') ?> <?php echo $Login->username() ?> -
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'logout' ?>"><?php $L->p('Logout') ?></a>
</div>
</nav>
</div>
<div id="bl-container">
<div class="uk-grid uk-grid-small">
<div id="bl-sidebar" class="uk-width-1-4 uk-visible-large">
<ul class="uk-nav">
<li <?php echo ($layout['view']=='dashboard')?'class="uk-active"':'' ?>>
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'dashboard' ?>"><?php $L->p('Dashboard') ?></a>
</li>
<li>
<a target="_blank" href="<?php echo HTML_PATH_ROOT ?>"><?php $L->p('Website') ?></a>
</li>
<li class="uk-nav-header"><?php $L->p('Publish') ?></li>
<li <?php echo ($layout['view']=='new-post')?'class="uk-active"':'' ?>>
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'new-post' ?>"><?php $L->p('New post') ?></a>
</li>
<li <?php echo ($layout['view']=='new-page')?'class="uk-active"':'' ?>>
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'new-page' ?>"><?php $L->p('New page') ?></a>
</li>
<li class="uk-nav-header"><?php $L->p('Manage') ?></li>
<li <?php echo ($layout['view']=='manage-posts')?'class="uk-active"':'' ?>>
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'manage-posts' ?>"><?php $L->p('Posts') ?></a>
</li>
<li <?php echo ($layout['view']=='manage-pages')?'class="uk-active"':'' ?>>
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'manage-pages' ?>"><?php $L->p('Pages') ?></a>
</li>
<!--<li <?php echo ($layout['view']=='categories')?'class="uk-active"':'' ?>>
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'categories' ?>"><?php $L->p('Categories') ?></a>
</li>-->
<li <?php echo ($layout['view']=='users')?'class="uk-active"':'' ?>>
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>"><?php $L->p('Users') ?></a>
</li>
<li class="uk-nav-header"><?php $L->p('Settings') ?></li>
<li <?php echo ($layout['view']=='settings-general')?'class="uk-active"':'' ?>>
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'settings-general' ?>"><?php $L->p('General') ?></a>
</li>
<li <?php echo ($layout['view']=='settings-advanced')?'class="uk-active"':'' ?>>
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'settings-advanced' ?>"><?php $L->p('Advanced') ?></a>
</li>
<li <?php echo ($layout['view']=='settings-regional')?'class="uk-active"':'' ?>>
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'settings-regional' ?>"><?php $L->p('Language and timezone') ?></a>
</li>
<li <?php echo ($layout['view']=='plugins')?'class="uk-active"':'' ?>>
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'plugins' ?>"><?php $L->p('Plugins') ?></a>
</li>
<li <?php echo ($layout['view']=='themes')?'class="uk-active"':'' ?>>
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'themes' ?>"><?php $L->p('Themes') ?></a>
</li>
<li <?php echo ($layout['view']=='about')?'class="uk-active"':'' ?>>
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'about' ?>"><?php $L->p('About') ?></a>
</li>
</ul>
</div>
<div id="bl-view" class="uk-width-3-4">
<?php
if( Sanitize::pathFile(PATH_ADMIN_VIEWS, $layout['view'].'.php') ) {
include(PATH_ADMIN_VIEWS.$layout['view'].'.php');
}
?>
</div>
<?php
if( AUTO_SCROLL ) {
?>
<script>
// Auto scroll
$(document).ready(function () {
$('html, body').animate({
scrollTop: $('#bl-view').offset().top
}, 'slow');
});
</script>
<?php
}
?>
</div>
<!-- Javascript -->
<?php include(PATH_JS.'functions.php') ?>
<!-- Plugins -->
<?php Theme::plugins('adminBodyEnd') ?>
</body>
</html>

View File

@ -0,0 +1,399 @@
<?php
class HTML {
public static function title($args)
{
$id = empty($args['id']) ? '' : 'id="'.$args['id'].'"';
$html = '<h2 class="title" '.$id.'><i class="uk-icon-'.$args['icon'].'"></i> '.$args['title'].'</h2>';
echo $html;
}
public static function formOpen($args)
{
$class = empty($args['class']) ? '' : ' '.$args['class'];
$id = empty($args['id']) ? '' : 'id="'.$args['id'].'"';
$html = '<form class="uk-form'.$class.'" '.$id.' method="post" action="" autocomplete="off">';
echo $html;
}
public static function formClose()
{
$html = '</form>';
$script = '<script>
$(document).ready(function() {
// Prevent the form submit when press enter key.
$("form").keypress(function(e) {
if( (e.which == 13) && (e.target.type !== "textarea") ) {
return false;
}
});
});
</script>';
echo $html.$script;
}
// label, name, value, tip
public static function formInputText($args)
{
$id = 'js'.$args['name'];
$type = isset($args['type']) ? $args['type'] : 'text';
$class = empty($args['class']) ? '' : 'class="'.$args['class'].'"';
$placeholder = empty($args['placeholder']) ? '' : 'placeholder="'.$args['placeholder'].'"';
$disabled = empty($args['disabled']) ? '' : 'disabled';
$html = '<div class="uk-form-row">';
if(!empty($args['label'])) {
$html .= '<label for="'.$id.'" class="uk-form-label">'.$args['label'].'</label>';
}
$html .= '<div class="uk-form-controls">';
$html .= '<input id="'.$id.'" name="'.$args['name'].'" type="'.$type.'" '.$class.' '.$placeholder.' autocomplete="off" '.$disabled.' value="'.$args['value'].'">';
if(!empty($args['tip'])) {
$html .= '<p class="uk-form-help-block">'.$args['tip'].'</p>';
}
$html .= '</div>';
$html .= '</div>';
echo $html;
}
public static function tags($args)
{
global $L;
// Javascript code
include(PATH_JS.'bludit-tags.js');
$html = '<div id="bludit-tags" class="uk-form-row">';
$html .= '<input type="hidden" id="jstags" name="tags" value="">';
$html .= '<label for="jstagInput" class="uk-form-label">'.$args['label'].'</label>';
$html .= '<div class="uk-form-controls">';
$html .= '<input id="jstagInput" type="text" class="uk-width-1-1" autocomplete="off">';
$html .= '<button id="jstagAdd" class="uk-button">'.$L->g('Add').'</button>';
$html .= '<div id="jstagList">';
foreach($args['allTags'] as $tag) {
$html .= '<span data-tag="'.$tag.'" class="'.( in_array($tag, $args['selectedTags'])?'select':'unselect' ).'">'.$tag.'</span>';
}
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
echo $html;
}
public static function formInputPassword($args)
{
$args['type'] = 'password';
self::formInputText($args);
}
public static function formTextarea($args)
{
$id = 'js'.$args['name'];
$type = isset($args['type']) ? $args['type'] : 'text';
$class = empty($args['class']) ? '' : 'class="'.$args['class'].'"';
$placeholder = empty($args['placeholder']) ? '' : 'placeholder="'.$args['placeholder'].'"';
$rows = empty($args['rows']) ? '' : 'rows="'.$args['rows'].'"';
$html = '<div class="uk-form-row">';
if(!empty($args['label'])) {
$html .= '<label for="'.$id.'" class="uk-form-label">'.$args['label'].'</label>';
}
$html .= '<div class="uk-form-controls">';
$html .= '<textarea id="'.$id.'" name="'.$args['name'].'" '.$class.' '.$placeholder.' '.$rows.'>'.$args['value'].'</textarea>';
if(!empty($args['tip'])) {
$html .= '<p class="uk-form-help-block">'.$args['tip'].'</p>';
}
$html .= '</div>';
$html .= '</div>';
echo $html;
}
public static function formSelect($args)
{
$id = 'js'.$args['name'];
$type = isset($args['type']) ? $args['type'] : 'text';
$class = empty($args['class']) ? '' : 'class="'.$args['class'].'"';
$html = '<div class="uk-form-row">';
$html .= '<label for="'.$id.'" class="uk-form-label">'.$args['label'].'</label>';
$html .= '<div class="uk-form-controls">';
$html .= '<select id="'.$id.'" name="'.$args['name'].'" '.$class.'>';
if(isset($args['addEmptySpace'])) {
$html .= '<option value=""></option>';
}
foreach($args['options'] as $key=>$value) {
$html .= '<option value="'.$key.'"'.( ($args['selected']==$key)?' selected="selected"':'').'>'.$value.'</option>';
}
$html .= '</select>';
$html .= '<p class="uk-form-help-block">'.$args['tip'].'</p>';
$html .= '</div>';
$html .= '</div>';
echo $html;
}
public static function formInputHidden($args)
{
$id = 'js'.$args['name'];
$html = '<input type="hidden" id="'.$id.'" name="'.$args['name'].'" value="'.$args['value'].'">';
echo $html;
}
public static function legend($args)
{
$class = empty($args['class']) ? '' : 'class="'.$args['class'].'"';
$html = '<legend '.$class.'>'.$args['value'].'</legend>';
echo $html;
}
public static function bluditQuickImages()
{
// Javascript code
include(PATH_JS.'bludit-quick-images.js');
global $L;
$html = '<!-- BLUDIT QUICK IMAGES -->';
$html .= '
<div id="bludit-quick-images">
<div id="bludit-quick-images-thumbnails" onmousedown="return false">
';
$thumbnailList = Filesystem::listFiles(PATH_UPLOADS_THUMBNAILS,'*','*',true);
array_splice($thumbnailList, THUMBNAILS_AMOUNT);
foreach($thumbnailList as $file) {
$filename = basename($file);
$html .= '<img class="bludit-thumbnail" data-filename="'.$filename.'" src="'.HTML_PATH_UPLOADS_THUMBNAILS.$filename.'" alt="Thumbnail">';
}
$html .= '
</div>
';
$html .= '<div class="empty-images uk-block uk-text-center uk-block-muted" '.( !empty($thumbnailList)?'style="display:none"':'' ).'>'.$L->g('There are no images').'</div>';
$html .= '
<a data-uk-modal href="#bludit-images-v8" class="moreImages uk-button"><i class="uk-icon-folder-o"></i> '.$L->g('More images').'</a>
</div>
';
echo $html;
}
public static function bluditCoverImage($coverImage="")
{
global $L;
// Javascript code
include(PATH_JS.'bludit-cover-image.js');
$style = '';
if(!empty($coverImage)) {
$style = 'background-image: url('.HTML_PATH_UPLOADS_THUMBNAILS.$coverImage.')';
}
$html = '<!-- BLUDIT COVER IMAGE -->';
$html .= '
<div id="bludit-cover-image">
<div id="cover-image-thumbnail" class="uk-form-file uk-placeholder uk-text-center" style="'.$style.'">
<input type="hidden" name="coverImage" id="cover-image-upload-filename" value="'.$coverImage.'">
<div id="cover-image-upload" '.( empty($coverImage)?'':'style="display: none;"' ).'>
<div><i class="uk-icon-picture-o"></i> '.$L->g('Cover image').'</div>
<div style="font-size:0.8em;">'.$L->g('Drag and drop or click here').'<input id="cover-image-file-select" type="file"></div>
</div>
<div id="cover-image-delete" '.( empty($coverImage)?'':'style="display: block;"' ).'>
<div><i class="uk-icon-trash-o"></i></div>
</div>
<div id="cover-image-progressbar" class="uk-progress">
<div class="uk-progress-bar" style="width: 0%;">0%</div>
</div>
</div>
</div>
';
echo $html;
}
public static function bluditMenuV8()
{
// Javascript code
include(PATH_JS.'bludit-menu-v8.js');
global $L;
$html = '<!-- BLUDIT MENU V8 -->';
$html .= '
<ul id="bludit-menuV8">
<li id="bludit-menuV8-insert"><i class="uk-icon-plus"></i>'.$L->g('Insert image').'</li>
<li id="bludit-menuV8-cover"><i class="uk-icon-picture-o"></i>'.$L->g('Set as cover image').'</li>
<li id="bludit-menuV8-delete"><i class="uk-icon-trash"></i>'.$L->g('Delete image').'</li>
</ul>
';
echo $html;
}
public static function bluditImagesV8()
{
global $L;
// Javascript code
include(PATH_JS.'bludit-images-v8.js');
$html = '<!-- BLUDIT IMAGES V8 -->';
$html .= '
<div id="bludit-images-v8" class="uk-modal">
<div class="uk-modal-dialog">
<div id="bludit-images-v8-upload" class="uk-form-file uk-placeholder uk-text-center">
<div id="bludit-images-v8-drag-drop">
<div><i class="uk-icon-picture-o"></i> '.$L->g('Upload image').'</div>
<div style="font-size:0.8em;">'.$L->g('Drag and drop or click here').'<input id="bludit-images-v8-file-select" type="file"></div>
</div>
<div id="bludit-images-v8-progressbar" class="uk-progress">
<div class="uk-progress-bar" style="width: 0%;">0%</div>
</div>
</div>
<div id="bludit-images-v8-thumbnails">
';
$thumbnailList = Filesystem::listFiles(PATH_UPLOADS_THUMBNAILS,'*','*',true);
foreach($thumbnailList as $file) {
$filename = basename($file);
$html .= '<img class="bludit-thumbnail" src="'.HTML_PATH_UPLOADS_THUMBNAILS.$filename.'" data-filename="'.$filename.'" alt="Thumbnail">';
}
$html .= '
</div>
';
$html .= '<div class="empty-images uk-block uk-text-center uk-block-muted" '.( !empty($thumbnailList)?'style="display:none"':'' ).'>'.$L->g('There are no images').'</div>';
$html .= '
<div class="uk-modal-footer">
'.$L->g('Click on the image for options').' <a href="" class="uk-modal-close">'.$L->g('Click here to cancel').'</a>
</div>
</div>
</div>
';
echo $html;
}
public static function profileUploader($username)
{
global $L;
$html = '<!-- BLUDIT PROFILE UPLOADER -->';
$html .= '
<div id="bludit-profile-picture">
<div id="bludit-profile-picture-image">';
if(file_exists(PATH_UPLOADS_PROFILES.$username.'.png')) {
$html .= '<img class="uk-border-rounded" src="'.HTML_PATH_UPLOADS_PROFILES.$username.'.png" alt="Profile picture">';
}
else {
$html .= '<div class="uk-block uk-border-rounded uk-block-muted uk-block-large">'.$L->g('Profile picture').'</div>';
}
$html .= '
</div>
<div id="bludit-profile-picture-progressbar" class="uk-progress">
<div class="uk-progress-bar" style="width: 0%;">0%</div>
</div>
<div id="bludit-profile-picture-drag-drop" class="uk-form-file uk-placeholder uk-text-center">
<div>'.$L->g('Upload image').'</div>
<div style="font-size:0.8em;">'.$L->g('Drag and drop or click here').'<input id="bludit-profile-picture-file-select" type="file"></div>
</div>
</div>
';
$script = '
<script>
$(document).ready(function() {
var settings =
{
type: "json",
action: HTML_PATH_ADMIN_ROOT+"ajax/uploader",
allow : "*.(jpg|jpeg|gif|png)",
params: {"tokenCSRF":tokenCSRF, "type":"profilePicture", "username":"'.$username.'"},
loadstart: function() {
$("#bludit-profile-picture-progressbar").find(".uk-progress-bar").css("width", "0%").text("0%");
$("#bludit-profile-picture-progressbar").show();
},
progress: function(percent) {
percent = Math.ceil(percent);
$("#bludit-profile-picture-progressbar").find(".uk-progress-bar").css("width", percent+"%").text(percent+"%");
},
allcomplete: function(response) {
$("#bludit-profile-picture-progressbar").find(".uk-progress-bar").css("width", "100%").text("100%");
$("#bludit-profile-picture-progressbar").hide();
$("#bludit-profile-picture-image").html("<img class=\"uk-border-rounded\" src=\"'.HTML_PATH_UPLOADS_PROFILES.$username.'.png?time='.time().'\">");
},
notallowed: function(file, settings) {
alert("'.$L->g('Supported image file types').' "+settings.allow);
}
};
UIkit.uploadSelect($("#bludit-profile-picture-file-select"), settings);
UIkit.uploadDrop($("#bludit-profile-picture-drag-drop"), settings);
});
</script>
';
echo $html.$script;
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,2 @@
/*! UIkit 2.26.4 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
!function(e){var t;window.UIkit&&(t=e(UIkit)),"function"==typeof define&&define.amd&&define("uikit-upload",["uikit"],function(){return t||e(UIkit)})}(function(e){"use strict";function t(o,a){function r(t,n){var o=new FormData,a=new XMLHttpRequest;if(n.before(n,t)!==!1){for(var r,i=0;r=t[i];i++)o.append(n.param,r);for(var l in n.params)o.append(l,n.params[l]);a.upload.addEventListener("progress",function(e){var t=e.loaded/e.total*100;n.progress(t,e)},!1),a.addEventListener("loadstart",function(e){n.loadstart(e)},!1),a.addEventListener("load",function(e){n.load(e)},!1),a.addEventListener("loadend",function(e){n.loadend(e)},!1),a.addEventListener("error",function(e){n.error(e)},!1),a.addEventListener("abort",function(e){n.abort(e)},!1),a.open(n.method,n.action,!0),"json"==n.type&&a.setRequestHeader("Accept","application/json"),a.onreadystatechange=function(){if(n.readystatechange(a),4==a.readyState){var t=a.responseText;if("json"==n.type)try{t=e.$.parseJSON(t)}catch(o){t=!1}n.complete(t,a)}},n.beforeSend(a),a.send(o)}}if(!e.support.ajaxupload)return this;if(a=e.$.extend({},t.defaults,a),o.length){if("*.*"!==a.allow)for(var i,l=0;i=o[l];l++)if(!n(a.allow,i.name))return"string"==typeof a.notallowed?alert(a.notallowed):a.notallowed(i,a),void 0;var f=a.complete;if(a.single){var s=o.length,d=0,p=!0;a.beforeAll(o),a.complete=function(e,t){d+=1,f(e,t),a.filelimit&&d>=a.filelimit&&(p=!1),p&&s>d?r([o[d]],a):a.allcomplete(e,t)},r([o[0]],a)}else a.complete=function(e,t){f(e,t),a.allcomplete(e,t)},r(o,a)}}function n(e,t){var n="^"+e.replace(/\//g,"\\/").replace(/\*\*/g,"(\\/[^\\/]+)*").replace(/\*/g,"[^\\/]+").replace(/((?!\\))\?/g,"$1.")+"$";return n="^"+n+"$",null!==t.match(new RegExp(n,"i"))}return e.component("uploadSelect",{init:function(){var e=this;this.on("change",function(){t(e.element[0].files,e.options);var n=e.element.clone(!0).data("uploadSelect",e);e.element.replaceWith(n),e.element=n})}}),e.component("uploadDrop",{defaults:{dragoverClass:"uk-dragover"},init:function(){var e=this,n=!1;this.on("drop",function(n){n.originalEvent.dataTransfer&&n.originalEvent.dataTransfer.files&&(n.stopPropagation(),n.preventDefault(),e.element.removeClass(e.options.dragoverClass),e.element.trigger("dropped.uk.upload",[n.originalEvent.dataTransfer.files]),t(n.originalEvent.dataTransfer.files,e.options))}).on("dragenter",function(e){e.stopPropagation(),e.preventDefault()}).on("dragover",function(t){t.stopPropagation(),t.preventDefault(),n||(e.element.addClass(e.options.dragoverClass),n=!0)}).on("dragleave",function(t){t.stopPropagation(),t.preventDefault(),e.element.removeClass(e.options.dragoverClass),n=!1})}}),e.support.ajaxupload=function(){function e(){var e=document.createElement("INPUT");return e.type="file","files"in e}function t(){var e=new XMLHttpRequest;return!!(e&&"upload"in e&&"onprogress"in e.upload)}function n(){return!!window.FormData}return e()&&t()&&n()}(),t.defaults={action:"",single:!0,method:"POST",param:"files[]",params:{},allow:"*.*",type:"text",filelimit:!1,before:function(){},beforeSend:function(){},beforeAll:function(){},loadstart:function(){},load:function(){},loadend:function(){},error:function(){},abort:function(){},progress:function(){},complete:function(){},allcomplete:function(){},readystatechange:function(){},notallowed:function(e,t){alert("Only the following file types are allowed: "+t.allow)}},e.Utils.xhrupload=t,t});

View File

@ -0,0 +1,48 @@
<!DOCTYPE HTML>
<html class="uk-height-1-1 uk-notouch">
<head>
<meta charset="<?php echo CHARSET ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noindex,nofollow">
<title>Bludit</title>
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="<?php echo HTML_PATH_ADMIN_THEME.'img/favicon.png' ?>">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_ADMIN_THEME.'css/uikit/uikit.almost-flat.min.css?version='.BLUDIT_VERSION ?>">
<link rel="stylesheet" type="text/css" href="<?php echo HTML_PATH_ADMIN_THEME.'css/login.css?version='.BLUDIT_VERSION ?>">
<!-- Javascript -->
<script charset="utf-8" src="<?php echo HTML_PATH_ADMIN_THEME.'js/jquery.min.js?version='.BLUDIT_VERSION ?>"></script>
<script charset="utf-8" src="<?php echo HTML_PATH_ADMIN_THEME.'js/uikit/uikit.min.js?version='.BLUDIT_VERSION ?>"></script>
<!-- Plugins -->
<?php Theme::plugins('loginHead') ?>
</head>
<body class="uk-height-1-1">
<!-- Plugins -->
<?php Theme::plugins('loginBodyBegin') ?>
<div class="uk-vertical-align uk-text-center uk-height-1-1">
<div class="uk-vertical-align-middle login-box">
<h1>BLUDIT</h1>
<?php
if(Alert::defined()) {
echo '<div class="uk-alert">'.Alert::get().'</div>';
}
if( Sanitize::pathFile(PATH_ADMIN_VIEWS, $layout['view'].'.php') ) {
include(PATH_ADMIN_VIEWS.$layout['view'].'.php');
}
?>
</div>
</div>
<!-- Plugins -->
<?php Theme::plugins('loginBodyEnd') ?>
</body>
</html>

@ -1 +0,0 @@
Subproject commit 09138280134ec8014982f260c1ebb6a5b0091fdc

View File

@ -1,47 +1,44 @@
<?php
echo Bootstrap::pageTitle(array('title'=>$L->g('About'), 'icon'=>'info-circle'));
HTML::title(array('title'=>$L->g('About'), 'icon'=>'support'));
echo '
<table class="table table-striped mt-3">
<tbody>
<table class="uk-table uk-table-striped">
<thead>
<tr>
<th class="uk-width-1-5"></th>
<th class="uk-width-3-5"></th>
</tr>
</thead>
<tbody>
';
echo '<tr>';
echo '<td>Bludit Edition</td>';
if (defined('BLUDIT_PRO')) {
echo '<td>PRO - '.$L->g('Thanks for supporting Bludit').' <span class="fa fa-heart" style="color: #ffc107"></span></td>';
} else {
echo '<td>Standard - <a target="_blank" href="https://pro.bludit.com">'.$L->g('Upgrade to Bludit PRO').'</a></td>';
}
echo '</tr>';
echo '<tr>';
echo '<td>Bludit version</td>';
echo '<td>'.BLUDIT_VERSION.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>Bludit Version</td>';
echo '<td>'.BLUDIT_VERSION.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>Bludit codename</td>';
echo '<td>'.BLUDIT_CODENAME.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>Bludit Codename</td>';
echo '<td>'.BLUDIT_CODENAME.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>Bludit build</td>';
echo '<td>'.BLUDIT_BUILD.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>Bludit Build Number</td>';
echo '<td>'.BLUDIT_BUILD.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>PHP version</td>';
echo '<td>'.phpversion().'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>Disk usage</td>';
echo '<td>'.Filesystem::bytesToHumanFileSize(Filesystem::getSize(PATH_ROOT)).'</td>';
echo '</tr>';
echo '<tr>';
echo '<td><a href="'.HTML_PATH_ADMIN_ROOT.'developers'.'">Bludit Developers</a></td>';
echo '<td></td>';
echo '</tr>';
echo '<tr>';
echo '<td>PHP modules</td>';
echo '<td>'.implode(', ',get_loaded_extensions()).')</td>';
echo '</tr>';
echo '
</tbody>
</tbody>
</table>
';

View File

@ -0,0 +1,60 @@
<?php
HTML::title(array('title'=>$L->g('Add a new user'), 'icon'=>'user-plus'));
HTML::formOpen(array('id'=>'add-user-form', 'class'=>'uk-form-horizontal'));
// Security token
HTML::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$Security->getTokenCSRF()
));
HTML::formInputText(array(
'name'=>'new_username',
'label'=>$L->g('Username'),
'value'=>(isset($_POST['new_username'])?$_POST['new_username']:''),
'class'=>'uk-width-1-2 uk-form-medium',
'tip'=>''
));
HTML::formInputPassword(array(
'name'=>'new_password',
'label'=>$L->g('Password'),
'value'=>'',
'class'=>'uk-width-1-2 uk-form-medium',
'tip'=>''
));
HTML::formInputPassword(array(
'name'=>'confirm_password',
'label'=>$L->g('Confirm Password'),
'value'=>'',
'class'=>'uk-width-1-2 uk-form-medium',
'tip'=>''
));
HTML::formSelect(array(
'name'=>'role',
'label'=>$L->g('Role'),
'options'=>array('editor'=>$L->g('Editor'), 'admin'=>$L->g('Administrator')),
'selected'=>'editor',
'tip'=>''
));
HTML::formInputText(array(
'name'=>'email',
'label'=>$L->g('Email'),
'value'=>(isset($_POST['email'])?$_POST['email']:''),
'class'=>'uk-width-1-2 uk-form-medium',
'tip'=>''
));
echo '<div class="uk-form-row">
<div class="uk-form-controls">
<button type="submit" class="uk-button uk-button-primary">'.$L->g('Save').'</button>
<a href="'.HTML_PATH_ADMIN_ROOT.'users" class="uk-button">'.$L->g('Cancel').'</a>
</div>
</div>';
HTML::formClose();

View File

@ -1,59 +0,0 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<?php echo Bootstrap::formOpen(array('id'=>'jsform', 'class'=>'tab-content')); ?>
<div class="align-middle">
<div class="float-right mt-1">
<button type="submit" class="btn btn-primary btn-sm" name="save"><?php $L->p('Save') ?></button>
<a class="btn btn-secondary btn-sm" href="<?php echo HTML_PATH_ADMIN_ROOT.'themes' ?>" role="button"><?php $L->p('Cancel') ?></a>
</div>
<?php echo Bootstrap::pageTitle(array('title'=>$L->g('Blocks'), 'icon'=>'box')); ?>
</div>
<?php
// Token CSRF
echo Bootstrap::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF()
));
foreach ($blocks->getAll() as $block) {
echo Bootstrap::formTitle(array('title'=>$block->title()));
if (Text::isNotEmpty( $block->description() )) {
echo Bootstrap::alert(array('class'=>'alert-primary', 'text'=>$block->description()));
}
echo Bootstrap::formInputText(array(
'name'=>'key[]',
'label'=>$L->g('Key'),
'value'=>$block->key(),
'class'=>'',
'placeholder'=>'',
'tip'=>'',
'readonly'=>true
));
echo Bootstrap::formInputText(array(
'name'=>'title[]',
'label'=>$L->g('title'),
'value'=>$block->title(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
));
echo Bootstrap::formTextarea(array(
'name'=>'value[]',
'label'=>$L->g('Value'),
'value'=>$block->value(),
'class'=>'',
'placeholder'=>'',
'tip'=>'',
'rows'=>5
));
}
echo Bootstrap::formClose();
?>

View File

@ -1,33 +1,30 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
<?php
echo Bootstrap::pageTitle(array('title'=>$L->g('Categories'), 'icon'=>'tags'));
HTML::title(array('title'=>$L->g('Categories'), 'icon'=>'tag'));
echo Bootstrap::link(array(
'title'=>$L->g('Add a new category'),
'href'=>HTML_PATH_ADMIN_ROOT.'new-category',
'icon'=>'plus'
));
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'new-category"><i class="uk-icon-plus"></i> '.$L->g('Add a new category').'</a>';
echo '
<table class="table table-striped mt-3">
<thead>
<tr>
<th class="border-bottom-0" scope="col">'.$L->g('Name').'</th>
<th class="border-bottom-0" scope="col">'.$L->g('URL').'</th>
</tr>
</thead>
<tbody>
<table class="uk-table uk-table-striped">
<thead>
<tr>
<th>'.$L->g('Name').'</th>
<th>'.$L->g('Key').'</th>
</tr>
</thead>
<tbody>
';
foreach ($categories->keys() as $key) {
$category = new Category($key);
$categories = $dbCategories->getAll();
foreach($categories as $categoryKey=>$category)
{
echo '<tr>';
echo '<td><a href="'.HTML_PATH_ADMIN_ROOT.'edit-category/'.$key.'">'.$category->name().'</a></td>';
echo '<td><a href="'.$category->permalink().'">'.$url->filters('category', false).$key.'</a></td>';
echo '<td><a href="'.HTML_PATH_ADMIN_ROOT.'edit-category/'.$categoryKey.'">'.$category.'</a></td>';
echo '<td>'.$categoryKey.'</td>';
echo '</tr>';
}
echo '
</tbody>
</tbody>
</table>
';

View File

@ -1,26 +1,22 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<?php echo Bootstrap::formOpen(array('id'=>'jsform', 'class'=>'plugin-form')); ?>
<div class="align-middle">
<?php if ($plugin->formButtons()): ?>
<div class="float-right mt-1">
<button type="submit" class="btn btn-primary btn-sm" name="save"><?php $L->p('Save') ?></button>
<a class="btn btn-secondary btn-sm" href="<?php echo HTML_PATH_ADMIN_ROOT.'plugins' ?>" role="button"><?php $L->p('Cancel') ?></a>
</div>
<?php endif; ?>
<?php echo Bootstrap::pageTitle(array('title'=>$plugin->name(), 'icon'=>'cog')); ?>
</div>
<?php
// Token CSRF
echo Bootstrap::formInputHidden(array(
HTML::title(array('title'=>$_Plugin->name(), 'icon'=>'puzzle-piece'));
HTML::formOpen(array('id'=>'jsformplugin'));
// Security token
HTML::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF()
'value'=>$Security->getTokenCSRF()
));
// Print the plugin form
echo $plugin->form();
?>
echo $_Plugin->form();
<?php echo Bootstrap::formClose(); ?>
// Form buttons
echo '<div class="uk-form-row uk-margin-bottom">
<button class="uk-button uk-button-primary" type="submit">'.$L->g('Save').'</button>
<a class="uk-button" href="'.HTML_PATH_ADMIN_ROOT.'plugins">'.$L->g('Cancel').'</a>
</div>';
HTML::formClose();

View File

@ -1,327 +0,0 @@
<?php
echo Bootstrap::pageTitle(array('title'=>$L->g('Content'), 'icon'=>'archive'));
function table($type) {
global $url;
global $L;
global $published;
global $drafts;
global $scheduled;
global $static;
global $sticky;
global $autosave;
if ($type=='published') {
$list = $published;
if (empty($list)) {
echo '<p class="mt-4 text-muted">';
echo $L->g('There are no pages at this moment.');
echo '</p>';
return false;
}
} elseif ($type=='draft') {
$list = $drafts;
if (empty($list)) {
echo '<p class="mt-4 text-muted">';
echo $L->g('There are no draft pages at this moment.');
echo '</p>';
return false;
}
} elseif ($type=='scheduled') {
$list = $scheduled;
if (empty($list)) {
echo '<p class="mt-4 text-muted">';
echo $L->g('There are no scheduled pages at this moment.');
echo '</p>';
return false;
}
} elseif ($type=='static') {
$list = $static;
if (empty($list)) {
echo '<p class="mt-4 text-muted">';
echo $L->g('There are no static pages at this moment.');
echo '</p>';
return false;
}
} elseif ($type=='sticky') {
$list = $sticky;
if (empty($list)) {
echo '<p class="mt-4 text-muted">';
echo $L->g('There are no sticky pages at this moment.');
echo '</p>';
return false;
}
} elseif ($type=='autosave') {
$list = $autosave;
}
echo '
<table class="table mt-3">
<thead>
<tr>
<th class="border-0" scope="col">'.$L->g('Title').'</th>
';
if ($type=='published' || $type=='static' || $type=='sticky') {
echo '<th class="border-0 d-none d-lg-table-cell" scope="col">'.$L->g('URL').'</th>';
}
echo ' <th class="border-0 text-center d-sm-table-cell" scope="col">'.$L->g('Actions').'</th>
</tr>
</thead>
<tbody>
';
if ( (ORDER_BY=='position') || $type=='static' ) {
foreach ($list as $pageKey) {
try {
$page = new Page($pageKey);
if (!$page->isChild()) {
echo '<tr>
<td>
<div>
<a style="font-size: 1.1em" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'">'
.($page->title()?$page->title():'<span class="label-empty-title">'.$L->g('Empty title').'</span> ')
.'</a>
</div>
<div>
<p style="font-size: 0.8em" class="m-0 text-uppercase text-muted">'.( ((ORDER_BY=='position') || ($type!='published'))?$L->g('Position').': '.$page->position():$page->date(MANAGE_CONTENT_DATE_FORMAT) ).'</p>
</div>
</td>';
if ($type=='published' || $type=='static' || $type=='sticky') {
$friendlyURL = Text::isEmpty($url->filters('page')) ? '/'.$page->key() : '/'.$url->filters('page').'/'.$page->key();
echo '<td class="d-none d-lg-table-cell"><a target="_blank" href="'.$page->permalink().'">'.$friendlyURL.'</a></td>';
}
echo '<td class="contentTools pt-3 text-center d-sm-table-cell">'.PHP_EOL;
echo '<a class="text-secondary d-none d-md-inline" target="_blank" href="'.$page->permalink().'"><i class="fa fa-desktop"></i>'.$L->g('View').'</a>'.PHP_EOL;
echo '<a class="text-secondary d-none d-md-inline ml-2" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'"><i class="fa fa-edit"></i>'.$L->g('Edit').'</a>'.PHP_EOL;
if (count($page->children())==0) {
echo '<a href="#" class="ml-2 text-danger deletePageButton d-block d-sm-inline" data-toggle="modal" data-target="#jsdeletePageModal" data-key="'.$page->key().'"><i class="fa fa-trash"></i>'.$L->g('Delete').'</a>'.PHP_EOL;
}
echo '</td>';
echo '</tr>';
foreach ($page->children() as $child) {
//if ($child->published()) {
echo '<tr>
<td class="child">
<div>
<a style="font-size: 1.1em" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$child->key().'">'
.($child->title()?$child->title():'<span class="label-empty-title">'.$L->g('Empty title').'</span> ')
.'</a>
</div>
<div>
<p style="font-size: 0.8em" class="m-0 text-uppercase text-muted">'.( ((ORDER_BY=='position') || ($type!='published'))?$L->g('Position').': '.$child->position():$child->date(MANAGE_CONTENT_DATE_FORMAT) ).'</p>
</div>
</td>';
if ($type=='published' || $type=='static' || $type=='sticky') {
$friendlyURL = Text::isEmpty($url->filters('page')) ? '/'.$child->key() : '/'.$url->filters('page').'/'.$child->key();
echo '<td class="d-none d-lg-table-cell"><a target="_blank" href="'.$child->permalink().'">'.$friendlyURL.'</a></td>';
}
echo '<td class="contentTools pt-3 text-center d-sm-table-cell">'.PHP_EOL;
if ($type=='published' || $type=='static' || $type=='sticky') {
echo '<a class="text-secondary d-none d-md-inline" target="_blank" href="'.$page->permalink().'"><i class="fa fa-desktop"></i>'.$L->g('View').'</a>'.PHP_EOL;
}
echo '<a class="text-secondary d-none d-md-inline ml-2" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$child->key().'"><i class="fa fa-edit"></i>'.$L->g('Edit').'</a>'.PHP_EOL;
echo '<a class="ml-2 text-danger deletePageButton d-block d-sm-inline" href="#" data-toggle="modal" data-target="#jsdeletePageModal" data-key="'.$child->key().'"><i class="fa fa-trash"></i>'.$L->g('Delete').'</a>'.PHP_EOL;
echo '</td>';
echo '</tr>';
//}
}
}
} catch (Exception $e) {
// Continue
}
}
} else {
foreach ($list as $pageKey) {
try {
$page = new Page($pageKey);
echo '<tr>';
echo '<td class="pt-3">
<div>
<a style="font-size: 1.1em" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'">'
.($page->title()?$page->title():'<span class="label-empty-title">'.$L->g('Empty title').'</span> ')
.'</a>
</div>
<div>
<p style="font-size: 0.8em" class="m-0 text-uppercase text-muted">'.( ($type=='scheduled')?$L->g('Scheduled').': '.$page->date(SCHEDULED_DATE_FORMAT):$page->date(MANAGE_CONTENT_DATE_FORMAT) ).'</p>
</div>
</td>';
if ($type=='published' || $type=='static' || $type=='sticky') {
$friendlyURL = Text::isEmpty($url->filters('page')) ? '/'.$page->key() : '/'.$url->filters('page').'/'.$page->key();
echo '<td class="pt-3 d-none d-lg-table-cell"><a target="_blank" href="'.$page->permalink().'">'.$friendlyURL.'</a></td>';
}
echo '<td class="contentTools pt-3 text-center d-sm-table-cell">'.PHP_EOL;
if ($type=='published' || $type=='static' || $type=='sticky') {
echo '<a class="text-secondary d-none d-md-inline" target="_blank" href="'.$page->permalink().'"><i class="fa fa-desktop"></i>'.$L->g('View').'</a>'.PHP_EOL;
}
echo '<a class="text-secondary d-none d-md-inline ml-2" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'"><i class="fa fa-edit"></i>'.$L->g('Edit').'</a>'.PHP_EOL;
if (count($page->children())==0) {
echo '<a href="#" class="ml-2 text-danger deletePageButton d-block d-sm-inline" data-toggle="modal" data-target="#jsdeletePageModal" data-key="'.$page->key().'"><i class="fa fa-trash"></i>'.$L->g('Delete').'</a>'.PHP_EOL;
}
echo '</td>';
echo '</tr>';
} catch (Exception $e) {
// Continue
}
}
}
echo '
</tbody>
</table>
';
}
?>
<!-- TABS -->
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="pages-tab" data-toggle="tab" href="#pages" role="tab"><?php $L->p('Pages') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" id="static-tab" data-toggle="tab" href="#static" role="tab"><?php $L->p('Static') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" id="sticky-tab" data-toggle="tab" href="#sticky" role="tab"><?php $L->p('Sticky') ?></a>
</li>
<li class="nav-item">
<a class="nav-link" id="scheduled-tab" data-toggle="tab" href="#scheduled" role="tab"><?php $L->p('Scheduled') ?> <?php if (count($scheduled)>0) { echo '<span class="badge badge-danger">'.count($scheduled).'</span>'; } ?></a>
</li>
<li class="nav-item">
<a class="nav-link" id="draft-tab" data-toggle="tab" href="#draft" role="tab"><?php $L->p('Draft') ?></a>
</li>
<?php if (!empty($autosave)): ?>
<li class="nav-item">
<a class="nav-link" id="autosave-tab" data-toggle="tab" href="#autosave" role="tab"><?php $L->p('Autosave') ?></a>
</li>
<?php endif; ?>
</ul>
<div class="tab-content">
<!-- TABS PAGES -->
<div class="tab-pane show active" id="pages" role="tabpanel">
<?php table('published'); ?>
<?php if (Paginator::numberOfPages() > 1): ?>
<!-- Paginator -->
<nav class="paginator">
<ul class="pagination flex-wrap justify-content-center">
<!-- First button -->
<li class="page-item <?php if (!Paginator::showPrev()) echo 'disabled' ?>">
<a class="page-link" href="<?php echo Paginator::firstPageUrl() ?>"><span class="align-middle fa fa-media-skip-backward"></span> <?php echo $L->get('First'); ?></a>
</li>
<!-- Previous button -->
<li class="page-item <?php if (!Paginator::showPrev()) echo 'disabled' ?>">
<a class="page-link" href="<?php echo Paginator::previousPageUrl() ?>"><?php echo $L->get('Previous'); ?></a>
</li>
<!-- Next button -->
<li class="page-item <?php if (!Paginator::showNext()) echo 'disabled' ?>">
<a class="page-link" href="<?php echo Paginator::nextPageUrl() ?>"><?php echo $L->get('Next'); ?></a>
</li>
<!-- Last button -->
<li class="page-item <?php if (!Paginator::showNext()) echo 'disabled' ?>">
<a class="page-link" href="<?php echo Paginator::lastPageUrl() ?>"><?php echo $L->get('Last'); ?> <span class="align-middle fa fa-media-skip-forward"></span></a>
</li>
</ul>
</nav>
<?php endif; ?>
</div>
<!-- TABS STATIC -->
<div class="tab-pane" id="static" role="tabpanel">
<?php table('static'); ?>
</div>
<!-- TABS STICKY -->
<div class="tab-pane" id="sticky" role="tabpanel">
<?php table('sticky'); ?>
</div>
<!-- TABS SCHEDULED -->
<div class="tab-pane" id="scheduled" role="tabpanel">
<?php table('scheduled'); ?>
</div>
<!-- TABS DRAFT -->
<div class="tab-pane" id="draft" role="tabpanel">
<?php table('draft'); ?>
</div>
<!-- TABS AUTOSAVE -->
<?php if (!empty($autosave)): ?>
<div class="tab-pane" id="autosave" role="tabpanel">
<?php table('autosave'); ?>
</div>
<?php endif; ?>
</div>
<!-- Modal for delete page -->
<?php
echo Bootstrap::modal(array(
'buttonPrimary'=>$L->g('Delete'),
'buttonPrimaryClass'=>'btn-danger deletePageModalAcceptButton',
'buttonSecondary'=>$L->g('Cancel'),
'buttonSecondaryClass'=>'btn-link',
'modalTitle'=>$L->g('Delete content'),
'modalText'=>$L->g('Are you sure you want to delete this page'),
'modalId'=>'jsdeletePageModal'
));
?>
<script>
$(document).ready(function() {
var key = false;
// Button for delete a page in the table
$(".deletePageButton").on("click", function() {
key = $(this).data('key');
});
// Event from button accept from the modal
$(".deletePageModalAcceptButton").on("click", function() {
var form = jQuery('<form>', {
'action': HTML_PATH_ADMIN_ROOT+'edit-content/'+key,
'method': 'post',
'target': '_top'
}).append(jQuery('<input>', {
'type': 'hidden',
'name': 'tokenCSRF',
'value': tokenCSRF
}).append(jQuery('<input>', {
'type': 'hidden',
'name': 'key',
'value': key
}).append(jQuery('<input>', {
'type': 'hidden',
'name': 'type',
'value': 'delete'
}))));
form.hide().appendTo("body").submit();
});
});
</script>
<script>
// Open the tab defined in the URL
const anchor = window.location.hash;
$(`a[href="${anchor}"]`).tab('show');
</script>

View File

@ -1,146 +1,129 @@
<div id="dashboard" class="container">
<div class="row">
<div class="col-md-7">
<div class="uk-block dashboard-links">
<div class="uk-grid uk-grid-match" data-uk-grid-margin="{target:'.uk-panel'}">
<!-- Good message -->
<div>
<h2 id="hello-message" class="pt-0">
<span class="fa fa-hand-spock-o"></span><span><?php echo $L->g('hello') ?></span>
</h2>
<script>
$( document ).ready(function() {
$("#hello-message").fadeOut(1000, function() {
var date = new Date()
var hours = date.getHours()
if (hours > 6 && hours < 12) {
$(this).html('<span class="fa fa-sun-o"></span><?php echo $L->g('good-morning') ?>');
} else if (hours > 12 && hours < 18) {
$(this).html('<span class="fa fa-sun-o"></span><?php echo $L->g('good-afternoon') ?>');
} else if (hours > 18 && hours < 22) {
$(this).html('<span class="fa fa-moon-o"></span><?php echo $L->g('good-evening') ?>');
} else {
$(this).html('<span class="fa fa-moon-o"></span><span><?php echo $L->g('good-night') ?></span>');
}
}).fadeIn(1000);
});
</script>
</div>
<div class="uk-width-medium-1-3">
<!-- Quick Links -->
<div class="container border-bottom pb-5" id="jsclippyContainer">
<div class="row">
<div class="col">
<div class="form-group">
<select id="jsclippy" class="clippy" name="state"></select>
</div>
</div>
</div>
<script>
$(document).ready(function() {
var clippy = $("#jsclippy").select2({
placeholder: "<?php $L->p('Start typing to see a list of suggestions') ?>",
allowClear: true,
width: "100%",
theme: "bootstrap4",
minimumInputLength: 2,
dropdownParent: "#jsclippyContainer",
language: {
inputTooShort: function () { return ''; }
},
ajax: {
url: HTML_PATH_ADMIN_ROOT+"ajax/clippy",
data: function (params) {
var query = { query: params.term }
return query;
},
processResults: function (data) {
return data;
}
},
templateResult: function(data) {
// console.log(data);
var html = '';
if (data.type=='menu') {
html += '<a href="'+data.url+'"><div class="search-suggestion">';
html += '<span class="fa fa-'+data.icon+'"></span>'+data.text+'</div></a>';
} else {
if (typeof data.id === 'undefined') {
return '';
}
html += '<div class="search-suggestion">';
html += '<div class="search-suggestion-item">'+data.text+' <span class="badge badge-pill badge-light">'+data.type+'</span></div>';
html += '<div class="search-suggestion-options">';
html += '<a target="_blank" href="'+DOMAIN_PAGES+data.id+'"><?php $L->p('view') ?></a>';
html += '<a class="ml-2" href="'+DOMAIN_ADMIN+'edit-content/'+data.id+'"><?php $L->p('edit') ?></a>';
html += '</div></div>';
}
return html;
},
escapeMarkup: function(markup) {
return markup;
}
}).on("select2:closing", function(e) {
e.preventDefault();
}).on("select2:closed", function(e) {
clippy.select2("open");
});
clippy.select2("open");
});
</script>
</div>
<div class="container mt-4">
<div class="row">
<div class="col">
<a class="quick-links text-center" target="_blank" href="https://docs.bludit.com">
<div class="fa fa-compass quick-links-icons"></div>
<div><?php $L->p('Documentation') ?></div>
</a>
</div>
<div class="col border-left border-right">
<a class="quick-links text-center" target="_blank" href="https://forum.bludit.org">
<div class="fa fa-support quick-links-icons"></div>
<div><?php $L->p('Forum support') ?></div>
</a>
</div>
<div class="col">
<a class="quick-links text-center" target="_blank" href="https://gitter.im/bludit/support">
<div class="fa fa-comments quick-links-icons"></div>
<div><?php $L->p('Chat support') ?></div>
</a>
</div>
</div>
</div>
<?php Theme::plugins('dashboard') ?>
<div class="uk-panel">
<h4><a href="<?php echo HTML_PATH_ADMIN_ROOT.'new-post' ?>"><i class="uk-icon-pencil"></i> <?php $L->p('New post') ?></a></h4>
<p><?php $L->p('Create a new article for your blog') ?></p>
</div>
<div class="col-md-5">
<!-- Notifications -->
<ul class="list-group list-group-striped b-0">
<li class="list-group-item pt-0"><h4><?php $L->p('Notifications') ?></h4></li>
<?php
$logs = array_slice($syslog->db, 0, NOTIFICATIONS_AMOUNT);
foreach ($logs as $log) {
$phrase = $L->g($log['dictionaryKey']);
echo '<li class="list-group-item">';
echo $phrase;
if (!empty($log['notes'])) {
echo ' « <b>'.$log['notes'].'</b> »';
}
echo '<br><span class="notification-date"><small>';
echo Date::format($log['date'], DB_DATE_FORMAT, NOTIFICATIONS_DATE_FORMAT);
echo ' [ '.$log['username'] .' ]';
echo '</small></span>';
echo '</li>';
}
?>
</ul>
<div class="uk-panel">
<h4><a href="<?php echo HTML_PATH_ADMIN_ROOT.'manage-posts' ?>"><i class="uk-icon-folder-o"></i> <?php $L->p('Manage posts') ?></a></h4>
<p><?php $L->p('edit-or-remove-your-blogs-posts') ?></p>
</div>
</div>
<div class="uk-width-medium-1-3" style="border-right: 1px solid #E6E6E6; border-left: 1px solid #E6E6E6">
<div class="uk-panel">
<h4><a href="<?php echo HTML_PATH_ADMIN_ROOT.'new-page' ?>"><i class="uk-icon-file-text-o"></i> <?php $L->p('New page') ?></a></h4>
<p><?php $L->p('Create a new page for your website') ?></p>
</div>
<div class="uk-panel">
<h4><a href="<?php echo HTML_PATH_ADMIN_ROOT.'manage-pages' ?>"><i class="uk-icon-folder-o"></i> <?php $L->p('Manage pages') ?></a></h4>
<p><?php $L->p('edit-or-remove-your=pages') ?></p>
</div>
</div>
<div class="uk-width-medium-1-3">
<?php if($Login->role() == 'admin') { ?>
<div class="uk-panel">
<h4><a href="<?php echo HTML_PATH_ADMIN_ROOT.'add-user' ?>"><i class="uk-icon-user-plus"></i> <?php $L->p('Add a new user') ?></a></h4>
<p><?php $L->p('Invite a friend to collaborate on your website') ?></p>
</div>
<div class="uk-panel">
<h4><a href="<?php echo HTML_PATH_ADMIN_ROOT.'settings-regional' ?>"><i class="uk-icon-globe"></i> <?php $L->p('Language and timezone') ?></a></h4>
<p><?php $L->p('Change your language and region settings') ?></p>
</div>
<?php } else { ?>
<div class="uk-panel">
<h4><a href="<?php echo HTML_PATH_ADMIN_ROOT.'edit-user/'.$Login->username() ?>"><i class="uk-icon-user"></i> <?php $L->p('Profile') ?></a></h4>
<p><?php $L->p('View and edit your profile') ?></p>
</div>
<?php } ?>
</div>
</div>
</div>
<div id="dashboard-panel" class="uk-grid uk-grid-small">
<div class="uk-width-1-3">
<div class="uk-panel">
<h4 class="panel-title"><?php $L->p('Statistics') ?></h4>
<table class="uk-table statistics">
<tbody>
<tr>
<td><?php $Language->p('Posts') ?></td>
<td><?php echo $dbPosts->count() ?></td>
</tr>
<tr>
<td><?php $Language->p('Pages') ?></td>
<td><?php echo $dbPages->count() ?></td>
</tr>
<tr>
<td><?php $Language->p('Users') ?></td>
<td><?php echo $dbUsers->count() ?></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="uk-width-1-3">
<div class="uk-panel">
<h4 class="panel-title"><?php $L->p('Drafts') ?></h4>
<ul class="uk-list">
<?php
if( empty($_draftPosts) && empty($_draftPages) ) {
echo '<li>'.$Language->g('There are no drafts').'</li>';
}
else {
foreach($_draftPosts as $Post) {
echo '<li><span class="label-draft">'.$Language->g('Post').'</span><a href="'.HTML_PATH_ADMIN_ROOT.'edit-post/'.$Post->key().'">'.($Post->title()?$Post->title():'['.$Language->g('Empty title').'] ').'</a></li>';
}
foreach($_draftPages as $Page) {
echo '<li><span class="label-draft">'.$Language->g('Page').'</span><a href="'.HTML_PATH_ADMIN_ROOT.'edit-page/'.$Page->key().'">'.($Page->title()?$Page->title():'['.$Language->g('Empty title').'] ').'</a></li>';
}
}
?>
</ul>
</div>
</div>
<div class="uk-width-1-3">
<div class="uk-panel">
<h4 class="panel-title"><?php $L->p('Scheduled posts') ?></h4>
<ul class="uk-list">
<?php
if( empty($_scheduledPosts) ) {
echo '<li>'.$Language->g('There are no scheduled posts').'</li>';
}
else {
foreach($_scheduledPosts as $Post) {
echo '<li><span class="label-time">'.$Post->dateRaw(SCHEDULED_DATE_FORMAT).'</span><a href="'.HTML_PATH_ADMIN_ROOT.'edit-post/'.$Post->key().'">'.($Post->title()?$Post->title():'['.$Language->g('Empty title').'] ').'</a></li>';
}
}
?>
</ul>
</div>
</div>
</div>

View File

@ -1,38 +0,0 @@
<?php
echo Bootstrap::pageTitle(array('title'=>$L->g('Developers'), 'icon'=>'gears'));
echo '<h2 class="mb-4 mt-4"><b>PHP version: '.phpversion().'</b></h2>';
// PHP Ini
$uploadOptions = array(
'upload_max_filesize'=>ini_get('upload_max_filesize'),
'post_max_size'=>ini_get('post_max_size'),
'upload_tmp_dir'=>ini_get('upload_tmp_dir')
);
printTable('File Uploads', $uploadOptions);
// Loaded extensions
printTable('Server information ( $_SERVER )', $_SERVER);
// PHP Ini
printTable('PHP Configuration options ( ini_get_all() )', ini_get_all());
// Loaded extensions
printTable('Loaded extensions',get_loaded_extensions());
// Locales installed
exec('locale -a', $locales);
printTable('Locales installed', $locales);
echo '<hr>';
echo '<h2>BLUDIT</h2>';
echo '<hr>';
// Constanst defined by Bludit
$constants = get_defined_constants(true);
printTable('Bludit Constants', $constants['user']);
// Site object
printTable('$site object database',$site->db);

View File

@ -1,92 +1,32 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<?php echo Bootstrap::formOpen(array('id'=>'jsform')); ?>
<div class="align-middle">
<div class="float-right mt-1">
<button type="submit" class="btn btn-primary btn-sm" name="save"><?php $L->p('Save') ?></button>
<button type="button" class="btn btn-danger btn-sm" data-toggle="modal" data-target="#jsdeleteModal"><?php $L->p('Delete') ?></button>
<a class="btn btn-secondary btn-sm" href="<?php echo HTML_PATH_ADMIN_ROOT.'dashboard' ?>" role="button"><?php $L->p('Cancel') ?></a>
</div>
<?php echo Bootstrap::pageTitle(array('title'=>$L->g('Edit Category'), 'icon'=>'cog')); ?>
</div>
<?php
// Token CSRF
echo Bootstrap::formInputHidden(array(
HTML::title(array('title'=>$L->g('Edit Category'), 'icon'=>'globe'));
HTML::formOpen(array('class'=>'uk-form-horizontal'));
HTML::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF()
'value'=>$Security->getTokenCSRF()
));
echo Bootstrap::formInputHidden(array(
'name'=>'action',
'value'=>'edit'
HTML::formInputHidden(array(
'name'=>'categoryKey',
'value'=>$categoryKey
));
echo Bootstrap::formInputHidden(array(
'name'=>'oldKey',
'value'=>$categoryMap['key']
));
echo Bootstrap::formInputText(array(
'name'=>'name',
HTML::formInputText(array(
'name'=>'category',
'label'=>$L->g('Name'),
'value'=>$categoryMap['name'],
'class'=>'',
'placeholder'=>'',
'tip'=>''
'value'=>$category,
'class'=>'uk-width-1-2 uk-form-medium'
));
echo Bootstrap::formTextarea(array(
'name'=>'description',
'label'=>$L->g('Description'),
'value'=>isset($categoryMap['description'])?$categoryMap['description']:'',
'class'=>'',
'placeholder'=>'',
'tip'=>'',
'rows'=>3
));
echo '<div class="uk-form-row">
<div class="uk-form-controls">
<button type="submit" name="edit" class="uk-button uk-button-primary">'.$L->g('Save').'</button>
<button type="submit" name="delete" class="uk-button uk-button-primary">'.$L->g('Delete').'</button>
<a href="'.HTML_PATH_ADMIN_ROOT.'categories" class="uk-button">'.$L->g('Cancel').'</a>
</div>
</div>';
echo Bootstrap::formInputText(array(
'name'=>'template',
'label'=>$L->g('Template'),
'value'=>isset($categoryMap['template'])?$categoryMap['template']:'',
'class'=>'',
'placeholder'=>'',
'tip'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'newKey',
'label'=>$L->g('Friendly URL'),
'value'=>$categoryMap['key'],
'class'=>'',
'placeholder'=>'',
'tip'=>DOMAIN_CATEGORIES.$categoryMap['key']
));
echo Bootstrap::formClose();
?>
<!-- Modal for delete category -->
<?php
echo Bootstrap::modal(array(
'buttonPrimary'=>$L->g('Delete'),
'buttonPrimaryClass'=>'btn-danger jsbuttonDeleteAccept',
'buttonSecondary'=>$L->g('Cancel'),
'buttonSecondaryClass'=>'btn-link',
'modalTitle'=>$L->g('Delete category'),
'modalText'=>$L->g('Are you sure you want to delete this category?'),
'modalId'=>'jsdeleteModal'
));
?>
<script>
$(document).ready(function() {
// Delete content
$(".jsbuttonDeleteAccept").on("click", function() {
$("#jsaction").val("delete");
$("#jsform").submit();
});
});
</script>
HTML::formClose();

View File

@ -1,556 +0,0 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<?php
// FORM START
echo Bootstrap::formOpen(array(
'id'=>'jsform',
'class'=>'d-flex flex-column h-100'
));
// Token CSRF
echo Bootstrap::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF()
));
// UUID
// The UUID is generated in the controller
echo Bootstrap::formInputHidden(array(
'name'=>'uuid',
'value'=>$page->uuid()
));
// Type = published, draft, sticky, static
echo Bootstrap::formInputHidden(array(
'name'=>'type',
'value'=>$page->type()
));
// Cover image
echo Bootstrap::formInputHidden(array(
'name'=>'coverImage',
'value'=>$page->coverImage(false)
));
// Content
echo Bootstrap::formInputHidden(array(
'name'=>'content',
'value'=>''
));
// Current page key
echo Bootstrap::formInputHidden(array(
'name'=>'key',
'value'=>$page->key()
));
?>
<!-- TOOLBAR -->
<div id="jseditorToolbar" class="mb-1">
<div id="jseditorToolbarRight" class="btn-group btn-group-sm float-right" role="group" aria-label="Toolbar right">
<button type="button" class="btn btn-light" id="jsmediaManagerOpenModal" data-toggle="modal" data-target="#jsmediaManagerModal"><span class="fa fa-image"></span> <?php $L->p('Images') ?></button>
<button type="button" class="btn btn-light" id="jsoptionsSidebar" style="z-index:30"><span class="fa fa-cog"></span> <?php $L->p('Options') ?></button>
</div>
<div id="jseditorToolbarLeft">
<button type="button" class="btn btn-sm btn-primary" id="jsbuttonSave"><?php echo $L->g('Save') ?></button>
<button id="jsbuttonPreview" type="button" class="btn btn-sm btn-secondary"><?php $L->p('Preview') ?></button>
<span id="jsswitchButton" data-switch="<?php echo ($page->draft()?'draft':'publish') ?>" class="ml-2 text-secondary switch-button"><i class="fa fa-square switch-icon-<?php echo ($page->draft()?'draft':'publish') ?>"></i> <?php echo ($page->draft()?$L->g('Draft'):$L->g('Publish')) ?></span>
</div>
<?php if($page->scheduled()): ?>
<div class="alert alert-warning p-1 mt-1 mb-0"><?php $L->p('scheduled') ?>: <?php echo $page->date(SCHEDULED_DATE_FORMAT) ?></div>
<?php endif; ?>
</div>
<script>
$(document).ready(function() {
$("#jsoptionsSidebar").on("click", function() {
$("#jseditorSidebar").toggle();
$("#jsshadow").toggle();
});
$("#jsshadow").on("click", function() {
$("#jseditorSidebar").toggle();
$("#jsshadow").toggle();
});
});
</script>
<!-- SIDEBAR OPTIONS -->
<div id="jseditorSidebar">
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-link active show" id="nav-general-tab" data-toggle="tab" href="#nav-general" role="tab" aria-controls="general"><?php $L->p('General') ?></a>
<a class="nav-link" id="nav-advanced-tab" data-toggle="tab" href="#nav-advanced" role="tab" aria-controls="advanced"><?php $L->p('Advanced') ?></a>
<?php if (!empty($site->customFields())): ?>
<a class="nav-link" id="nav-custom-tab" data-toggle="tab" href="#nav-custom" role="tab" aria-controls="custom"><?php $L->p('Custom') ?></a>
<?php endif ?>
<a class="nav-link" id="nav-seo-tab" data-toggle="tab" href="#nav-seo" role="tab" aria-controls="seo"><?php $L->p('SEO') ?></a>
</div>
</nav>
<div class="tab-content pr-3 pl-3 pb-3">
<div id="nav-general" class="tab-pane fade show active" role="tabpanel" aria-labelledby="general-tab">
<?php
// Category
echo Bootstrap::formSelectBlock(array(
'name'=>'category',
'label'=>$L->g('Category'),
'selected'=>$page->categoryKey(),
'class'=>'',
'emptyOption'=>'- '.$L->g('Uncategorized').' -',
'options'=>$categories->getKeyNameArray()
));
// Description
echo Bootstrap::formTextareaBlock(array(
'name'=>'description',
'label'=>$L->g('Description'),
'selected'=>'',
'class'=>'',
'value'=>$page->description(),
'rows'=>5,
'placeholder'=>$L->get('this-field-can-help-describe-the-content')
));
?>
<!-- Cover Image -->
<?php
$coverImage = $page->coverImage(false);
$externalCoverImage = '';
if (filter_var($coverImage, FILTER_VALIDATE_URL)) {
$coverImage = '';
$externalCoverImage = $page->coverImage(false);
}
?>
<label class="mt-4 mb-2 pb-2 border-bottom text-uppercase w-100"><?php $L->p('Cover Image') ?></label>
<div>
<img id="jscoverImagePreview" class="mx-auto d-block w-100" alt="Cover image preview" src="<?php echo (empty($coverImage) ? HTML_PATH_CORE_IMG.'default.svg' : $page->coverImage() ) ?>" />
</div>
<div class="mt-2 text-center">
<button type="button" id="jsbuttonSelectCoverImage" class="btn btn-primary btn-sm"><?php echo $L->g('Select cover image') ?></button>
<button type="button" id="jsbuttonRemoveCoverImage" class="btn btn-secondary btn-sm"><?php echo $L->g('Remove cover image') ?></button>
</div>
<script>
$(document).ready(function() {
$("#jscoverImagePreview").on("click", function() {
openMediaManager();
});
$("#jsbuttonSelectCoverImage").on("click", function() {
openMediaManager();
});
$("#jsbuttonRemoveCoverImage").on("click", function() {
$("#jscoverImage").val('');
$("#jscoverImagePreview").attr('src', HTML_PATH_CORE_IMG+'default.svg');
});
});
</script>
</div>
<div id="nav-advanced" class="tab-pane fade" role="tabpanel" aria-labelledby="advanced-tab">
<?php
// Date
echo Bootstrap::formInputTextBlock(array(
'name'=>'date',
'label'=>$L->g('Date'),
'placeholder'=>'',
'value'=>$page->dateRaw(),
'tip'=>$L->g('date-format-format')
));
// Type
echo Bootstrap::formSelectBlock(array(
'name'=>'typeSelector',
'label'=>$L->g('Type'),
'selected'=>$page->type(),
'options'=>array(
'published'=>'- '.$L->g('Default').' -',
'sticky'=>$L->g('Sticky'),
'static'=>$L->g('Static')
),
'tip'=>''
));
// Position
echo Bootstrap::formInputTextBlock(array(
'name'=>'position',
'label'=>$L->g('Position'),
'tip'=>$L->g('Field used when ordering content by position'),
'value'=>$page->position()
));
// Tags
echo Bootstrap::formInputTextBlock(array(
'name'=>'tags',
'label'=>$L->g('Tags'),
'placeholder'=>'',
'tip'=>$L->g('Write the tags separated by comma'),
'value'=>$page->tags()
));
// Parent
try {
$options = array();
$parentKey = $page->parent();
if (!empty($parentKey)) {
$parent = new Page($parentKey);
$options = array($parentKey=>$parent->title());
}
} catch (Exception $e) {
// continue
}
echo Bootstrap::formSelectBlock(array(
'name'=>'parent',
'label'=>$L->g('Parent'),
'options'=>$options,
'selected'=>false,
'class'=>'',
'tip'=>$L->g('Start typing a page title to see a list of suggestions.'),
));
?>
<script>
$(document).ready(function() {
var parent = $("#jsparent").select2({
placeholder: "",
allowClear: true,
theme: "bootstrap4",
minimumInputLength: 2,
ajax: {
url: HTML_PATH_ADMIN_ROOT+"ajax/get-published",
data: function (params) {
var query = {
checkIsParent: true,
query: params.term
}
return query;
},
processResults: function (data) {
return data;
}
},
escapeMarkup: function(markup) {
return markup;
},
templateResult: function(data) {
var html = data.text
if (data.type=="static") {
html += '<span class="badge badge-pill badge-light">'+data.type+'</span>';
}
return html;
}
});
});
</script>
<?php
// Template
echo Bootstrap::formInputTextBlock(array(
'name'=>'template',
'label'=>$L->g('Template'),
'placeholder'=>'',
'value'=>$page->template(),
'tip'=>$L->g('Write a template name to filter the page in the theme and change the style of the page.')
));
echo Bootstrap::formInputTextBlock(array(
'name'=>'externalCoverImage',
'label'=>$L->g('External cover image'),
'placeholder'=>"https://",
'value'=>$externalCoverImage,
'tip'=>$L->g('Set a cover image from external URL, such as a CDN or some server dedicated for images.')
));
// Username
echo Bootstrap::formInputTextBlock(array(
'name'=>'',
'label'=>$L->g('Author'),
'placeholder'=>'',
'value'=>$page->username(),
'tip'=>'',
'disabled'=>true
));
?>
<script>
$(document).ready(function() {
// Changes in External cover image input
$("#jsexternalCoverImage").change(function() {
$("#jscoverImage").val( $(this).val() );
});
// Datepicker
$("#jsdate").datetimepicker({format:DB_DATE_FORMAT});
});
</script>
</div>
<?php if (!empty($site->customFields())): ?>
<div id="nav-custom" class="tab-pane fade" role="tabpanel" aria-labelledby="custom-tab">
<?php
$customFields = $site->customFields();
foreach ($customFields as $field=>$options) {
if ( !isset($options['position']) ) {
if ($options['type']=="string") {
echo Bootstrap::formInputTextBlock(array(
'name'=>'custom['.$field.']',
'value'=>(isset($options['default'])?$options['default']:''),
'tip'=>(isset($options['tip'])?$options['tip']:''),
'label'=>(isset($options['label'])?$options['label']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'value'=>$page->custom($field)
));
} elseif ($options['type']=="bool") {
echo Bootstrap::formCheckbox(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'checked'=>$page->custom($field),
'labelForCheckbox'=>(isset($options['tip'])?$options['tip']:'')
));
}
}
}
?>
</div>
<?php endif ?>
<div id="nav-seo" class="tab-pane fade" role="tabpanel" aria-labelledby="seo-tab">
<?php
// Friendly URL
echo Bootstrap::formInputTextBlock(array(
'name'=>'slug',
'tip'=>$L->g('URL associated with the content'),
'label'=>$L->g('Friendly URL'),
'placeholder'=>$L->g('Leave empty for autocomplete by Bludit.'),
'value'=>$page->slug()
));
// Robots
echo Bootstrap::formCheckbox(array(
'name'=>'noindex',
'label'=>'Robots',
'labelForCheckbox'=>$L->g('apply-code-noindex-code-to-this-page'),
'placeholder'=>'',
'checked'=>$page->noindex(),
'tip'=>$L->g('This tells search engines not to show this page in their search results.')
));
// Robots
echo Bootstrap::formCheckbox(array(
'name'=>'nofollow',
'label'=>'',
'labelForCheckbox'=>$L->g('apply-code-nofollow-code-to-this-page'),
'placeholder'=>'',
'checked'=>$page->nofollow(),
'tip'=>$L->g('This tells search engines not to follow links on this page.')
));
// Robots
echo Bootstrap::formCheckbox(array(
'name'=>'noarchive',
'label'=>'',
'labelForCheckbox'=>$L->g('apply-code-noarchive-code-to-this-page'),
'placeholder'=>'',
'checked'=>$page->noarchive(),
'tip'=>$L->g('This tells search engines not to save a cached copy of this page.')
));
?>
</div>
</div>
</div>
<!-- Custom fields: TOP -->
<?php
$customFields = $site->customFields();
foreach ($customFields as $field=>$options) {
if ( isset($options['position']) && ($options['position']=='top') ) {
if ($options['type']=="string") {
echo Bootstrap::formInputTextBlock(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'value'=>$page->custom($field),
'tip'=>(isset($options['tip'])?$options['tip']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'class'=>'mb-2',
'labelClass'=>'mb-2 pb-2 border-bottom text-uppercase w-100'
));
} elseif ($options['type']=="bool") {
echo Bootstrap::formCheckbox(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'checked'=>$page->custom($field),
'labelForCheckbox'=>(isset($options['tip'])?$options['tip']:''),
'class'=>'mb-2',
'labelClass'=>'mb-2 pb-2 border-bottom text-uppercase w-100'
));
}
}
}
?>
<!-- Title -->
<div class="form-group mb-1">
<input id="jstitle" name="title" type="text" class="form-control form-control-lg rounded-0" value="<?php echo $page->title() ?>" placeholder="<?php $L->p('Enter title') ?>">
</div>
<!-- Editor -->
<textarea id="jseditor" class="editable h-100" style=""><?php echo $page->contentRaw(true) ?></textarea>
<!-- Custom fields: BOTTOM -->
<?php
$customFields = $site->customFields();
foreach ($customFields as $field=>$options) {
if ( isset($options['position']) && ($options['position']=='bottom') ) {
if ($options['type']=="string") {
echo Bootstrap::formInputTextBlock(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'value'=>$page->custom($field),
'tip'=>(isset($options['tip'])?$options['tip']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'class'=>'mt-2',
'labelClass'=>'mb-2 pb-2 border-bottom text-uppercase w-100'
));
} elseif ($options['type']=="bool") {
echo Bootstrap::formCheckbox(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'checked'=>$page->custom($field),
'labelForCheckbox'=>(isset($options['tip'])?$options['tip']:''),
'class'=>'mt-2',
'labelClass'=>'mb-2 pb-2 border-bottom text-uppercase w-100'
));
}
}
}
?>
</form>
<!-- Modal for Delete page -->
<div id="jsdeletePageModal" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<h3><?php $L->p('Delete content') ?></h3>
<p><?php $L->p('Are you sure you want to delete this page') ?></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-link" data-dismiss="modal"><?php $L->p('Cancel') ?></button>
<button type="button" class="btn btn-danger" data-dismiss="modal" id="jsbuttonDeleteAccept"><?php $L->p('Delete') ?></button>
</div>
</div>
</div>
<script>
$(document).ready(function() {
$("#jsbuttonDeleteAccept").on("click", function() {
$("#jstype").val("delete");
$("#jscontent").val("");
$("#jsform").submit();
});
});
</script>
</div>
<!-- Modal for Media Manager -->
<?php include(PATH_ADMIN_THEMES.'booty/html/media.php'); ?>
<script>
$(document).ready(function() {
// Define function if they doesn't exist
// This helps if the user doesn't activate any plugin as editor
if (typeof editorGetContent != "function") {
window.editorGetContent = function(){
return $("#jseditor").val();
};
}
if (typeof editorInsertMedia != "function") {
window.editorInsertMedia = function(filename){
$("#jseditor").val($('#jseditor').val()+'<img src="'+filename+'" alt="">');
};
}
// Button switch
$("#jsswitchButton").on("click", function() {
if ($(this).data("switch")=="publish") {
$(this).html('<i class="fa fa-square switch-icon-draft"></i> <?php $L->p('Draft') ?>');
$(this).data("switch", "draft");
} else {
$(this).html('<i class="fa fa-square switch-icon-publish"></i> <?php $L->p('Publish') ?>');
$(this).data("switch", "publish");
}
});
// Button preview
$("#jsbuttonPreview").on("click", function() {
var uuid = $("#jsuuid").val();
var title = $("#jstitle").val();
var content = editorGetContent();
var ajax = new bluditAjax();
bluditAjax.saveAsDraft(uuid, title, content).then(function(data) {
var preview = window.open("<?php echo DOMAIN_PAGES.'autosave-'.$page->uuid().'?preview='.md5('autosave-'.$page->uuid()) ?>", "bludit-preview");
preview.focus();
});
});
// Button Save
$("#jsbuttonSave").on("click", function() {
// If the switch is setted to "published", get the value from the selector
if ($("#jsswitchButton").data("switch")=="publish") {
var value = $("#jstypeSelector option:selected").val();
$("#jstype").val(value);
} else {
$("#jstype").val("draft");
}
// Get the content
$("#jscontent").val( editorGetContent() );
// Submit the form
$("#jsform").submit();
});
// Button Save as draft
$("#jsbuttonDraft").on("click", function() {
// Set the type as draft
$("#jstype").val("draft");
// Get the content
$("#jscontent").val( editorGetContent() );
// Submit the form
$("#jsform").submit();
});
// Autosave
var currentContent = editorGetContent();
setInterval(function() {
var uuid = $("#jsuuid").val();
var title = $("#jstitle").val() + "[<?php $L->p('Autosave') ?>]";
var content = editorGetContent();
// Autosave when content has at least 100 characters
if (content.length<100) {
return false;
}
// Autosave only when the user change the content
if (currentContent!=content) {
currentContent = content;
bluditAjax.saveAsDraft(uuid, title, content).then(function(data) {
if (data.status==0) {
showAlert("<?php $L->p('Autosave') ?>");
}
});
}
},1000*60*AUTOSAVE_INTERVAL);
});
</script>

View File

@ -0,0 +1,249 @@
<?php
HTML::title(array('title'=>$L->g('Edit page'), 'icon'=>'file-text-o'));
HTML::formOpen(array('class'=>'uk-form-stacked'));
// Security token
HTML::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$Security->getTokenCSRF()
));
// Key input
HTML::formInputHidden(array(
'name'=>'key',
'value'=>$_Page->key()
));
// LEFT SIDE
// --------------------------------------------------------------------
echo '<div class="uk-grid uk-grid-medium">';
echo '<div class="bl-publish-view uk-width-8-10">';
// Title input
HTML::formInputText(array(
'name'=>'title',
'value'=>$_Page->title(),
'class'=>'uk-width-1-1 uk-form-large',
'placeholder'=>$L->g('Title')
));
// Content input
HTML::formTextarea(array(
'name'=>'content',
'value'=>$_Page->contentRaw(false),
'class'=>'uk-width-1-1 uk-form-large',
'placeholder'=>''
));
// Form buttons
echo '<div class="uk-form-row uk-margin-bottom">';
echo '
<button class="uk-button uk-button-primary" type="submit">'.$L->g('Save').'</button>
<button class="uk-button uk-button-primary" type="button" id="jsSaveDraft">'.$L->g('Save as draft').'</button>
';
if(count($_Page->children())===0)
{
echo ' <button id="jsdelete" name="delete-page" class="uk-button" type="submit">'.$L->g('Delete').'</button>';
echo ' <a class="uk-button" href="'.HTML_PATH_ADMIN_ROOT.'manage-posts">'.$L->g('Cancel').'</a>';
}
echo '</div>';
echo '</div>';
// RIGHT SIDE
// --------------------------------------------------------------------
echo '<div class="bl-publish-sidebar uk-width-2-10">';
echo '<ul>';
// GENERAL TAB
// --------------------------------------------------------------------
echo '<li><h2 class="sidebar-button" data-view="sidebar-general-view"><i class="uk-icon-angle-down"></i> '.$L->g('General').'</h2></li>';
echo '<li id="sidebar-general-view" class="sidebar-view">';
// Category
/*
HTML::formSelect(array(
'name'=>'category',
'label'=>$L->g('Category'),
'class'=>'uk-width-1-1 uk-form-medium',
'options'=>$dbCategories->getAll(),
'selected'=>$_Page->category(),
'tip'=>'',
'addEmptySpace'=>true
));
*/
// Description input
HTML::formTextarea(array(
'name'=>'description',
'label'=>$L->g('description'),
'value'=>$_Page->description(),
'rows'=>'4',
'class'=>'uk-width-1-1 uk-form-medium',
'tip'=>$L->g('this-field-can-help-describe-the-content')
));
echo '</li>';
// IMAGES TAB
// --------------------------------------------------------------------
echo '<li><h2 class="sidebar-button" data-view="sidebar-images-view"><i class="uk-icon-angle-down"></i> '.$L->g('Images').'</h2></li>';
echo '<li id="sidebar-images-view" class="sidebar-view">';
// --- BLUDIT COVER IMAGE ---
HTML::bluditCoverImage($_Page->coverImage(false));
// --- BLUDIT QUICK IMAGES ---
HTML::bluditQuickImages();
// --- BLUDIT IMAGES V8 ---
HTML::bluditImagesV8();
// --- BLUDIT MENU V8 ---
HTML::bluditMenuV8();
echo '</li>';
// TAGS
// --------------------------------------------------------------------
echo '<li><h2 class="sidebar-button" data-view="sidebar-tags-view"><i class="uk-icon-angle-down"></i> '.$L->g('Tags').'</h2></li>';
echo '<li id="sidebar-tags-view" class="sidebar-view">';
// Tags input
HTML::tags(array(
'name'=>'tags',
'label'=>$L->g('Tags'),
'allTags'=>$dbTags->getAll(),
'selectedTags'=>$_Page->tags(true)
));
echo '</li>';
// ADVANCED TAB
// --------------------------------------------------------------------
echo '<li><h2 class="sidebar-button" data-view="sidebar-advanced-view"><i class="uk-icon-angle-down"></i> '.$L->g('Advanced').'</h2></li>';
echo '<li id="sidebar-advanced-view" class="sidebar-view">';
// Status input
HTML::formSelect(array(
'name'=>'status',
'label'=>$L->g('Status'),
'class'=>'uk-width-1-1 uk-form-medium',
'options'=>array('published'=>$L->g('Published'), 'draft'=>$L->g('Draft')),
'selected'=>($_Page->draft()?'draft':'published'),
'tip'=>''
));
// If the page is parent then doesn't can have a parent.
if(count($_Page->children())===0)
{
// Parent input
$options = array();
$options[NO_PARENT_CHAR] = '('.$Language->g('No parent').')';
$options += $dbPages->parentKeyList();
unset($options[$_Page->key()]);
HTML::formSelect(array(
'name'=>'parent',
'label'=>$L->g('Parent'),
'class'=>'uk-width-1-1 uk-form-medium',
'options'=>$options,
'selected'=>$_Page->parentKey(),
'tip'=>''
));
}
// Position input
HTML::formInputText(array(
'name'=>'position',
'value'=>$_Page->position(),
'class'=>'uk-width-1-1 uk-form-large',
'label'=>$L->g('Position')
));
// Slug input
HTML::formInputText(array(
'name'=>'slug',
'value'=>$_Page->slug(),
'class'=>'uk-width-1-1 uk-form-large',
'tip'=>$L->g('you-can-modify-the-url-which-identifies'),
'label'=>$L->g('Friendly URL')
));
echo '</li>';
echo '</ul>';
echo '</div>';
echo '</div>';
HTML::formClose();
?>
<script>
$(document).ready(function()
{
var key = $("#jskey").val();
$("#jsslug").keyup(function() {
var text = $(this).val();
var parent = $("#jsparent").val();
checkSlugPage(text, parent, key, $("#jsslug"));
});
$("#jstitle").keyup(function() {
var text = $(this).val();
var parent = $("#jsparent").val();
checkSlugPage(text, parent, key, $("#jsslug"));
});
$("#jsparent").change(function() {
var parent = $(this).val();
var text = $("#jsslug").val();
if(parent==NO_PARENT_CHAR) {
$("#jsparentExample").text("");
}
else {
$("#jsparentExample").text(parent+"/");
}
checkSlugPage(text, parent, key, $("#jsslug"));
});
$("#jsdelete").click(function() {
if(confirm("<?php $Language->p('confirm-delete-this-action-cannot-be-undone') ?>")==false) {
return false;
}
});
// Button Save as draft
$("#jsSaveDraft").on("click", function() {
$("#jsstatus").val("draft");
$(".uk-form").submit();
});
// Right sidebar
$(".sidebar-button").click(function() {
var view = "#" + $(this).data("view");
if( $(view).is(":visible") ) {
$(view).hide();
}
else {
$(".sidebar-view").hide();
$(view).show();
}
});
});
</script>

View File

@ -0,0 +1,207 @@
<?php
HTML::title(array('title'=>$L->g('Edit post'), 'icon'=>'pencil'));
HTML::formOpen(array('class'=>'uk-form-stacked'));
// Security token
HTML::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$Security->getTokenCSRF()
));
// Key input
HTML::formInputHidden(array(
'name'=>'key',
'value'=>$_Post->key()
));
// LEFT SIDE
// --------------------------------------------------------------------
echo '<div class="uk-grid uk-grid-medium">';
echo '<div class="bl-publish-view uk-width-8-10">';
// Title input
HTML::formInputText(array(
'name'=>'title',
'value'=>$_Post->title(),
'class'=>'uk-width-1-1 uk-form-large',
'placeholder'=>$L->g('Title')
));
// Content input
HTML::formTextarea(array(
'name'=>'content',
'value'=>$_Post->contentRaw(false),
'class'=>'uk-width-1-1 uk-form-large',
'placeholder'=>''
));
// Form buttons
echo '<div class="uk-form-row uk-margin-bottom">
<button class="uk-button uk-button-primary" type="submit">'.$L->g('Save').'</button>
<button class="uk-button uk-button-primary" type="button" id="jsSaveDraft">'.$L->g('Save as draft').'</button>
<button id="jsdelete-post" name="delete-post" class="uk-button" type="submit">'.$L->g('Delete').'</button>
<a class="uk-button" href="'.HTML_PATH_ADMIN_ROOT.'manage-posts">'.$L->g('Cancel').'</a>
</div>';
echo '</div>';
// RIGHT SIDE
// --------------------------------------------------------------------
echo '<div class="bl-publish-sidebar uk-width-2-10">';
echo '<ul>';
// GENERAL TAB
// --------------------------------------------------------------------
echo '<li><h2 class="sidebar-button" data-view="sidebar-general-view"><i class="uk-icon-angle-down"></i> '.$L->g('General').'</h2></li>';
echo '<li id="sidebar-general-view" class="sidebar-view">';
// Category
/*
HTML::formSelect(array(
'name'=>'category',
'label'=>$L->g('Category'),
'class'=>'uk-width-1-1 uk-form-medium',
'options'=>$dbCategories->getAll(),
'selected'=>$_Post->category(),
'tip'=>'',
'addEmptySpace'=>true
));*/
// Description input
HTML::formTextarea(array(
'name'=>'description',
'label'=>$L->g('description'),
'value'=>$_Post->description(),
'rows'=>'4',
'class'=>'uk-width-1-1 uk-form-medium',
'tip'=>$L->g('this-field-can-help-describe-the-content')
));
echo '</li>';
// IMAGES TAB
// --------------------------------------------------------------------
echo '<li><h2 class="sidebar-button" data-view="sidebar-images-view"><i class="uk-icon-angle-down"></i> '.$L->g('Images').'</h2></li>';
echo '<li id="sidebar-images-view" class="sidebar-view">';
// --- BLUDIT COVER IMAGE ---
HTML::bluditCoverImage($_Post->coverImage(false));
// --- BLUDIT QUICK IMAGES ---
HTML::bluditQuickImages();
// --- BLUDIT IMAGES V8 ---
HTML::bluditImagesV8();
// --- BLUDIT MENU V8 ---
HTML::bluditMenuV8();
echo '</li>';
// TAGS
// --------------------------------------------------------------------
echo '<li><h2 class="sidebar-button" data-view="sidebar-tags-view"><i class="uk-icon-angle-down"></i> '.$L->g('Tags').'</h2></li>';
echo '<li id="sidebar-tags-view" class="sidebar-view">';
// Tags input
HTML::tags(array(
'name'=>'tags',
'label'=>$L->g('Tags'),
'allTags'=>$dbTags->getAll(),
'selectedTags'=>$_Post->tags(true)
));
echo '</li>';
// ADVANCED TAB
// --------------------------------------------------------------------
echo '<li><h2 class="sidebar-button" data-view="sidebar-advanced-view"><i class="uk-icon-angle-down"></i> '.$L->g('Advanced').'</h2></li>';
echo '<li id="sidebar-advanced-view" class="sidebar-view">';
// Status input
HTML::formSelect(array(
'name'=>'status',
'label'=>$L->g('Status'),
'class'=>'uk-width-1-1 uk-form-medium',
'options'=>array('published'=>$L->g('Published'), 'draft'=>$L->g('Draft')),
'selected'=>($_Post->draft()?'draft':'published'),
'tip'=>''
));
// Date input
HTML::formInputText(array(
'name'=>'date',
'value'=>$_Post->dateRaw(),
'class'=>'uk-width-1-1 uk-form-large',
'tip'=>$L->g('To schedule the post just select the date and time'),
'label'=>$L->g('Date')
));
// Slug input
HTML::formInputText(array(
'name'=>'slug',
'value'=>$_Post->slug(),
'class'=>'uk-width-1-1 uk-form-large',
'tip'=>$L->g('you-can-modify-the-url-which-identifies'),
'label'=>$L->g('Friendly URL')
));
echo '</li>';
echo '</ul>';
echo '</div>';
echo '</div>';
HTML::formClose();
?>
<script>
$(document).ready(function() {
var key = $("#jskey").val();
$("#jsdate").datetimepicker({format:"<?php echo DB_DATE_FORMAT ?>"});
$("#jstitle").keyup(function() {
var slug = $(this).val();
checkSlugPost(slug, key, $("#jsslug"));
});
$("#jsslug").keyup(function() {
var slug = $("#jsslug").val();
checkSlugPost(slug, key, $("#jsslug"));
});
$("#jsdelete-post").click(function() {
if(confirm("<?php $Language->p('confirm-delete-this-action-cannot-be-undone') ?>")==false) {
return false;
}
});
// Button Save as draft
$("#jsSaveDraft").on("click", function() {
$("#jsstatus").val("draft");
$(".uk-form").submit();
});
// Right sidebar
$(".sidebar-button").click(function() {
var view = "#" + $(this).data("view");
if( $(view).is(":visible") ) {
$(view).hide();
}
else {
$(".sidebar-view").hide();
$(view).show();
}
});
});
</script>

View File

@ -1,298 +1,186 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<?php echo Bootstrap::formOpen(array('id'=>'jsform', 'class'=>'tab-content')); ?>
<div class="align-middle">
<div class="float-right mt-1">
<button type="submit" class="btn btn-primary btn-sm" name="save"><?php $L->p('Save') ?></button>
<a class="btn btn-secondary btn-sm" href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>" role="button"><?php $L->p('Cancel') ?></a>
</div>
<?php echo Bootstrap::pageTitle(array('title'=>$L->g('Edit user'), 'icon'=>'user')); ?>
</div>
<!-- TABS -->
<nav class="mb-3">
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-item nav-link active" id="nav-profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="nav-profile" aria-selected="false"><?php $L->p('Profile') ?></a>
<a class="nav-item nav-link" id="nav-picture-tab" data-toggle="tab" href="#picture" role="tab" aria-controls="nav-picture" aria-selected="false"><?php $L->p('Profile picture') ?></a>
<a class="nav-item nav-link" id="nav-security-tab" data-toggle="tab" href="#security" role="tab" aria-controls="nav-security" aria-selected="false"><?php $L->p('Security') ?></a>
<a class="nav-item nav-link" id="nav-social-tab" data-toggle="tab" href="#social" role="tab" aria-controls="nav-social" aria-selected="false"><?php $L->p('Social Networks') ?></a>
</div>
</nav>
<?php
// Token CSRF
echo Bootstrap::formInputHidden(array(
HTML::title(array('title'=>$L->g('Edit user'), 'icon'=>'user'));
echo '<div class="uk-grid">';
echo '<div class="uk-width-7-10">';
HTML::formOpen(array('id'=>'edit-user-profile-form','class'=>'uk-form-horizontal'));
// Security token
HTML::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF()
'value'=>$Security->getTokenCSRF()
));
// Username
echo Bootstrap::formInputHidden(array(
// Security token
HTML::formInputHidden(array(
'name'=>'username',
'value'=>$user->username()
'value'=>$_User->username()
));
HTML::legend(array('value'=>$L->g('Profile'), 'class'=>'first-child'));
HTML::formInputText(array(
'name'=>'usernameDisable',
'label'=>$L->g('Username'),
'value'=>$_User->username(),
'class'=>'uk-width-1-2 uk-form-medium',
'disabled'=>true,
'tip'=>''
));
HTML::formInputText(array(
'name'=>'firstName',
'label'=>$L->g('First name'),
'value'=>$_User->firstName(),
'class'=>'uk-width-1-2 uk-form-medium',
'tip'=>''
));
HTML::formInputText(array(
'name'=>'lastName',
'label'=>$L->g('Last name'),
'value'=>$_User->lastName(),
'class'=>'uk-width-1-2 uk-form-medium',
'tip'=>''
));
echo '<div class="uk-form-row">
<label class="uk-form-label">'.$L->g('password').'</label>
<div class="uk-form-controls">
<a href="'.HTML_PATH_ADMIN_ROOT.'user-password/'.$_User->username().'">'.$L->g('Change password').'</a>
</div>
</div>';
if($Login->role()==='admin') {
HTML::formSelect(array(
'name'=>'role',
'label'=>$L->g('Role'),
'options'=>array('editor'=>$L->g('Editor'), 'admin'=>$L->g('Administrator')),
'selected'=>$_User->role(),
'tip'=>''
));
}
HTML::formInputText(array(
'name'=>'email',
'label'=>$L->g('Email'),
'value'=>$_User->email(),
'class'=>'uk-width-1-2 uk-form-medium',
'tip'=>$L->g('email-will-not-be-publicly-displayed')
));
HTML::legend(array('value'=>$L->g('Social networks links')));
HTML::formInputText(array(
'name'=>'twitter',
'label'=>'Twitter',
'value'=>$_User->twitter(),
'class'=>'uk-width-1-2 uk-form-medium',
'tip'=>''
));
HTML::formInputText(array(
'name'=>'facebook',
'label'=>'Facebook',
'value'=>$_User->facebook(),
'class'=>'uk-width-1-2 uk-form-medium',
'tip'=>''
));
HTML::formInputText(array(
'name'=>'googlePlus',
'label'=>'Google+',
'value'=>$_User->googlePlus(),
'class'=>'uk-width-1-2 uk-form-medium',
'tip'=>''
));
HTML::formInputText(array(
'name'=>'instagram',
'label'=>'Instagram',
'value'=>$_User->instagram(),
'class'=>'uk-width-1-2 uk-form-medium',
'tip'=>''
));
echo '<div class="uk-form-row">
<div class="uk-form-controls">
<button type="submit" class="uk-button uk-button-primary">'.$L->g('Save').'</button>
<a href="'.HTML_PATH_ADMIN_ROOT.'users" class="uk-button">'.$L->g('Cancel').'</a>
</div>
</div>';
HTML::legend(array('value'=>$L->g('Status')));
HTML::formInputText(array(
'name'=>'status',
'label'=>$L->g('сurrent status'),
'value'=>$_User->enabled()?$L->g('Enabled'):$L->g('Disabled'),
'class'=>'uk-width-1-2 uk-form-medium',
'disabled'=>true,
'tip'=>$_User->enabled()?'':$L->g('To enable the user you have to set a new password')
));
if( $_User->enabled() ) {
echo '<div class="uk-form-row">
<div class="uk-form-controls">
<button type="submit" id="jsdisable-user" class="delete-button" name="disable-user"><i class="uk-icon-ban"></i> '.$L->g('Disable the user').'</button>
</div>
</div>';
}
if( ($Login->role()==='admin') && ($_User->username()!='admin') ) {
HTML::legend(array('value'=>$L->g('Delete')));
echo '<div class="uk-form-row">
<div class="uk-form-controls">
<button type="submit" id="jsdelete-user-associate" class="delete-button" name="delete-user-associate"><i class="uk-icon-ban"></i> '.$L->g('Delete the user and associate its posts to admin user').'</button>
<button type="submit" id="jsdelete-user-all" class="delete-button" name="delete-user-all"><i class="uk-icon-ban"></i> '.$L->g('Delete the user and all its posts').'</button>
</div>
</div>';
}
HTML::formClose();
echo '</div>';
echo '<div class="uk-width-3-10" style="margin-top: 50px; text-align: center;">';
HTML::profileUploader($_User->username());
echo '</div>';
echo '</div>';
?>
<div class="tab-content" id="nav-tabContent">
<!-- Profile tab -->
<div class="tab-pane fade show active" id="profile" role="tabpanel" aria-labelledby="nav-profile-tab">
<?php
// Display username but disable the field
echo Bootstrap::formInputText(array(
'name'=>'usernameDisabled',
'label'=>$L->g('Username'),
'value'=>$user->username(),
'class'=>'',
'placeholder'=>'',
'disabled'=>true,
'tip'=>''
));
if ($login->role()==='admin') {
echo Bootstrap::formSelect(array(
'name'=>'role',
'label'=>$L->g('Role'),
'options'=>array('author'=>$L->g('Author'), 'editor'=>$L->g('Editor'), 'admin'=>$L->g('Administrator')),
'selected'=>$user->role(),
'class'=>'',
'tip'=>$L->g('author-can-write-and-edit-their-own-content')
));
}
echo Bootstrap::formInputText(array(
'name'=>'email',
'label'=>$L->g('Email'),
'value'=>$user->email(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'nickname',
'label'=>$L->g('Nickname'),
'value'=>$user->nickname(),
'class'=>'',
'placeholder'=>'',
'tip'=>$L->g('The nickname is almost used in the themes to display the author of the content')
));
echo Bootstrap::formInputText(array(
'name'=>'firstName',
'label'=>$L->g('First Name'),
'value'=>$user->firstName(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'lastName',
'label'=>$L->g('Last Name'),
'value'=>$user->lastName(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
));
?>
</div>
<!-- Profile picture tab -->
<div class="tab-pane fade" id="picture" role="tabpanel" aria-labelledby="nav-picture-tab">
<div class="container">
<div class="row">
<div class="col-lg-4 col-sm-12 p-0 pr-2">
<div class="custom-file">
<input type="file" class="custom-file-input" id="jsprofilePictureInputFile" name="profilePictureInputFile">
<label class="custom-file-label" for="jsprofilePictureInputFile"><?php $L->p('Upload image'); ?></label>
</div>
<!-- <button id="jsbuttonRemovePicture" type="button" class="btn btn-primary w-100 mt-4 mb-4"><i class="fa fa-trash"></i> Remove picture</button> -->
</div>
<div class="col-lg-8 col-sm-12 p-0 text-center">
<img id="jsprofilePicturePreview" class="img-fluid img-thumbnail" alt="Profile picture preview" src="<?php echo (Sanitize::pathFile(PATH_UPLOADS_PROFILES.$user->username().'.png')?DOMAIN_UPLOADS_PROFILES.$user->username().'.png?version='.time():HTML_PATH_CORE_IMG.'default.svg') ?>" />
</div>
</div>
</div>
<script>
// $("#jsbuttonRemovePicture").on("click", function() {
// var username = $("#jsusername").val();
// bluditAjax.removeProfilePicture(username);
// $("#jsprofilePicturePreview").attr("src", "<?php echo HTML_PATH_CORE_IMG.'default.svg' ?>");
// });
$("#jsprofilePictureInputFile").on("change", function() {
var formData = new FormData();
formData.append('tokenCSRF', tokenCSRF);
formData.append('profilePictureInputFile', $(this)[0].files[0]);
formData.append('username', $("#jsusername").val());
$.ajax({
url: HTML_PATH_ADMIN_ROOT+"ajax/profile-picture-upload",
type: "POST",
data: formData,
cache: false,
contentType: false,
processData: false
}).done(function(data) {
if (data.status==0) {
$("#jsprofilePicturePreview").attr('src',data.absoluteURL+"?time="+Math.random());
} else {
showAlert(data.message);
}
});
});
</script>
</div>
<!-- Security tab -->
<div class="tab-pane fade" id="security" role="tabpanel" aria-labelledby="nav-security-tab">
<?php
echo Bootstrap::formTitle(array('title'=>$L->g('Password')));
echo '
<div class="form-group">
<a href="'.HTML_PATH_ADMIN_ROOT.'user-password/'.$user->username().'" class="btn btn-primary mr-2">'.$L->g('Change password').'</a>
</div>
';
echo Bootstrap::formTitle(array('title'=>$L->g('Authentication Token')));
echo Bootstrap::formInputText(array(
'name'=>'tokenAuth',
'label'=>$L->g('Token'),
'value'=>$user->tokenAuth(),
'class'=>'',
'tip'=>$L->g('this-token-is-similar-to-a-password-it-should-not-be-shared')
));
if (checkRole(array('admin'),false)) {
echo Bootstrap::formTitle(array('title'=>$L->g('Status')));
echo Bootstrap::formInputText(array(
'name'=>'status',
'label'=>$L->g('Current status'),
'value'=>$user->enabled()?$L->g('Enabled'):$L->g('Disabled'),
'class'=>'',
'disabled'=>true,
'tip'=>$user->enabled()?'':$L->g('To enable the user you must set a new password')
));
if ($user->enabled()) {
echo '
<div class="form-group row">
<div class="col-sm-2"></div>
<div class="col-sm-10">
<button type="submit" class="btn btn-warning mr-2" id="jsdisableUser" name="disableUser">'.$L->g('Disable user').'</button>
<button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndKeepContent" name="deleteUserAndKeepContent">'.$L->g('Delete user and keep content').'</button>
<button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndDeleteContent" name="deleteUserAndDeleteContent">'.$L->g('Delete user and delete content').'</button>
</div>
</div>
';
}
}
?>
</div>
<!-- Social Networks tab -->
<div class="tab-pane fade" id="social" role="tabpanel" aria-labelledby="nav-social-tab">
<?php
echo Bootstrap::formInputText(array(
'name'=>'twitter',
'label'=>'Twitter',
'value'=>$user->twitter(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'facebook',
'label'=>'Facebook',
'value'=>$user->facebook(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'codepen',
'label'=>'CodePen',
'value'=>$user->codepen(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'instagram',
'label'=>'Instagram',
'value'=>$user->instagram(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'gitlab',
'label'=>'GitLab',
'value'=>$user->gitlab(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'github',
'label'=>'GitHub',
'value'=>$user->github(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'linkedin',
'label'=>'LinkedIn',
'value'=>$user->linkedin(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'mastodon',
'label'=>'Mastodon',
'value'=>$user->mastodon(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'vk',
'label'=>'VK',
'value'=>$user->vk(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
));
?>
</div>
</div>
<?php echo Bootstrap::formClose(); ?>
<script>
// Open current tab after refresh page
$(function() {
$('a[data-toggle="tab"]').on('click', function(e) {
window.localStorage.setItem('activeTab', $(e.target).attr('href'));
console.log($(e.target).attr('href'));
});
var activeTab = window.localStorage.getItem('activeTab');
if (activeTab) {
$('#nav-tab a[href="' + activeTab + '"]').tab('show');
//window.localStorage.removeItem("activeTab");
$(document).ready(function() {
$("#jsdelete-user-associate").click(function() {
if(confirm("<?php $Language->p('confirm-delete-this-action-cannot-be-undone') ?>")==false) {
return false;
}
});
$("#jsdelete-user-all").click(function() {
if(confirm("<?php $Language->p('confirm-delete-this-action-cannot-be-undone') ?>")==false) {
return false;
}
});
$("#jsdisable-user").click(function() {
if(confirm("<?php $Language->p('do-you-want-to-disable-the-user') ?>")==false) {
return false;
}
});
});
</script>

View File

@ -0,0 +1,23 @@
<?php if(empty($_POST)) { ?>
<div class="login-form">
<form method="post" action="" class="uk-form" autocomplete="off">
<input type="hidden" id="jstoken" name="tokenCSRF" value="<?php $Security->printTokenCSRF() ?>">
<div class="uk-form-row">
<input name="email" class="uk-width-1-1 uk-form-large" placeholder="<?php $L->p('Email') ?>" type="text">
</div>
<div class="uk-form-row">
<button type="submit" class="uk-width-1-1 uk-button uk-button-primary uk-button-large"><?php $L->p('Get login access code') ?></button>
</div>
</form>
</div>
<?php } ?>
<a class="login-email" href="<?php echo HTML_PATH_ADMIN_ROOT.'login' ?>"><i class="uk-icon-chevron-left"></i> <?php $L->p('Back to login form') ?></a>

View File

@ -1,37 +1,23 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
<div class="login-form">
echo '<h1 class="text-center mb-5 mt-5 font-weight-normal" style="color: #555;">BLUDIT</h1>';
<form method="post" action="" class="uk-form" autocomplete="off">
echo Bootstrap::formOpen(array());
<input type="hidden" id="jstoken" name="tokenCSRF" value="<?php $Security->printTokenCSRF() ?>">
echo Bootstrap::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF()
));
echo '
<div class="form-group">
<input type="text" value="'.(isset($_POST['username'])?$_POST['username']:'').'" class="form-control form-control-lg" id="jsusername" name="username" placeholder="'.$L->g('Username').'" autofocus>
</div>
';
echo '
<div class="form-group">
<input type="password" class="form-control form-control-lg" id="jspassword" name="password" placeholder="'.$L->g('Password').'">
</div>
';
echo '
<div class="form-check">
<input class="form-check-input" type="checkbox" value="true" id="jsremember" name="remember">
<label class="form-check-label" for="jsremember">'.$L->g('Remember me').'</label>
<div class="uk-form-row">
<input name="username" class="uk-width-1-1 uk-form-large" placeholder="<?php $L->p('Username') ?>" type="text">
</div>
<div class="form-group mt-4">
<button type="submit" class="btn btn-primary btn-lg mr-2 w-100" name="save">'.$L->g('Login').'</button>
<div class="uk-form-row">
<input name="password" class="uk-width-1-1 uk-form-large" placeholder="<?php $L->p('Password') ?>" type="password">
</div>
';
echo '</form>';
<div class="uk-form-row">
<button type="submit" class="uk-width-1-1 uk-button uk-button-primary uk-button-large"><?php $Language->p('Login') ?></button>
</div>
?>
</form>
</div>
<a class="login-email" href="<?php echo HTML_PATH_ADMIN_ROOT.'login-email' ?>"><i class="uk-icon-envelope-o"></i> <?php $L->p('Email access code') ?></a>

View File

@ -0,0 +1,61 @@
<?php
HTML::title(array('title'=>$L->g('Manage pages'), 'icon'=>'folder'));
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'new-page"><i class="uk-icon-plus"></i> '.$L->g('Add a new page').'</a>';
echo '
<table class="uk-table uk-table-striped">
<thead>
<tr>
<th>'.$L->g('Title').'</th>
<th class="uk-text-center">'.$L->g('Position').'</th>
<th>'.$L->g('Friendly URL').'</th>
</tr>
</thead>
<tbody>
';
foreach($pagesParents[NO_PARENT_CHAR] as $key=>$db)
{
// Parent page
$Page = $pages[$key];
$friendlyURL = Text::isEmpty($Url->filters('page')) ? '/'.$Page->key() : '/'.$Url->filters('page').'/'.$Page->key();
echo '<tr>';
echo '<td>';
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'edit-page/'.$Page->key().'">'.($Page->published()?'':'<span class="label-draft">'.$Language->g('Draft').'</span> ').($Page->title()?$Page->title():'<span class="label-empty-title">'.$Language->g('Empty title').'</span> ').'</a>';
echo '</td>';
echo '<td class="uk-text-center">'.$Page->position().'</td>';
echo '<td><a target="_blank" href="'.$Page->permalink().'">'.$friendlyURL.'</a></td>';
echo '</tr>';
// If the page has children
if(isset($pagesParents[$Page->key()]))
{
// Get the children
$children = $pagesParents[$Page->key()];
foreach($children as $keyChildren=>$dbChildren)
{
// Parent page
$Page = $pages[$keyChildren];
$friendlyURL = Text::isEmpty($Url->filters('page')) ? '/'.$Page->key() : '/'.$Url->filters('page').'/'.$Page->key();
echo '<tr class="children">';
echo '<td class="children">';
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'edit-page/'.$Page->key().'">'.($Page->published()?'':'<span class="label-draft">'.$Language->g('Draft').'</span> ').($Page->title()?$Page->title():'<span class="label-empty-title">'.$Language->g('Empty title').'</span> ').'</a>';
echo '</td>';
echo '<td class="uk-text-center">'.$Page->position().'</td>';
echo '<td><a target="_blank" href="'.$Page->permalink().'">'.$friendlyURL.'</a></td>';
echo '</tr>';
}
}
}
echo '
</tbody>
</table>
';

View File

@ -0,0 +1,62 @@
<?php
HTML::title(array('title'=>$L->g('Manage posts'), 'icon'=>'folder'));
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'new-post"><i class="uk-icon-plus"></i> '.$L->g('Add a new post').'</a>';
echo '
<table class="uk-table uk-table-striped">
<thead>
<tr>
<th>'.$L->g('Title').'</th>
<th class="uk-text-center">'.$L->g('Published date').'</th>
<th>'.$L->g('Friendly URL').'</th>
</tr>
</thead>
<tbody>
';
foreach($posts as $Post)
{
$status = false;
if($Post->scheduled()) {
$status = $Language->g('Scheduled');
}
elseif(!$Post->published()) {
$status = $Language->g('Draft');
}
echo '<tr>';
echo '<td><a href="'.HTML_PATH_ADMIN_ROOT.'edit-post/'.$Post->key().'">'.($status?'<span class="label-draft">'.$status.'</span>':'').($Post->title()?$Post->title():'<span class="label-empty-title">'.$Language->g('Empty title').'</span> ').'</a></td>';
echo '<td class="uk-text-center">'.$Post->dateRaw().'</td>';
$friendlyURL = Text::isEmpty($Url->filters('post')) ? '/'.$Post->key() : '/'.$Url->filters('post').'/'.$Post->key();
echo '<td><a target="_blank" href="'.$Post->permalink().'">'.$friendlyURL.'</a></td>';
echo '</tr>';
}
echo '
</tbody>
</table>
';
?>
<div id="paginator">
<ul>
<?php
if(Paginator::get('showNewer')) {
echo '<li class="first"><a href="'.HTML_PATH_ADMIN_ROOT.'manage-posts?page=0">« '.$Language->g('First page').'</a></li>';
echo '<li class="previous"><a href="'.HTML_PATH_ADMIN_ROOT.'manage-posts?page='.Paginator::get('prevPage').'">« '.$Language->g('Prev page').'</a></li>';
}
echo '<li class="list">'.(Paginator::get('currentPage')+1).' / '.(Paginator::get('numberOfPages')+1).'</li>';
if(Paginator::get('showOlder')) {
echo '<li class="next"><a href="'.HTML_PATH_ADMIN_ROOT.'manage-posts?page='.Paginator::get('nextPage').'">'.$Language->g('Next page').' »</a></li>';
echo '<li class="last"><a href="'.HTML_PATH_ADMIN_ROOT.'manage-posts?page='.Paginator::get('numberOfPages').'">'.$Language->g('Last page').' »</a></li>';
}
?>
</ul>
</div>

View File

@ -1,39 +1,26 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<?php echo Bootstrap::formOpen(array('id'=>'jsform', 'class'=>'tab-content')); ?>
<div class="align-middle">
<div class="float-right mt-1">
<button type="submit" class="btn btn-primary btn-sm" name="save"><?php $L->p('Save') ?></button>
<a class="btn btn-secondary btn-sm" href="<?php echo HTML_PATH_ADMIN_ROOT.'categories' ?>" role="button"><?php $L->p('Cancel') ?></a>
</div>
<?php echo Bootstrap::pageTitle(array('title'=>$L->g('New category'), 'icon'=>'tag')); ?>
</div>
<?php
echo Bootstrap::formInputHidden(array(
HTML::title(array('title'=>$L->g('New Category'), 'icon'=>'tag'));
HTML::formOpen(array('class'=>'uk-form-horizontal'));
HTML::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF()
'value'=>$Security->getTokenCSRF()
));
echo Bootstrap::formInputText(array(
'name'=>'name',
HTML::formInputText(array(
'name'=>'category',
'label'=>$L->g('Name'),
'value'=>isset($_POST['category'])?$_POST['category']:'',
'class'=>'',
'placeholder'=>'',
'tip'=>''
'value'=>'',
'class'=>'uk-width-1-2 uk-form-medium'
));
echo Bootstrap::formTextarea(array(
'name'=>'description',
'label'=>$L->g('Description'),
'value'=>isset($_POST['description'])?$_POST['description']:'',
'class'=>'',
'placeholder'=>'',
'tip'=>'',
'rows'=>3
));
?>
echo '<div class="uk-form-row">
<div class="uk-form-controls">
<button type="submit" class="uk-button uk-button-primary">'.$L->g('Save').'</button>
<a href="'.HTML_PATH_ADMIN_ROOT.'categories" class="uk-button">'.$L->g('Cancel').'</a>
</div>
</div>';
<?php echo Bootstrap::formClose(); ?>
HTML::formClose();

View File

@ -1,499 +0,0 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<?php
// Start form
echo Bootstrap::formOpen(array(
'id'=>'jsform',
'class'=>'d-flex flex-column h-100'
));
// Token CSRF
echo Bootstrap::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF()
));
// UUID
// The UUID is generated in the controller
echo Bootstrap::formInputHidden(array(
'name'=>'uuid',
'value'=>$uuid
));
// Type = published, draft, sticky, static
echo Bootstrap::formInputHidden(array(
'name'=>'type',
'value'=>'published'
));
// Cover image
echo Bootstrap::formInputHidden(array(
'name'=>'coverImage',
'value'=>''
));
// Content
echo Bootstrap::formInputHidden(array(
'name'=>'content',
'value'=>''
));
?>
<!-- TOOLBAR -->
<div id="jseditorToolbar" class="mb-1">
<div id="jseditorToolbarRight" class="btn-group btn-group-sm float-right" role="group" aria-label="Toolbar right">
<button type="button" class="btn btn-light" id="jsmediaManagerOpenModal" data-toggle="modal" data-target="#jsmediaManagerModal"><span class="fa fa-image"></span> <?php $L->p('Images') ?></button>
<button type="button" class="btn btn-light" id="jsoptionsSidebar" style="z-index:30"><span class="fa fa-cog"></span> <?php $L->p('Options') ?></button>
</div>
<div id="jseditorToolbarLeft">
<button id="jsbuttonSave" type="button" class="btn btn-sm btn-primary" ><?php $L->p('Save') ?></button>
<button id="jsbuttonPreview" type="button" class="btn btn-sm btn-secondary"><?php $L->p('Preview') ?></button>
<span id="jsbuttonSwitch" data-switch="publish" class="ml-2 text-secondary switch-button"><i class="fa fa-square switch-icon-publish"></i> <?php $L->p('Publish') ?></span>
</div>
</div>
<script>
$(document).ready(function() {
$("#jsoptionsSidebar").on("click", function() {
$("#jseditorSidebar").toggle();
$("#jsshadow").toggle();
});
$("#jsshadow").on("click", function() {
$("#jseditorSidebar").toggle();
$("#jsshadow").toggle();
});
});
</script>
<!-- SIDEBAR OPTIONS -->
<div id="jseditorSidebar">
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-link active show" id="nav-general-tab" data-toggle="tab" href="#nav-general" role="tab" aria-controls="general"><?php $L->p('General') ?></a>
<a class="nav-link" id="nav-advanced-tab" data-toggle="tab" href="#nav-advanced" role="tab" aria-controls="advanced"><?php $L->p('Advanced') ?></a>
<?php if (!empty($site->customFields())): ?>
<a class="nav-link" id="nav-custom-tab" data-toggle="tab" href="#nav-custom" role="tab" aria-controls="custom"><?php $L->p('Custom') ?></a>
<?php endif ?>
<a class="nav-link" id="nav-seo-tab" data-toggle="tab" href="#nav-seo" role="tab" aria-controls="seo"><?php $L->p('SEO') ?></a>
</div>
</nav>
<div class="tab-content pr-3 pl-3 pb-3">
<div id="nav-general" class="tab-pane fade show active" role="tabpanel" aria-labelledby="general-tab">
<?php
// Category
echo Bootstrap::formSelectBlock(array(
'name'=>'category',
'label'=>$L->g('Category'),
'selected'=>'',
'class'=>'',
'emptyOption'=>'- '.$L->g('Uncategorized').' -',
'options'=>$categories->getKeyNameArray()
));
// Description
echo Bootstrap::formTextareaBlock(array(
'name'=>'description',
'label'=>$L->g('Description'),
'selected'=>'',
'class'=>'',
'value'=>'',
'rows'=>5,
'placeholder'=>$L->get('this-field-can-help-describe-the-content')
));
?>
<!-- Cover Image -->
<label class="mt-4 mb-2 pb-2 border-bottom text-uppercase w-100"><?php $L->p('Cover Image') ?></label>
<div>
<img id="jscoverImagePreview" class="mx-auto d-block w-100" alt="Cover image preview" src="<?php echo HTML_PATH_CORE_IMG ?>default.svg" />
</div>
<div class="mt-2 text-center">
<button type="button" id="jsbuttonSelectCoverImage" class="btn btn-primary btn-sm"><?php echo $L->g('Select cover image') ?></button>
<button type="button" id="jsbuttonRemoveCoverImage" class="btn btn-secondary btn-sm"><?php echo $L->g('Remove cover image') ?></button>
</div>
<script>
$(document).ready(function() {
$("#jscoverImagePreview").on("click", function() {
openMediaManager();
});
$("#jsbuttonSelectCoverImage").on("click", function() {
openMediaManager();
});
$("#jsbuttonRemoveCoverImage").on("click", function() {
$("#jscoverImage").val('');
$("#jscoverImagePreview").attr('src', HTML_PATH_CORE_IMG+'default.svg');
});
});
</script>
</div>
<div id="nav-advanced" class="tab-pane fade" role="tabpanel" aria-labelledby="advanced-tab">
<?php
// Date
echo Bootstrap::formInputTextBlock(array(
'name'=>'date',
'label'=>$L->g('Date'),
'placeholder'=>'',
'value'=>Date::current(DB_DATE_FORMAT),
'tip'=>$L->g('date-format-format')
));
// Type
echo Bootstrap::formSelectBlock(array(
'name'=>'typeSelector',
'label'=>$L->g('Type'),
'selected'=>'',
'options'=>array(
'published'=>'- '.$L->g('Default').' -',
'sticky'=>$L->g('Sticky'),
'static'=>$L->g('Static')
),
'tip'=>''
));
// Position
echo Bootstrap::formInputTextBlock(array(
'name'=>'position',
'label'=>$L->g('Position'),
'tip'=>$L->g('Field used when ordering content by position'),
'value'=>$pages->nextPositionNumber()
));
// Tags
echo Bootstrap::formInputTextBlock(array(
'name'=>'tags',
'label'=>$L->g('Tags'),
'placeholder'=>'',
'tip'=>$L->g('Write the tags separated by comma')
));
// Parent
echo Bootstrap::formSelectBlock(array(
'name'=>'parent',
'label'=>$L->g('Parent'),
'options'=>array(),
'selected'=>false,
'class'=>'',
'tip'=>$L->g('Start typing a page title to see a list of suggestions.'),
));
?>
<script>
$(document).ready(function() {
var parent = $("#jsparent").select2({
placeholder: "",
allowClear: true,
theme: "bootstrap4",
minimumInputLength: 2,
ajax: {
url: HTML_PATH_ADMIN_ROOT+"ajax/get-published",
data: function (params) {
var query = {
checkIsParent: true,
query: params.term
}
return query;
},
processResults: function (data) {
return data;
}
},
escapeMarkup: function(markup) {
return markup;
},
templateResult: function(data) {
var html = data.text;
if (data.type=="static") {
html += '<span class="badge badge-pill badge-light">'+data.type+'</span>';
}
return html;
}
});
});
</script>
<?php
// Template
echo Bootstrap::formInputTextBlock(array(
'name'=>'template',
'label'=>$L->g('Template'),
'placeholder'=>'',
'value'=>'',
'tip'=>$L->g('Write a template name to filter the page in the theme and change the style of the page.')
));
echo Bootstrap::formInputTextBlock(array(
'name'=>'externalCoverImage',
'label'=>$L->g('External cover image'),
'placeholder'=>"https://",
'value'=>'',
'tip'=>$L->g('Set a cover image from external URL, such as a CDN or some server dedicated for images.')
));
// Username
echo Bootstrap::formInputTextBlock(array(
'name'=>'',
'label'=>$L->g('Author'),
'placeholder'=>'',
'value'=>$login->username(),
'tip'=>'',
'disabled'=>true
));
?>
<script>
$(document).ready(function() {
// Changes in External cover image input
$("#jsexternalCoverImage").change(function() {
$("#jscoverImage").val( $(this).val() );
});
// Generate slug when the user type the title
$("#jstitle").keyup(function() {
var text = $(this).val();
var parent = $("#jsparent").val();
var currentKey = "";
var ajax = new bluditAjax();
var callBack = $("#jsslug");
ajax.generateSlug(text, parent, currentKey, callBack);
});
// Datepicker
$("#jsdate").datetimepicker({format:DB_DATE_FORMAT});
});
</script>
</div>
<?php if (!empty($site->customFields())): ?>
<div id="nav-custom" class="tab-pane fade" role="tabpanel" aria-labelledby="custom-tab">
<?php
$customFields = $site->customFields();
foreach ($customFields as $field=>$options) {
if ( !isset($options['position']) ) {
if ($options['type']=="string") {
echo Bootstrap::formInputTextBlock(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'value'=>(isset($options['default'])?$options['default']:''),
'tip'=>(isset($options['tip'])?$options['tip']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:'')
));
} elseif ($options['type']=="bool") {
echo Bootstrap::formCheckbox(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'checked'=>(isset($options['checked'])?true:false),
'labelForCheckbox'=>(isset($options['tip'])?$options['tip']:'')
));
}
}
}
?>
</div>
<?php endif ?>
<div id="nav-seo" class="tab-pane fade" role="tabpanel" aria-labelledby="seo-tab">
<?php
// Friendly URL
echo Bootstrap::formInputTextBlock(array(
'name'=>'slug',
'tip'=>$L->g('URL associated with the content'),
'label'=>$L->g('Friendly URL'),
'placeholder'=>$L->g('Leave empty for autocomplete by Bludit.')
));
// Robots
echo Bootstrap::formCheckbox(array(
'name'=>'noindex',
'label'=>'Robots',
'labelForCheckbox'=>$L->g('apply-code-noindex-code-to-this-page'),
'placeholder'=>'',
'checked'=>false,
'tip'=>$L->g('This tells search engines not to show this page in their search results.')
));
// Robots
echo Bootstrap::formCheckbox(array(
'name'=>'nofollow',
'label'=>'',
'labelForCheckbox'=>$L->g('apply-code-nofollow-code-to-this-page'),
'placeholder'=>'',
'checked'=>false,
'tip'=>$L->g('This tells search engines not to follow links on this page.')
));
// Robots
echo Bootstrap::formCheckbox(array(
'name'=>'noarchive',
'label'=>'',
'labelForCheckbox'=>$L->g('apply-code-noarchive-code-to-this-page'),
'placeholder'=>'',
'checked'=>false,
'tip'=>$L->g('This tells search engines not to save a cached copy of this page.')
));
?>
</div>
</div>
</div>
<!-- Custom fields: TOP -->
<?php
$customFields = $site->customFields();
foreach ($customFields as $field=>$options) {
if ( isset($options['position']) && ($options['position']=='top') ) {
if ($options['type']=="string") {
echo Bootstrap::formInputTextBlock(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'value'=>(isset($options['default'])?$options['default']:''),
'tip'=>(isset($options['tip'])?$options['tip']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'class'=>'mb-2',
'labelClass'=>'mb-2 pb-2 border-bottom text-uppercase w-100'
));
} elseif ($options['type']=="bool") {
echo Bootstrap::formCheckbox(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'checked'=>(isset($options['checked'])?true:false),
'labelForCheckbox'=>(isset($options['tip'])?$options['tip']:''),
'class'=>'mb-2',
'labelClass'=>'mb-2 pb-2 border-bottom text-uppercase w-100'
));
}
}
}
?>
<!-- Title -->
<div id="jseditorTitle" class="form-group mb-1">
<input id="jstitle" name="title" type="text" class="form-control form-control-lg rounded-0" value="" placeholder="<?php $L->p('Enter title') ?>">
</div>
<!-- Editor -->
<textarea id="jseditor" class="editable h-100 mb-1"></textarea>
<!-- Custom fields: BOTTOM -->
<?php
$customFields = $site->customFields();
foreach ($customFields as $field=>$options) {
if ( isset($options['position']) && ($options['position']=='bottom') ) {
if ($options['type']=="string") {
echo Bootstrap::formInputTextBlock(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'value'=>(isset($options['default'])?$options['default']:''),
'tip'=>(isset($options['tip'])?$options['tip']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'class'=>'mt-2',
'labelClass'=>'mb-2 pb-2 border-bottom text-uppercase w-100'
));
} elseif ($options['type']=="bool") {
echo Bootstrap::formCheckbox(array(
'name'=>'custom['.$field.']',
'label'=>(isset($options['label'])?$options['label']:''),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
'checked'=>(isset($options['checked'])?true:false),
'labelForCheckbox'=>(isset($options['tip'])?$options['tip']:''),
'class'=>'mt-2',
'labelClass'=>'mb-2 pb-2 border-bottom text-uppercase w-100'
));
}
}
}
?>
</form>
<!-- Modal for Media Manager -->
<?php include(PATH_ADMIN_THEMES.'booty/html/media.php'); ?>
<script>
$(document).ready(function() {
// Define function if they doesn't exist
// This helps if the user doesn't activate any plugin as editor
if (typeof editorGetContent != "function") {
window.editorGetContent = function(){
return $("#jseditor").val();
};
}
if (typeof editorInsertMedia != "function") {
window.editorInsertMedia = function(filename){
$("#jseditor").val($('#jseditor').val()+'<img src="'+filename+'" alt="">');
};
}
// Button switch
$("#jsbuttonSwitch").on("click", function() {
if ($(this).data("switch")=="publish") {
$(this).html('<i class="fa fa-square switch-icon-draft"></i> <?php $L->p('Draft') ?>');
$(this).data("switch", "draft");
} else {
$(this).html('<i class="fa fa-square switch-icon-publish"></i> <?php $L->p('Publish') ?>');
$(this).data("switch", "publish");
}
});
// Button preview
$("#jsbuttonPreview").on("click", function() {
var uuid = $("#jsuuid").val();
var title = $("#jstitle").val();
var content = editorGetContent();
bluditAjax.saveAsDraft(uuid, title, content).then(function(data) {
var preview = window.open("<?php echo DOMAIN_PAGES.'autosave-'.$uuid.'?preview='.md5('autosave-'.$uuid) ?>", "bludit-preview");
preview.focus();
});
});
// Button Save
$("#jsbuttonSave").on("click", function() {
// If the switch is setted to "published", get the value from the selector
if ($("#jsbuttonSwitch").data("switch")=="publish") {
var value = $("#jstypeSelector option:selected").val();
$("#jstype").val(value);
} else {
$("#jstype").val("draft");
}
// Get the content
$("#jscontent").val( editorGetContent() );
// Submit the form
$("#jsform").submit();
});
// Autosave
var currentContent = editorGetContent();
setInterval(function() {
var uuid = $("#jsuuid").val();
var title = $("#jstitle").val() + "[<?php $L->p('Autosave') ?>]";
var content = editorGetContent();
// Autosave when content has at least 100 characters
if (content.length<100) {
return false;
}
// Autosave only when the user change the content
if (currentContent!=content) {
currentContent = content;
bluditAjax.saveAsDraft(uuid, title, content).then(function(data) {
if (data.status==0) {
showAlert("<?php $L->p('Autosave') ?>");
}
});
}
},1000*60*AUTOSAVE_INTERVAL);
});
</script>

View File

@ -0,0 +1,222 @@
<?php
HTML::title(array('title'=>$L->g('New page'), 'icon'=>'file-text-o'));
HTML::formOpen(array('class'=>'uk-form-stacked'));
// Security token
HTML::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$Security->getTokenCSRF()
));
// LEFT SIDE
// --------------------------------------------------------------------
echo '<div class="uk-grid uk-grid-medium">';
echo '<div class="bl-publish-view uk-width-8-10">';
// Title input
HTML::formInputText(array(
'name'=>'title',
'value'=>'',
'class'=>'uk-width-1-1 uk-form-large',
'placeholder'=>$L->g('Title')
));
// Content input
HTML::formTextarea(array(
'name'=>'content',
'value'=>'',
'class'=>'uk-width-1-1 uk-form-large',
'placeholder'=>''
));
// Form buttons
echo '<div class="uk-form-row uk-margin-bottom">
<button class="uk-button uk-button-primary" type="submit">'.$L->g('Save').'</button>
<button class="uk-button uk-button-primary" type="button" id="jsSaveDraft">'.$L->g('Save as draft').'</button>
<a class="uk-button" href="'.HTML_PATH_ADMIN_ROOT.'manage-posts">'.$L->g('Cancel').'</a>
</div>';
echo '</div>';
// RIGHT SIDE
// --------------------------------------------------------------------
echo '<div class="bl-publish-sidebar uk-width-2-10">';
echo '<ul>';
// GENERAL TAB
// --------------------------------------------------------------------
echo '<li><h2 class="sidebar-button" data-view="sidebar-general-view"><i class="uk-icon-angle-down"></i> '.$L->g('General').'</h2></li>';
echo '<li id="sidebar-general-view" class="sidebar-view">';
// Category
/*
HTML::formSelect(array(
'name'=>'category',
'label'=>$L->g('Category'),
'class'=>'uk-width-1-1 uk-form-medium',
'options'=>$dbCategories->getAll(),
'selected'=>'',
'tip'=>'',
'addEmptySpace'=>true
));*/
// Description input
HTML::formTextarea(array(
'name'=>'description',
'label'=>$L->g('description'),
'value'=>'',
'rows'=>'4',
'class'=>'uk-width-1-1 uk-form-medium',
'tip'=>$L->g('this-field-can-help-describe-the-content')
));
echo '</li>';
// IMAGES TAB
// --------------------------------------------------------------------
echo '<li><h2 class="sidebar-button" data-view="sidebar-images-view"><i class="uk-icon-angle-down"></i> '.$L->g('Images').'</h2></li>';
echo '<li id="sidebar-images-view" class="sidebar-view">';
// --- BLUDIT COVER IMAGE ---
HTML::bluditCoverImage();
// --- BLUDIT QUICK IMAGES ---
HTML::bluditQuickImages();
// --- BLUDIT IMAGES V8 ---
HTML::bluditImagesV8();
// --- BLUDIT MENU V8 ---
HTML::bluditMenuV8();
echo '</li>';
// TAGS
// --------------------------------------------------------------------
echo '<li><h2 class="sidebar-button" data-view="sidebar-tags-view"><i class="uk-icon-angle-down"></i> '.$L->g('Tags').'</h2></li>';
echo '<li id="sidebar-tags-view" class="sidebar-view">';
// Tags input
HTML::tags(array(
'name'=>'tags',
'label'=>'',
'allTags'=>$dbTags->getAll(),
'selectedTags'=>array()
));
echo '</li>';
// ADVANCED TAB
// --------------------------------------------------------------------
echo '<li><h2 class="sidebar-button" data-view="sidebar-advanced-view"><i class="uk-icon-angle-down"></i> '.$L->g('Advanced').'</h2></li>';
echo '<li id="sidebar-advanced-view" class="sidebar-view">';
// Status input
HTML::formSelect(array(
'name'=>'status',
'label'=>$L->g('Status'),
'class'=>'uk-width-1-1 uk-form-medium',
'options'=>array('published'=>$L->g('Published'), 'draft'=>$L->g('Draft')),
'selected'=>'published',
'tip'=>''
));
// Parent input
$options = array();
$options[NO_PARENT_CHAR] = '('.$Language->g('No parent').')';
$options += $dbPages->parentKeyList();
HTML::formSelect(array(
'name'=>'parent',
'label'=>$L->g('Parent'),
'class'=>'uk-width-1-1 uk-form-medium',
'options'=>$options,
'selected'=>NO_PARENT_CHAR,
'tip'=>''
));
// Position input
HTML::formInputText(array(
'name'=>'position',
'value'=>'1',
'class'=>'uk-width-1-1 uk-form-large',
'label'=>$L->g('Position')
));
// Slug input
HTML::formInputText(array(
'name'=>'slug',
'value'=>'',
'class'=>'uk-width-1-1 uk-form-large',
'tip'=>$L->g('you-can-modify-the-url-which-identifies'),
'label'=>$L->g('Friendly URL')
));
echo '</li>';
echo '<ul>';
echo '</div>';
echo '</div>';
HTML::formClose();
?>
<script>
$(document).ready(function()
{
$("#jsslug").keyup(function() {
var text = $(this).val();
var parent = $("#jsparent").val();
checkSlugPage(text, parent, "", $("#jsslug"));
});
$("#jstitle").keyup(function() {
var text = $(this).val();
var parent = $("#jsparent").val();
checkSlugPage(text, parent, "", $("#jsslug"));
});
$("#jsparent").change(function() {
var parent = $(this).val();
var text = $("#jsslug").val();
if(parent==NO_PARENT_CHAR) {
$("#jsparentExample").text("");
}
else {
$("#jsparentExample").text(parent+"/");
}
checkSlugPage(text, parent, "", $("#jsslug"));
});
// Button Save as draft
$("#jsSaveDraft").on("click", function() {
$("#jsstatus").val("draft");
$(".uk-form").submit();
});
// Right sidebar
$(".sidebar-button").click(function() {
var view = "#" + $(this).data("view");
if( $(view).is(":visible") ) {
$(view).hide();
}
else {
$(".sidebar-view").hide();
$(view).show();
}
});
});
</script>

View File

@ -0,0 +1,191 @@
<?php
HTML::title(array('title'=>$L->g('New post'), 'icon'=>'pencil'));
HTML::formOpen(array('class'=>'uk-form-stacked'));
// Security token
HTML::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$Security->getTokenCSRF()
));
// LEFT SIDE
// --------------------------------------------------------------------
echo '<div class="uk-grid uk-grid-medium">';
echo '<div class="bl-publish-view uk-width-8-10">';
// Title input
HTML::formInputText(array(
'name'=>'title',
'value'=>'',
'class'=>'uk-width-1-1 uk-form-large',
'placeholder'=>$L->g('Title')
));
// Content input
HTML::formTextarea(array(
'name'=>'content',
'value'=>'',
'class'=>'uk-width-1-1 uk-form-large',
'placeholder'=>''
));
// Form buttons
echo '<div class="uk-form-row uk-margin-bottom">
<button class="uk-button uk-button-primary" type="submit">'.$L->g('Save').'</button>
<button class="uk-button uk-button-primary" type="button" id="jsSaveDraft">'.$L->g('Save as draft').'</button>
<a class="uk-button" href="'.HTML_PATH_ADMIN_ROOT.'manage-posts">'.$L->g('Cancel').'</a>
</div>';
echo '</div>';
// RIGHT SIDE
// --------------------------------------------------------------------
echo '<div class="bl-publish-sidebar uk-width-2-10">';
echo '<ul>';
// GENERAL TAB
// --------------------------------------------------------------------
echo '<li><h2 class="sidebar-button" data-view="sidebar-general-view"><i class="uk-icon-angle-down"></i> '.$L->g('General').'</h2></li>';
echo '<li id="sidebar-general-view" class="sidebar-view">';
/*
HTML::formSelect(array(
'name'=>'category',
'label'=>$L->g('Category'),
'class'=>'uk-width-1-1 uk-form-medium',
'options'=>$dbCategories->getAll(),
'selected'=>'',
'tip'=>'',
'addEmptySpace'=>true
));*/
// Description input
HTML::formTextarea(array(
'name'=>'description',
'label'=>$L->g('description'),
'value'=>'',
'rows'=>'4',
'class'=>'uk-width-1-1 uk-form-medium',
'tip'=>$L->g('this-field-can-help-describe-the-content')
));
echo '</li>';
// IMAGES TAB
// --------------------------------------------------------------------
echo '<li><h2 class="sidebar-button" data-view="sidebar-images-view"><i class="uk-icon-angle-down"></i> '.$L->g('Images').'</h2></li>';
echo '<li id="sidebar-images-view" class="sidebar-view">';
// --- BLUDIT COVER IMAGE ---
HTML::bluditCoverImage();
// --- BLUDIT QUICK IMAGES ---
HTML::bluditQuickImages();
// --- BLUDIT IMAGES V8 ---
HTML::bluditImagesV8();
// --- BLUDIT MENU V8 ---
HTML::bluditMenuV8();
echo '</li>';
// TAGS
// --------------------------------------------------------------------
echo '<li><h2 class="sidebar-button" data-view="sidebar-tags-view"><i class="uk-icon-angle-down"></i> '.$L->g('Tags').'</h2></li>';
echo '<li id="sidebar-tags-view" class="sidebar-view">';
// Tags input
HTML::tags(array(
'name'=>'tags',
'label'=>'',
'allTags'=>$dbTags->getAll(),
'selectedTags'=>array()
));
echo '</li>';
// ADVANCED TAB
// --------------------------------------------------------------------
echo '<li><h2 class="sidebar-button" data-view="sidebar-advanced-view"><i class="uk-icon-angle-down"></i> '.$L->g('Advanced').'</h2></li>';
echo '<li id="sidebar-advanced-view" class="sidebar-view">';
// Status input
HTML::formSelect(array(
'name'=>'status',
'label'=>$L->g('Status'),
'class'=>'uk-width-1-1 uk-form-medium',
'options'=>array('published'=>$L->g('Published'), 'draft'=>$L->g('Draft')),
'selected'=>'published',
'tip'=>''
));
// Date input
HTML::formInputText(array(
'name'=>'date',
'value'=>Date::current(DB_DATE_FORMAT),
'class'=>'uk-width-1-1 uk-form-large',
'tip'=>$L->g('To schedule the post just select the date and time'),
'label'=>$L->g('Date')
));
// Slug input
HTML::formInputText(array(
'name'=>'slug',
'value'=>'',
'class'=>'uk-width-1-1 uk-form-large',
'tip'=>$L->g('you-can-modify-the-url-which-identifies'),
'label'=>$L->g('Friendly URL')
));
echo '</li>';
echo '</ul>';
echo '</div>';
echo '</div>';
HTML::formClose();
?>
<script>
$(document).ready(function() {
$("#jsdate").datetimepicker({format:"<?php echo DB_DATE_FORMAT ?>"});
$("#jstitle").keyup(function() {
var slug = $(this).val();
checkSlugPost(slug, "", $("#jsslug"));
});
$("#jsslug").keyup(function() {
var slug = $("#jsslug").val();
checkSlugPost(slug, "", $("#jsslug"));
});
// Button Save as draft
$("#jsSaveDraft").on("click", function() {
$("#jsstatus").val("draft");
$(".uk-form").submit();
});
// Right sidebar
$(".sidebar-button").click(function() {
var view = "#" + $(this).data("view");
if( $(view).is(":visible") ) {
$(view).hide();
}
else {
$(".sidebar-view").hide();
$(view).show();
}
});
});
</script>

View File

@ -1,67 +0,0 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<?php echo Bootstrap::formOpen(array('id'=>'jsform', 'class'=>'tab-content')); ?>
<div class="align-middle">
<div class="float-right mt-1">
<button type="submit" class="btn btn-primary btn-sm" name="save"><?php $L->p('Save') ?></button>
<a class="btn btn-secondary btn-sm" href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>" role="button"><?php $L->p('Cancel') ?></a>
</div>
<?php echo Bootstrap::pageTitle(array('title'=>$L->g('Add a new user'), 'icon'=>'user')); ?>
</div>
<?php
echo Bootstrap::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF()
));
echo Bootstrap::formInputText(array(
'name'=>'new_username',
'label'=>$L->g('Username'),
'value'=>(isset($_POST['new_username'])?$_POST['new_username']:''),
'class'=>'',
'placeholder'=>'',
'tip'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'new_password',
'type'=>'password',
'label'=>$L->g('Password'),
'value'=>'',
'class'=>'',
'placeholder'=>'',
'tip'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'confirm_password',
'type'=>'password',
'label'=>$L->g('Confirm Password'),
'value'=>'',
'class'=>'',
'placeholder'=>'',
'tip'=>''
));
echo Bootstrap::formSelect(array(
'name'=>'role',
'label'=>$L->g('Role'),
'options'=>array('author'=>$L->g('Author'), 'editor'=>$L->g('Editor'), 'admin'=>$L->g('Administrator')),
'selected'=>'Author',
'class'=>'',
'tip'=>$L->g('author-can-write-and-edit-their-own-content')
));
echo Bootstrap::formInputText(array(
'name'=>'email',
'label'=>$L->g('Email'),
'value'=>(isset($_POST['email'])?$_POST['email']:''),
'class'=>'',
'placeholder'=>'',
'tip'=>''
));
?>
<?php echo Bootstrap::formClose(); ?>

View File

@ -1,51 +0,0 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<?php echo Bootstrap::formOpen(array('id'=>'jsform', 'class'=>'tab-content')); ?>
<div class="align-middle">
<div class="float-right mt-1">
<button type="button" class="btn btn-primary btn-sm jsbuttonSave" name="save"><?php $L->p('Save') ?></button>
<a class="btn btn-secondary btn-sm" href="<?php echo HTML_PATH_ADMIN_ROOT.'plugins' ?>" role="button"><?php $L->p('Cancel') ?></a>
</div>
<?php echo Bootstrap::pageTitle(array('title'=>$L->g('Plugins position'), 'icon'=>'tags')); ?>
</div>
<div class="alert alert-primary"><?php $L->p('Drag and Drop to sort the plugins') ?></div>
<?php
// Token CSRF
echo Bootstrap::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF()
));
echo Bootstrap::formInputHidden(array(
'name'=>'plugin-list',
'value'=>''
));
echo '<ul class="list-group list-group-sortable">';
foreach ($plugins['siteSidebar'] as $Plugin) {
echo '<li class="list-group-item" data-plugin="'.$Plugin->className().'"><span class="fa fa-arrows-v"></span> '.$Plugin->name().'</li>';
}
echo '</ul>';
?>
<?php echo Bootstrap::formClose(); ?>
<script>
$(document).ready(function() {
$('.list-group-sortable').sortable({
placeholderClass: 'list-group-item'
});
$(".jsbuttonSave").on("click", function() {
var tmp = [];
$("li.list-group-item").each(function() {
tmp.push( $(this).attr("data-plugin") );
});
$("#jsplugin-list").attr("value", tmp.join(",") );
$("#jsform").submit();
});
});
</script>

View File

@ -1,114 +1,61 @@
<?php
echo Bootstrap::pageTitle(array('title'=>$L->g('Plugins'), 'icon'=>'puzzle-piece'));
echo Bootstrap::link(array(
'title'=>$L->g('Change the position of the plugins'),
'href'=>HTML_PATH_ADMIN_ROOT.'plugins-position',
'icon'=>'arrows'
));
echo Bootstrap::formTitle(array('title'=>$L->g('Search plugins')));
?>
<input type="text" class="form-control" id="search" placeholder="<?php $L->p('Search') ?>">
<script>
$(document).ready(function() {
$("#search").on("keyup", function() {
var textToSearch = $(this).val().toLowerCase();
$(".searchItem").each( function() {
var item = $(this);
item.hide();
item.find(".searchText").each( function() {
var element = $(this).text().toLowerCase();
if (element.indexOf(textToSearch)!=-1) {
item.show();
}
});
});
});
});
</script>
<?php
echo Bootstrap::formTitle(array('title'=>$L->g('Enabled plugins')));
HTML::title(array('title'=>$L->g('Plugins'), 'icon'=>'puzzle-piece'));
echo '
<table class="table">
<tbody>
<table class="uk-table">
<thead>
<tr>
<th class="uk-width-1-5">'.$L->g('Name').'</th>
<th class="uk-width-3-5">'.$L->g('Description').'</th>
<th class="uk-text-center">'.$L->g('Version').'</th>
<th class="uk-text-center">'.$L->g('Author').'</th>
</tr>
</thead>
<tbody>
';
// Show installed plugins
foreach ($pluginsInstalled as $plugin) {
echo '<tr id="'.$plugin->className().'" class="bg-light searchItem">';
foreach($plugins['all'] as $Plugin)
{
echo '
<tr '.($Plugin->installed()?'class="plugin-installed"':'class="plugin-notInstalled"').'>
<td>
<div class="plugin-name">
';
echo '<td class="align-middle pt-3 pb-3 w-25">
<div class="searchText">'.$plugin->name().'</div>
<div class="mt-1">';
if (method_exists($plugin, 'form')) {
echo '<a class="mr-3" href="'.HTML_PATH_ADMIN_ROOT.'configure-plugin/'.$plugin->className().'">'.$L->g('Settings').'</a>';
}
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'uninstall-plugin/'.$plugin->className().'">'.$L->g('Deactivate').'</a>';
echo '</div>';
echo '</td>';
if($Plugin->installed()) {
echo '<a class="uninstall" href="'.HTML_PATH_ADMIN_ROOT.'uninstall-plugin/'.$Plugin->className().'" title="'.$L->g('Deactivate').'"><i class="uk-icon-check-square-o"></i></a> ';
if(method_exists($Plugin, 'form')) {
echo '<a class="configure" href="'.HTML_PATH_ADMIN_ROOT.'configure-plugin/'.$Plugin->className().'" title="'.$L->g('Settings').'"><i class="uk-icon-cog settings-icon"></i></a> ';
}
}
else {
echo '<a class="install" href="'.HTML_PATH_ADMIN_ROOT.'install-plugin/'.$Plugin->className().'" title="'.$L->g('Activate').'"><i class="uk-icon-square-o"></i></a> ';
}
echo '<td class="searchText align-middle d-none d-sm-table-cell">';
echo $plugin->description();
echo '</td>';
echo '<td class="text-center align-middle d-none d-lg-table-cell">';
echo '<span>'.$plugin->version().'</span>';
echo '</td>';
echo '<td class="text-center align-middle d-none d-lg-table-cell">
<a target="_blank" href="'.$plugin->website().'">'.$plugin->author().'</a>
echo '
'.$Plugin->name().'</div>
</td>';
echo '<td>';
echo $Plugin->description();
echo '</td>';
echo '
<td class="uk-text-center">';
if( !$Plugin->isCompatible() ) {
echo '<i class="uk-icon-exclamation-triangle incompatible-warning" title="'.$L->g('This plugin may not be supported by this version of Bludit').'"></i>';
}
echo '<span>'.$Plugin->version().'</span></td>';
echo '
<td class="uk-text-center"><a target="_blank" href="'.$Plugin->website().'">'.$Plugin->author().'</a></td>
';
echo '</tr>';
}
echo '
</tbody>
</table>
';
echo Bootstrap::formTitle(array('title'=>$L->g('Disabled plugins')));
echo '
<table class="table">
<tbody>
';
// Plugins not installed
$pluginsNotInstalled = array_diff_key($plugins['all'], $pluginsInstalled);
foreach ($pluginsNotInstalled as $plugin) {
echo '<tr id="'.$plugin->className().'" class="searchItem">';
echo '<td class="align-middle pt-3 pb-3 w-25">
<div class="searchText">'.$plugin->name().'</div>
<div class="mt-1">
<a href="'.HTML_PATH_ADMIN_ROOT.'install-plugin/'.$plugin->className().'">'.$L->g('Activate').'</a>
</div>
</td>';
echo '<td class="searchText align-middle d-none d-sm-table-cell">';
echo $plugin->description();
echo '</td>';
echo '<td class="text-center align-middle d-none d-lg-table-cell">';
echo '<span>'.$plugin->version().'</span>';
echo '</td>';
echo '<td class="text-center align-middle d-none d-lg-table-cell">
<a target="_blank" href="'.$plugin->website().'">'.$plugin->author().'</a>
</td>';
echo '</tr>';
}
echo '
</tbody>
</tbody>
</table>
';

View File

@ -0,0 +1,99 @@
<?php
HTML::title(array('title'=>$L->g('Advanced settings'), 'icon'=>'cogs'));
HTML::formOpen(array('class'=>'uk-form-horizontal'));
HTML::formInputHidden(array(
'name'=>'tokenCSRF',
'value'=>$Security->getTokenCSRF()
));
HTML::legend(array('value'=>$L->g('General'), 'class'=>'first-child'));
HTML::formSelect(array(
'name'=>'postsperpage',
'label'=>$L->g('Posts per page'),
'options'=>array('1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5','6'=>'6','7'=>'7','8'=>'8'),
'selected'=>$Site->postsPerPage(),
'class'=>'uk-width-1-3 uk-form-medium',
'tip'=>$L->g('number-of-posts-to-show-per-page')
));
HTML::formSelect(array(
'name'=>'homepage',
'label'=>$L->g('Default home page'),
'options'=>$_homePageList,
'selected'=>$Site->homepage(),
'class'=>'uk-width-1-3 uk-form-medium',
'tip'=>''
));
HTML::formInputText(array(
'name'=>'url',
'label'=>$L->g('Site URL'),
'value'=>$Site->url(),
'class'=>'uk-width-1-2 uk-form-medium',
'tip'=>$L->g('the-url-of-your-site')
));
HTML::legend(array('value'=>$L->g('Email account settings')));
HTML::formInputText(array(
'name'=>'emailFrom',
'label'=>$L->g('Sender email'),
'value'=>$Site->emailFrom(),
'class'=>'uk-width-1-2 uk-form-medium',
'tip'=>$L->g('Emails will be sent from this address')
));
HTML::legend(array('value'=>$L->g('URL Filters')));
HTML::formInputText(array(
'name'=>'uriPost',
'label'=>$L->g('Posts'),
'value'=>$Site->uriFilters('post'),
'class'=>'uk-width-1-2 uk-form-medium',
'tip'=>''
));
HTML::formInputText(array(
'name'=>'uriPage',
'label'=>$L->g('Pages'),
'value'=>$Site->uriFilters('page'),
'class'=>'uk-width-1-2 uk-form-medium',
'tip'=>''
));
HTML::formInputText(array(
'name'=>'uriTag',
'label'=>$L->g('Tags'),
'value'=>$Site->uriFilters('tag'),
'class'=>'uk-width-1-2 uk-form-medium',
'tip'=>''
));
HTML::formInputText(array(
'name'=>'uriBlog',
'label'=>$L->g('Blog'),
'value'=>$Site->uriFilters('blog'),
'class'=>'uk-width-1-2 uk-form-medium',
'tip'=>''
));
/*
HTML::formInputText(array(
'name'=>'uriCategory',
'label'=>$L->g('Category'),
'value'=>$Site->uriFilters('category'),
'class'=>'uk-width-1-2 uk-form-medium',
'tip'=>''
));
*/
echo '<div class="uk-form-row">
<div class="uk-form-controls">
<button type="submit" class="uk-button uk-button-primary">'.$L->g('Save').'</button>
</div>
</div>';
HTML::formClose();

Some files were not shown because too many files have changed in this diff Show More