Compare commits

..

No commits in common. "master" and "v3.0.0-alpha-5" have entirely different histories.

615 changed files with 12935 additions and 24557 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`.

23
.gitignore vendored
View File

@ -1,30 +1,9 @@
.DS_Store .DS_Store
dbgenerator.php
bl-content/* bl-content/*
bl-content-migrator
bl-plugins/timemachine bl-plugins/timemachine
bl-plugins/timemachine-x bl-plugins/timemachine-x
bl-plugins/remote-content
bl-plugins/discovery 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/bludit.pro.php
bl-kernel/admin/themes/gris
bl-themes/docs bl-themes/docs
bl-themes/typerite
bl-themes/docsx 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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
[Bludit](https://www.bludit.com/) [Bludit](https://www.bludit.com/)
================================ ================================
**Simple**, **Fast** and **Flexible** CMS. **Simple**, **Fast** and **Flexible** 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 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.
@ -13,20 +13,22 @@ Bludit supports **Markdown** and **HTML code** for the content.
- [Documentation](https://docs.bludit.com) - [Documentation](https://docs.bludit.com)
- Help and Support [Forum](https://forum.bludit.org) and [Chat](https://gitter.im/bludit/support) - Help and Support [Forum](https://forum.bludit.org) and [Chat](https://gitter.im/bludit/support)
Follow Bludit [![Bludit PRO](https://img.shields.io/badge/Bludit-PRO-blue.svg)](https://pro.bludit.com/)
Social Networks
--------------- ---------------
- [Blog](https://blog.bludit.com)
- [Twitter](https://twitter.com/bludit) - [Twitter](https://twitter.com/bludit)
- [Facebook](https://www.facebook.com/bluditcms) - [Facebook](https://www.facebook.com/bluditcms)
- [Youtube](https://www.youtube.com/c/Bluditcms) - [Google+](https://plus.google.com/+Bluditcms)
- [Youtube](https://www.youtube.com/channel/UCuLu0Z_CHBsTiYTDz129x9Q?view_as=subscriber)
Requirements Requirements
------------ ------------
You just need a web server with PHP support. 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 [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 [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 [dom](http://php.net/manual/en/book.dom.php) module for DOM manipulation.
@ -46,24 +48,23 @@ Installation Guide
Docker Image Docker Image
------------ ------------
Official Docker image on Docker Hub. Bludit provides an official Docker image.
- https://hub.docker.com/r/bludit/docker/ - https://hub.docker.com/r/bludit/docker/
Also we provide Kubernetes deployments yaml files. Backers
- 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. Become a **Backer** and support Bludit with a monthly contribution to help us continue development.
- [Become a Backer](https://www.patreon.com/bePatron?c=921115&rid=2458859)
[![Bludit PRO](https://img.shields.io/badge/Bludit-PRO-blue.svg)](https://pro.bludit.com/) Sponsors
--------
### Golden sponsors in Patreon! Become a **Sponsor** and support Bludit with a monthly contribution to help us continue development.
- [Become a Sponsor](https://www.patreon.com/bePatron?c=921115&rid=2458860)
- <a href="https://www.patreon.com/clickwork" target="_blank">Clickwork</a> - <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=10331784" target="_blank">KreativMind</a>
- <a href="https://www.patreon.com/pinguinsreisende" 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=12261033" target="_blank">Jan Rippl</a>
- <a href="https://www.patreon.com/user/creators?u=28428918" target="_blank">Curious Activity</a>
License License
------- -------

View File

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

View File

@ -7,13 +7,11 @@ Database structure
"videos": { "videos": {
"name": "Videos", "name": "Videos",
"template: "", "template: "",
"description: "",
"list": [ "my-page", "second-page" ] "list": [ "my-page", "second-page" ]
}, },
"pets": { "pets": {
"name": "Pets", "name": "Pets",
"template: "", "template: "",
"description: "",
"list": [ "cats-and-dogs" ] "list": [ "cats-and-dogs" ]
} }
} }
@ -28,13 +26,8 @@ class dbList extends dbJSON
parent::__construct($file); parent::__construct($file);
} }
public function keys()
{
return array_keys($this->db);
}
// Returns the list of keys filter by pageNumber // Returns the list of keys filter by pageNumber
public function getList($key, $pageNumber, $numberOfItems) public function getList($key, $pageNumber, $amountOfItems)
{ {
if (!isset($this->db[$key])) { if (!isset($this->db[$key])) {
Log::set(__METHOD__.LOG_SEP.'Error key does not exist '.$key); Log::set(__METHOD__.LOG_SEP.'Error key does not exist '.$key);
@ -45,13 +38,15 @@ class dbList extends dbJSON
$list = $this->db[$key]['list']; $list = $this->db[$key]['list'];
// Returns all the items from the list // Returns all the items from the list
if ($numberOfItems==-1) { if ($amountOfItems==-1) {
// Invert keys to values, is necesary returns as key the key pages
$list = array_flip($list);
return $list; return $list;
} }
// The first page number is 1, so the real is 0 // The first page number is 1, so the real is 0
$realPageNumber = $pageNumber - 1; $realPageNumber = $pageNumber - 1;
$chunks = array_chunk($list, $numberOfItems); $chunks = array_chunk($list, $realPageNumber);
if (isset($chunks[$realPageNumber])) { if (isset($chunks[$realPageNumber])) {
return $chunks[$realPageNumber]; return $chunks[$realPageNumber];
} }
@ -62,12 +57,7 @@ class dbList extends dbJSON
public function generateKey($name) public function generateKey($name)
{ {
global $L;
$key = Text::cleanUrl($name); $key = Text::cleanUrl($name);
if (Text::isEmpty($key)) {
$key = $L->g('empty');
}
while (isset($this->db[$key])) { while (isset($this->db[$key])) {
$key++; $key++;
} }
@ -75,14 +65,13 @@ class dbList extends dbJSON
} }
// Add a new item to the dblist // Add a new item to the dblist
// $args => 'name', 'template', 'description', list' // $args => 'name', 'template', 'list'
public function add($args) public function add($args)
{ {
$key = $this->generateKey($args['name']); $key = $this->generateKey($args['name']);
$this->db[$key]['name'] = Sanitize::removeTags($args['name']); $this->db[$key]['name'] = $args['name'];
$this->db[$key]['template'] = isset($args['template'])?Sanitize::removeTags($args['template']):''; $this->db[$key]['template'] = isset($args['template'])?$args['template']:'';
$this->db[$key]['description'] = isset($args['description'])?Sanitize::removeTags($args['description']):'';
$this->db[$key]['list'] = isset($args['list'])?$args['list']:array(); $this->db[$key]['list'] = isset($args['list'])?$args['list']:array();
$this->sortAlphanumeric(); $this->sortAlphanumeric();
@ -102,7 +91,7 @@ class dbList extends dbJSON
} }
// Edit an item to the dblist // Edit an item to the dblist
// $args => 'name', 'oldkey', 'newKey', 'template', 'description' // $args => 'name', 'oldkey', 'newKey', 'template'
public function edit($args) public function edit($args)
{ {
if ( isset($this->db[$args['newKey']]) && ($args['newKey']!==$args['oldKey']) ) { if ( isset($this->db[$args['newKey']]) && ($args['newKey']!==$args['oldKey']) ) {
@ -110,9 +99,8 @@ class dbList extends dbJSON
return false; return false;
} }
$this->db[$args['newKey']]['name'] = Sanitize::removeTags($args['name']); $this->db[$args['newKey']]['name'] = $args['name'];
$this->db[$args['newKey']]['template'] = isset($args['template'])?Sanitize::removeTags($args['template']):''; $this->db[$args['newKey']]['template'] = isset($args['template'])?$args['template']:'';
$this->db[$args['newKey']]['description'] = isset($args['description'])?Sanitize::removeTags($args['description']):'';
$this->db[$args['newKey']]['list'] = $this->db[$args['oldKey']]['list']; $this->db[$args['newKey']]['list'] = $this->db[$args['oldKey']]['list'];
// Remove the old category // Remove the old category
@ -126,7 +114,7 @@ class dbList extends dbJSON
} }
// Sort the categories by "Natural order" // Sort the categories by "Natural order"
public function sortAlphanumeric() private function sortAlphanumeric()
{ {
// Sort key alphanumeric strings, a01, a10, b10, c02 // Sort key alphanumeric strings, a01, a10, b10, c02
return ksort($this->db); return ksort($this->db);
@ -151,10 +139,10 @@ class dbList extends dbJSON
return $tmp; return $tmp;
} }
// Returns the number of items in the list // Returns the amount of items for some key
public function countItems($key) public function countItems($key)
{ {
if (isset($this->db[$key])) { if( isset($this->db[$key]) ) {
return count($this->db[$key]['list']); return count($this->db[$key]['list']);
} }
return 0; return 0;
@ -176,7 +164,7 @@ class dbList extends dbJSON
} }
// Returns an array with a portion of the database filtered by key // Returns an array with a portion of the database filtered by key
// Returns array( 'key'=>'', 'name'=>'', 'template'=>'', 'description'=>'', list'=>array() ) // Returns array( 'key'=>'', 'name'=>'', 'template'=>'', 'list'=>array() )
public function getMap($key) public function getMap($key)
{ {
if (isset($this->db[$key])) { if (isset($this->db[$key])) {

View File

@ -6,11 +6,11 @@ class Plugin {
// Ex: sitemap // Ex: sitemap
public $directoryName; public $directoryName;
// (string) Absolute database filename and path // (string) Absoulute database filename and path
// Ex: /www/bludit/bl-content/plugins/sitemap/db.php // Ex: /www/bludit/bl-content/plugins/sitemap/db.php
public $filenameDb; public $filenameDb;
// (string) Absolute metadata filename and path // (string) Absoulute metadata filename and path
// Ex: /www/bludit/bl-plugins/sitemap/metadata.json // Ex: /www/bludit/bl-plugins/sitemap/metadata.json
public $filenameMetadata; public $filenameMetadata;
@ -31,13 +31,9 @@ class Plugin {
// (boolean) Enable or disable default Save and Cancel button on plugin settings // (boolean) Enable or disable default Save and Cancel button on plugin settings
public $formButtons; public $formButtons;
// (array) List of custom hooks
public $customHooks;
function __construct() function __construct()
{ {
$this->dbFields = array(); $this->dbFields = array();
$this->customHooks = array();
$reflector = new ReflectionClass(get_class($this)); $reflector = new ReflectionClass(get_class($this));
@ -63,12 +59,29 @@ class Plugin {
$this->metadata = json_decode($metadataString, true); $this->metadata = json_decode($metadataString, true);
// If the plugin is installed then get the database // If the plugin is installed then get the database
if ($this->installed()) { if($this->installed()) {
$Tmp = new dbJSON($this->filenameDb); $Tmp = new dbJSON($this->filenameDb);
$this->db = $Tmp->db; $this->db = $Tmp->db;
} }
} }
// DEPRECATED
// 2017-06-19
public function setDb($args)
{
foreach($this->dbFields as $key=>$value) {
if( isset($args[$key]) ) {
$value = Sanitize::html( $args[$key] );
if($value==='false') { $value = false; }
elseif($value==='true') { $value = true; }
settype($value, gettype($this->dbFields[$key]));
$this->db[$key] = $value;
}
}
$this->save();
}
public function save() public function save()
{ {
$tmp = new dbJSON($this->filenameDb); $tmp = new dbJSON($this->filenameDb);
@ -86,22 +99,16 @@ class Plugin {
return '<script charset="utf-8" src="'.$this->domainPath().'js/'.$filename.'?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL; 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() public function domainPath()
{ {
return DOMAIN_PLUGINS.$this->directoryName.'/'; 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() public function htmlPath()
{ {
return HTML_PATH_PLUGINS.$this->directoryName.'/'; 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() public function phpPath()
{ {
return PATH_PLUGINS.$this->directoryName.DS; return PATH_PLUGINS.$this->directoryName.DS;
@ -112,7 +119,7 @@ class Plugin {
return PATH_PLUGINS_DATABASES.$this->directoryName.DS; 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 value of the key from the metadata of the plugin, FALSE if the key doen't exit
public function getMetadata($key) public function getMetadata($key)
{ {
if(isset($this->metadata[$key])) { if(isset($this->metadata[$key])) {
@ -134,14 +141,34 @@ class Plugin {
// (boolean) $html, TRUE returns the value sanitized, FALSE unsanitized // (boolean) $html, TRUE returns the value sanitized, FALSE unsanitized
public function getValue($field, $html=true) public function getValue($field, $html=true)
{ {
if (isset($this->db[$field])) { if( isset($this->db[$field]) ) {
if ($html) { if($html) {
return $this->db[$field]; return $this->db[$field];
} else { }
else {
return Sanitize::htmlDecode($this->db[$field]); return Sanitize::htmlDecode($this->db[$field]);
} }
} }
return $this->dbFields[$field]; return false;
}
// DEPRECATED
// 2017-06-16
public function getDbField($key, $html=true)
{
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 '';
} }
public function label() public function label()
@ -224,40 +251,22 @@ class Plugin {
return false; return false;
} }
// Create workspace // Create plugin directory for databases and other files
$workspace = $this->workspace(); mkdir(PATH_PLUGINS_DATABASES.$this->directoryName, 0755, true);
mkdir($workspace, DIR_PERMISSIONS, true);
// Create plugin directory for the database
mkdir(PATH_PLUGINS_DATABASES.$this->directoryName, DIR_PERMISSIONS, true);
// Create database
$this->dbFields['position'] = $position; $this->dbFields['position'] = $position;
// Sanitize default values to store in the file $this->setDb($this->dbFields);
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);
return true; return true;
} }
// Returns TRUE if the plugin is installed public function uninstall()
// This function just check if the database of the plugin is created {
$path = PATH_PLUGINS_DATABASES.$this->directoryName;
return Filesystem::deleteRecursive($path);
}
public function installed() public function installed()
{ {
return file_exists($this->filenameDb); return file_exists($this->filenameDb);
@ -265,25 +274,25 @@ class Plugin {
public function workspace() public function workspace()
{ {
return PATH_WORKSPACES.$this->directoryName.DS; return PATH_PLUGINS_DATABASES.$this->directoryName.DS;
} }
public function init() public function init()
{ {
// This method is used on children classes. // This method is used on childre classes.
// The user can define his own field of the database // The user can define his own field of the database
} }
public function post() public function post()
{ {
$args = $_POST; $args = $_POST;
foreach ($this->dbFields as $field=>$value) { foreach($this->dbFields as $key=>$value) {
if (isset($args[$field])) { if( isset($args[$key]) ) {
$finalValue = Sanitize::html( $args[$field] ); $value = Sanitize::html( $args[$key] );
if ($finalValue==='false') { $finalValue = false; } if($value==='false') { $value = false; }
elseif ($finalValue==='true') { $finalValue = true; } elseif($value==='true') { $value = true; }
settype($finalValue, gettype($value)); settype($value, gettype($this->dbFields[$key]));
$this->db[$field] = $finalValue; $this->db[$key] = $value;
} }
} }
return $this->save(); return $this->save();

View File

@ -1,4 +1,4 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); <?php defined('BLUDIT') or die('Bludit CMS.');
// Title of the page // Title of the page
$layout['title'] = $L->g('About') . ' - ' . $layout['title']; $layout['title'] = $Language->g('About') . ' - ' . $layout['title'];

View File

@ -23,4 +23,4 @@ checkRole(array('admin'));
// ============================================================================ // ============================================================================
// Title of the page // Title of the page
$layout['title'] .= ' - '.$L->g('Categories'); $layout['title'] .= ' - '.$Language->g('Categories');

View File

@ -40,9 +40,12 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
)); ));
// Call the method post of the plugin // Call the method post of the plugin
$plugin->post(); if ($plugin->post()) {
Alert::set( $L->g('The changes have been saved') ); Alert::set( $Language->g('The changes have been saved') );
Redirect::page('configure-plugin/'.$plugin->className()); Redirect::page('configure-plugin/'.$plugin->className());
} else {
Alert::set( $Language->g('Complete all fields') );
}
} }
// ============================================================================ // ============================================================================
@ -50,4 +53,4 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// ============================================================================ // ============================================================================
// Title of the page // Title of the page
$layout['title'] = $L->g('Plugin').' - '.$plugin->name().' - '.$layout['title']; $layout['title'] = $Language->g('Plugin').' - '.$plugin->name().' - '.$layout['title'];

View File

@ -4,25 +4,12 @@
// Check role // Check role
// ============================================================================ // ============================================================================
checkRole(array('admin', 'editor', 'author')); checkRole(array('admin', 'moderator'));
// ============================================================================ // ============================================================================
// Functions // 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 // Main before POST
// ============================================================================ // ============================================================================
@ -35,26 +22,21 @@ function filterContentOwner($list) {
// Main after POST // Main after POST
// ============================================================================ // ============================================================================
$published = $pages->getList($url->pageNumber(), ITEMS_PER_PAGE_ADMIN); // List of published pages
$drafts = $pages->getDraftDB(true); $onlyPublished = true;
$scheduled = $pages->getScheduledDB(true); $amountOfItems = ITEMS_PER_PAGE_ADMIN;
$static = $pages->getStaticDB(true); $pageNumber = $url->pageNumber();
$sticky = $pages->getStickyDB(true); $published = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished);
$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 // Check if out of range the pageNumber
if (empty($published) && $url->pageNumber()>1) { if (empty($published) && $url->pageNumber()>1) {
Redirect::page('content'); Redirect::page('content');
} }
$drafts = $dbPages->getDraftDB(true);
$scheduled = $dbPages->getScheduledDB(true);
$static = $dbPages->getStaticDB(true);
$sticky = $dbPages->getStickyDB(true);
// Title of the page // Title of the page
$layout['title'] .= ' - '.$L->g('Manage content'); $layout['title'] .= ' - '.$Language->g('Manage content');

View File

@ -5,45 +5,18 @@
// ============================================================================ // ============================================================================
function updateBludit() { function updateBludit() {
global $site; global $site;
global $syslog; // Check if Bludit need to be update.
if( ($site->currentBuild() < BLUDIT_BUILD) || isset($_GET['update']) ) {
// 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::set('UPDATE SYSTEM - Starting.'); Log::set('UPDATE SYSTEM - Starting.');
// Updates only for version less than Bludit v3.0 rc-3 // From Bludit v2.0.x to v2.1.x
if ($site->currentBuild()<='20180910') { if ($site->currentBuild() < '20171102') {
@mkdir(PATH_WORKSPACES, DIR_PERMISSIONS, true); // Nothing to do
$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);
}
}
}
// 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));
} }
// Set the current build number // Set the current build number
$site->set(array('currentBuild'=>BLUDIT_BUILD)); $site->set(array('currentBuild'=>BLUDIT_BUILD));
Log::set('UPDATE SYSTEM - Finished.'); Log::set('UPDATE SYSTEM - Finished.');
// Add to syslog
$syslog->add(array(
'dictionaryKey'=>'system-updated',
'notes'=>'Bludit v'.BLUDIT_VERSION
));
} }
} }
@ -63,4 +36,4 @@ function updateBludit() {
updateBludit(); updateBludit();
// Title of the page // Title of the page
$layout['title'] .= ' - '.$L->g('Dashboard'); $layout['title'] .= ' - '.$Language->g('Dashboard');

View File

@ -48,4 +48,4 @@ function printTable($title, $array) {
// Main after POST // Main after POST
// ============================================================================ // ============================================================================
$layout['title'] .= ' - '.$L->g('Developers'); $layout['title'] .= ' - '.$Language->g('Developers');

View File

@ -19,9 +19,9 @@ checkRole(array('admin'));
// ============================================================================ // ============================================================================
if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['action']=='delete') { if (isset($_POST['delete'])) {
deleteCategory($_POST); deleteCategory($_POST);
} elseif ($_POST['action']=='edit') { } elseif (isset($_POST['edit'])) {
editCategory($_POST); editCategory($_POST);
} }
@ -33,12 +33,12 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// ============================================================================ // ============================================================================
$categoryKey = $layout['parameters']; $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); Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to get the category: '.$categoryKey);
Redirect::page('categories'); Redirect::page('categories');
} }
$categoryMap = $categories->getMap($categoryKey); $categoryMap = $dbCategories->getMap($categoryKey);
// Title of the page // Title of the page
$layout['title'] .= ' - '.$L->g('Edit Category').' [ '.$categoryMap['name'] . ' ] '; $layout['title'] .= ' - '.$Language->g('Edit Category').' [ '.$categoryMap['name'] . ' ] ';

View File

@ -4,23 +4,15 @@
// Check role // Check role
// ============================================================================ // ============================================================================
if (checkRole(array('author'), false)) { if (!checkRole(array('admin','moderator'), false)) {
try {
$pageKey = isset($_POST['key']) ? $_POST['key'] : $layout['parameters']; $pageKey = isset($_POST['key']) ? $_POST['key'] : $layout['parameters'];
$page = new Page($pageKey); $page = buildPage($pageKey);
} catch (Exception $e) { if (!$page || $page->username()!==$login->username()) {
Alert::set($L->g('You do not have sufficient permissions'));
Redirect::page('dashboard');
}
if ($page->username()!==$login->username()) {
// Add to syslog
$syslog->add(array( $syslog->add(array(
'dictionaryKey'=>'access-denied', 'dictionaryKey'=>'access-deny',
'notes'=>$login->username() 'notes'=>$login->username()
)); ));
Alert::set($Language->g('You do not have sufficient permissions'));
Alert::set($L->g('You do not have sufficient permissions'));
Redirect::page('dashboard'); Redirect::page('dashboard');
} }
} }
@ -38,14 +30,19 @@ if (checkRole(array('author'), false)) {
// ============================================================================ // ============================================================================
if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['type']==='delete') { if ($_POST['status']==='delete') {
if (deletePage($_POST['key'])) { if (deletePage($_POST['key'])) {
Alert::set( $L->g('The changes have been saved') ); Alert::set( $Language->g('The changes have been saved') );
} }
} else { } else {
// If the checkbox is not selected the form doesn't send the field
$_POST['noindex'] = isset($_POST['noindex'])?true:false;
$_POST['nofollow'] = isset($_POST['nofollow'])?true:false;
$_POST['noarchive'] = isset($_POST['noarchive'])?true:false;
$key = editPage($_POST); $key = editPage($_POST);
if ($key!==false) { if ($key!==false) {
Alert::set( $L->g('The changes have been saved') ); Alert::set( $Language->g('The changes have been saved') );
Redirect::page('edit-content/'.$key); Redirect::page('edit-content/'.$key);
} }
} }
@ -58,29 +55,11 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// ============================================================================ // ============================================================================
try { try {
$pageKey = $layout['parameters']; $pageKey = $layout['parameters'];
$page = new Page($pageKey); $page = new PageX($pageKey);
} catch (Exception $e) { } catch (Exception $e) {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to get the page: '.$pageKey, LOG_TYPE_ERROR); Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to get the page: '.$pageKey, LOG_TYPE_ERROR);
Redirect::page('content'); 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 // Title of the page
$layout['title'] .= ' - '.$L->g('Edit content').' - '.$page->title(); $layout['title'] .= ' - '.$Language->g('Edit content').' - '.$page->title();

View File

@ -19,42 +19,36 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
unset($_POST['role']); unset($_POST['role']);
} }
if (isset($_POST['deleteUserAndDeleteContent']) && ($login->role()==='admin')) { if (isset($_POST['deleteUserAndDeleteContent'])) {
$_POST['deleteContent'] = true; $_POST['deleteContent'] = true;
deleteUser($_POST); deleteUser($_POST);
} elseif (isset($_POST['deleteUserAndKeepContent']) && ($login->role()==='admin')) { } elseif (isset($_POST['deleteUserAndKeepContent'])) {
$_POST['deleteContent'] = false; $_POST['deleteContent'] = false;
deleteUser($_POST); deleteUser($_POST);
} elseif (isset($_POST['disableUser']) && ($login->role()==='admin')) { } elseif (isset($_POST['disableUser'])) {
disableUser(array('username'=>$_POST['username'])); disableUser(array('username'=>$_POST['username']));
} else { } else {
editUser($_POST); editUser($_POST);
} }
Alert::set($L->g('The changes have been saved')); Alert::set($Language->g('The changes have been saved'));
if ($login->role()==='admin') {
Redirect::page('users'); Redirect::page('users');
}
Redirect::page('edit-user/'.$login->username());
} }
// ============================================================================ // ============================================================================
// Main after POST // Main after POST
// ============================================================================ // ============================================================================
$username = $layout['parameters'];
// Prevent non-administrators to change other users // Prevent non-administrators to change other users
if ($login->role()!=='admin') { if ($login->role()!=='admin') {
$username = $login->username(); $layout['parameters'] = $login->username();
} }
try { // Get the user to edit
$user = new User($username); $user = $dbUsers->get($layout['parameters']);
} catch (Exception $e) { if ($user===false) {
Redirect::page('users'); Redirect::page('users');
} }
// Title of the page // Title of the page
$layout['title'] = $L->g('Edit user').' - '.$layout['title']; $layout['title'] = $Language->g('Edit user').' - '.$layout['title'];

View File

@ -22,18 +22,5 @@ checkRole(array('admin'));
// Main after POST // Main after POST
// ============================================================================ // ============================================================================
$pluginClassName = $layout['parameters']; $pluginClassName = $layout['parameters'];
if (!activatePlugin($pluginClassName)) { activatePlugin($pluginClassName);
Log::set('Fail when try to activate the plugin.', LOG_TYPE_ERROR);
}
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('plugins#'.$pluginClassName);

View File

@ -21,10 +21,21 @@ checkRole(array('admin'));
// ============================================================================ // ============================================================================
// Main after POST // Main after POST
// ============================================================================ // ============================================================================
$themeDirectory = $layout['parameters']; $themeDirname = $layout['parameters'];
// Activate theme if( Sanitize::pathFile(PATH_THEMES.$themeDirname) ) {
activateTheme($themeDirectory); // Set the theme
$site->set(array('theme'=>$themeDirname));
// Add to syslog
$syslog->add(array(
'dictionaryKey'=>'new-theme-configured',
'notes'=>$themeDirname
));
// Create an alert
Alert::set( $Language->g('The changes have been saved') );
}
// Redirect // Redirect
Redirect::page('themes'); Redirect::page('themes');

View File

@ -12,10 +12,10 @@ function checkLogin($args)
{ {
global $security; global $security;
global $login; global $login;
global $L; global $Language;
if ($security->isBlocked()) { if ($security->isBlocked()) {
Alert::set($L->g('IP address has been blocked').'<br>'.$L->g('Try again in a few minutes'), ALERT_STATUS_FAIL); Alert::set($Language->g('IP address has been blocked').'<br>'.$Language->g('Try again in a few minutes'), ALERT_STATUS_FAIL);
return false; return false;
} }
@ -25,10 +25,6 @@ function checkLogin($args)
} }
// Renew the token. This token will be the same inside the session for multiple forms. // 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('dashboard');
return true; return true;
} }
@ -37,7 +33,8 @@ function checkLogin($args)
$security->addToBlacklist(); $security->addToBlacklist();
// Create alert // Create alert
Alert::set($L->g('Username or password incorrect'), ALERT_STATUS_FAIL); Alert::set($Language->g('Username or password incorrect'), ALERT_STATUS_FAIL);
return false; return false;
} }

View File

@ -21,5 +21,5 @@
// ============================================================================ // ============================================================================
if ($login->logout()) { if ($login->logout()) {
Redirect::admin(); Redirect::home();
} }

View File

@ -19,7 +19,7 @@ checkRole(array('admin'));
// ============================================================================ // ============================================================================
if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (createCategory($_POST)) { if (createCategory($_POST['category'])) {
Redirect::page('categories'); Redirect::page('categories');
} }
} }
@ -29,4 +29,4 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// ============================================================================ // ============================================================================
// Title of the page // Title of the page
$layout['title'] .= ' - '.$L->g('New category'); $layout['title'] .= ' - '.$Language->g('New category');

View File

@ -4,8 +4,6 @@
// Check role // Check role
// ============================================================================ // ============================================================================
checkRole(array('admin', 'editor', 'author'));
// ============================================================================ // ============================================================================
// Functions // Functions
// ============================================================================ // ============================================================================
@ -19,6 +17,11 @@ checkRole(array('admin', 'editor', 'author'));
// ============================================================================ // ============================================================================
if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// If the checkbox is not selected the form doesn't send the field
$_POST['noindex'] = isset($_POST['noindex'])?true:false;
$_POST['nofollow'] = isset($_POST['nofollow'])?true:false;
$_POST['noarchive'] = isset($_POST['noarchive'])?true:false;
createPage($_POST); createPage($_POST);
Redirect::page('content'); Redirect::page('content');
} }
@ -27,26 +30,5 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Main after POST // 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 // Title of the page
$layout['title'] = $L->g('New content').' - '.$layout['title']; $layout['title'] = $Language->g('New content').' - '.$layout['title'];

View File

@ -29,4 +29,4 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// ============================================================================ // ============================================================================
// Title of the page // Title of the page
$layout['title'] .= ' - '.$L->g('Add a new user'); $layout['title'] .= ' - '.$Language->g('Add a new user');

View File

@ -26,4 +26,4 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// ============================================================================ // ============================================================================
// Title of the page // Title of the page
$layout['title'] .= ' - '.$L->g('Plugins'); $layout['title'] .= ' - '.$Language->g('Plugins');

View File

@ -23,4 +23,4 @@ checkRole(array('admin'));
// ============================================================================ // ============================================================================
// Title of the page // Title of the page
$layout['title'] .= ' - '.$L->g('Plugins'); $layout['title'] .= ' - '.$Language->g('Plugins');

View File

@ -11,30 +11,21 @@ checkRole(array('admin'));
// ============================================================================ // ============================================================================
// ============================================================================ // ============================================================================
// Main before POST // Main after POST
// ============================================================================ // ============================================================================
// ============================================================================ // ============================================================================
// POST Method // POST Method
// ============================================================================ // ============================================================================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
editSettings($_POST);
Redirect::page('settings-general');
}
// ============================================================================ // ============================================================================
// Main after POST // Main after POST
// ============================================================================ // ============================================================================
activatePlugin('pluginAPI'); // Title of the page
$apiURL = DOMAIN_BASE.'api/'; $layout['title'] .= ' - '.$Language->g('General Settings');
$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

@ -0,0 +1,31 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// ============================================================================
// Check role
// ============================================================================
checkRole(array('admin'));
// ============================================================================
// Functions
// ============================================================================
// ============================================================================
// Main after POST
// ============================================================================
// ============================================================================
// POST Method
// ============================================================================
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
editSettings($_POST);
Redirect::page('settings-regional');
}
// ============================================================================
// Main after POST
// ============================================================================
// Title of the page
$layout['title'] .= ' - '.$Language->g('Language and timezone');

View File

@ -28,4 +28,4 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// ============================================================================ // ============================================================================
// Title of the page // Title of the page
$layout['title'] .= ' - '.$L->g('Advanced Settings'); $layout['title'] .= ' - '.$Language->g('Advanced Settings');

View File

@ -21,4 +21,4 @@ checkRole(array('admin'));
$themes = buildThemes(); $themes = buildThemes();
// Title of the page // Title of the page
$layout['title'] .= ' - '.$L->g('Themes'); $layout['title'] .= ' - '.$Language->g('Themes');

View File

@ -4,6 +4,8 @@
// Functions // Functions
// ============================================================================ // ============================================================================
// ============================================================================ // ============================================================================
// Main before POST // Main before POST
// ============================================================================ // ============================================================================
@ -13,22 +15,13 @@
// ============================================================================ // ============================================================================
if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Prevent non-administrators to change other users
$username = $_POST['username'];
if ($login->role()!=='admin') {
$username = $login->username();
}
if (changeUserPassword(array( if (changeUserPassword(array(
'username'=>$username, 'username'=>$_POST['username'],
'newPassword'=>$_POST['newPassword'], 'newPassword'=>$_POST['newPassword'],
'confirmPassword'=>$_POST['confirmPassword'] 'confirmPassword'=>$_POST['confirmPassword']
))) { ))) {
if ($login->role()==='admin') {
Redirect::page('users'); Redirect::page('users');
} }
Redirect::page('edit-user/'.$login->username());
}
} }
// ============================================================================ // ============================================================================
@ -40,12 +33,11 @@ if ($login->role()!=='admin') {
$layout['parameters'] = $login->username(); $layout['parameters'] = $login->username();
} }
try { // Get the user to edit
$username = $layout['parameters']; $user = $dbUsers->get($layout['parameters']);
$user = new User($username); if ($user===false) {
} catch (Exception $e) {
Redirect::page('users'); Redirect::page('users');
} }
// Title of the page // Title of the page
$layout['title'] = $L->g('Change password').' - '.$layout['title']; $layout['title'] = $Language->g('Change password').' - '.$layout['title'];

View File

@ -28,4 +28,4 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' )
// ============================================================================ // ============================================================================
// Title of the page // Title of the page
$layout['title'] .= ' - '.$L->g('Users'); $layout['title'] .= ' - '.$Language->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

@ -9,54 +9,6 @@ body {
background: #fcfcfc; 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 BOOTSTRAP Hacks
*/ */
@ -67,23 +19,26 @@ div.sidebar .nav-item h4 {
} }
} }
/* for small devices */ a {
@media (max-width: 575.98px) { color: #4a90e2;
#jsmediaManagerButton,
#jscategoryButton,
#jsdescriptionButton {
width: 100%;
text-align: left;
}
} }
a:hover {
color: #4a90e2;
}
.btn {
border-radius: 2px;
}
.btn-primary {
background-color: #4F93E0;
border-color: #4a90e2;
}
.btn-light { .btn-primary:hover {
color: #212529; background-color: #4585CF;
background-color: #f3f3f3; border-color: #4a90e2;
border-color: #ced4d9;
} }
.btn-form { .btn-form {
@ -98,8 +53,6 @@ div.sidebar .nav-item h4 {
color: #000; color: #000;
} }
code { code {
padding: 3px 5px 2px; padding: 3px 5px 2px;
margin: 0 1px; margin: 0 1px;
@ -108,26 +61,9 @@ code {
color: #444; 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 LOGIN
*/ */
body.login { body.login {
background: rgb(255,255,255); background: rgb(255,255,255);
background: linear-gradient(0deg, rgba(255,255,255,1) 0%, rgba(250,250,250,1) 53%); background: linear-gradient(0deg, rgba(255,255,255,1) 0%, rgba(250,250,250,1) 53%);
@ -141,10 +77,6 @@ body.login {
#dashboard ul.list-group.list-group-striped li { #dashboard ul.list-group.list-group-striped li {
border: none; 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) { #dashboard ul.list-group.list-group-striped li:nth-of-type(even) {
@ -166,16 +98,6 @@ body.login {
color: #4586d4; color: #4586d4;
} }
#hello-message {
padding: 10px 0;
color: #777;
margin-bottom: 20px;
}
#hello-message span.oi {
top: 3px;
}
.ct-series-a .ct-line { .ct-series-a .ct-line {
/* Set the colour of this series line */ /* Set the colour of this series line */
stroke: #4a90e2; stroke: #4a90e2;
@ -184,6 +106,7 @@ body.login {
/* Create a dashed line with a pattern */ /* Create a dashed line with a pattern */
} }
/* This selector overrides the points style on line charts. Points on line charts are actually just very short strokes. This allows you to customize even the point size in CSS */
.ct-series-a .ct-point { .ct-series-a .ct-point {
/* Colour of your points */ /* Colour of your points */
stroke: #4a90e2; stroke: #4a90e2;
@ -194,7 +117,6 @@ body.login {
/* /*
ALERT ALERT
*/ */
#alert { #alert {
display: none; display: none;
position: fixed; position: fixed;
@ -209,22 +131,45 @@ body.login {
.alert-success { .alert-success {
background-color: #4586d4; background-color: #4586d4;
border-left: 6px solid #abd1ff !important;
color: #ffffff; color: #ffffff;
} }
.alert-danger { .alert-danger {
background-color: #d44545; background-color: #d44545;
border-left: 6px solid #ff9c9c !important;
color: #ffffff; color: #ffffff;
} }
/*
SIDEBAR
*/
div.sidebar .nav-item a {
padding-left:0;
padding-right:0;
color: #777;
padding-top: 5px;
padding-bottom: 5px;
}
div.sidebar .nav-item a:hover {
text-decoration: underline;
}
div.sidebar .nav-item h4 {
font-size: 1.3em;
text-transform: uppercase;
font-weight: 400;
margin-top: 10px;
}
div.sidebar .nav-item span.oi {
color: #000;
font-size: 0.8em;
padding-right: 5px;
}
/* /*
PLUGINS PLUGINS
*/ */
.plugin-form label { .plugin-form label {
display: block; display: block;
margin-top: 1rem !important; margin-top: 1rem !important;
@ -258,107 +203,3 @@ body.login {
color: #6c757d !important; 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;
}

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,543 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<!--
2014-7-1: Created.
-->
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>
Created by FontForge 20120731 at Tue Jul 1 20:39:22 2014
By P.J. Onori
Created by P.J. Onori with FontForge 2.0 (http://fontforge.sf.net)
</metadata>
<defs>
<font id="open-iconic" horiz-adv-x="800" >
<font-face
font-family="Icons"
font-weight="400"
font-stretch="normal"
units-per-em="800"
panose-1="2 0 5 3 0 0 0 0 0 0"
ascent="800"
descent="0"
bbox="-0.5 -101 802 800.126"
underline-thickness="50"
underline-position="-100"
unicode-range="U+E000-E0DE"
/>
<missing-glyph />
<glyph glyph-name="" unicode="&#xe000;"
d="M300 700h500v-700h-500v100h400v500h-400v100zM400 500l200 -150l-200 -150v100h-400v100h400v100z" />
<glyph glyph-name="1" unicode="&#xe001;"
d="M300 700h500v-700h-500v100h400v500h-400v100zM200 500v-100h400v-100h-400v-100l-200 150z" />
<glyph glyph-name="2" unicode="&#xe002;"
d="M350 700c193 0 350 -157 350 -350v-50h100l-200 -200l-200 200h100v50c0 138 -112 250 -250 250s-250 -112 -250 -250c0 193 157 350 350 350z" />
<glyph glyph-name="3" unicode="&#xe003;"
d="M450 700c193 0 350 -157 350 -350c0 138 -112 250 -250 250s-250 -112 -250 -250v-50h100l-200 -200l-200 200h100v50c0 193 157 350 350 350z" />
<glyph glyph-name="4" unicode="&#xe004;"
d="M0 700h800v-100h-800v100zM100 500h600v-100h-600v100zM0 300h800v-100h-800v100zM100 100h600v-100h-600v100z" />
<glyph glyph-name="5" unicode="&#xe005;"
d="M0 700h800v-100h-800v100zM0 500h600v-100h-600v100zM0 300h800v-100h-800v100zM0 100h600v-100h-600v100z" />
<glyph glyph-name="6" unicode="&#xe006;"
d="M0 700h800v-100h-800v100zM200 500h600v-100h-600v100zM0 300h800v-100h-800v100zM200 100h600v-100h-600v100z" />
<glyph glyph-name="7" unicode="&#xe007;"
d="M400 700c75 0 146 -23 206 -59l-75 -225l-322 234c57 31 122 50 191 50zM125 588l191 -138l-310 -222c-4 24 -6 47 -6 72c0 114 49 215 125 288zM688 575c69 -72 112 -168 112 -275c0 -35 -8 -68 -16 -100h-218zM216 253l112 -347c-128 23 -232 109 -287 222zM372 100
h372c-64 -109 -177 -185 -310 -197z" />
<glyph glyph-name="8" unicode="&#xe008;" horiz-adv-x="600"
d="M200 800h100v-500h200l-247 -300l-253 300h200v500z" />
<glyph glyph-name="9" unicode="&#xe009;"
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM300 700v-300h-200l300 -300l300 300h-200v300h-200z" />
<glyph glyph-name="a" unicode="&#xe00a;"
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM400 700l-300 -300l300 -300v200h300v200h-300v200z" />
<glyph glyph-name="b" unicode="&#xe00b;"
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM400 700v-200h-300v-200h300v-200l300 300z" />
<glyph glyph-name="c" unicode="&#xe00c;"
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM400 700l-300 -300h200v-300h200v300h200z" />
<glyph glyph-name="d" unicode="&#xe00d;"
d="M300 600v-200h500v-100h-500v-200l-300 247z" />
<glyph glyph-name="e" unicode="&#xe00e;"
d="M500 600l300 -247l-300 -253v200h-500v100h500v200z" />
<glyph glyph-name="f" unicode="&#xe00f;" horiz-adv-x="600"
d="M200 800h200v-500h200l-297 -300l-303 300h200v500z" />
<glyph glyph-name="10" unicode="&#xe010;"
d="M300 700v-200h500v-200h-500v-200l-300 297z" />
<glyph glyph-name="11" unicode="&#xe011;"
d="M500 700l300 -297l-300 -303v200h-500v200h500v200z" />
<glyph glyph-name="12" unicode="&#xe012;" horiz-adv-x="600"
d="M297 800l303 -300h-200v-500h-200v500h-200z" />
<glyph glyph-name="13" unicode="&#xe013;" horiz-adv-x="600"
d="M247 800l253 -300h-200v-500h-100v500h-200z" />
<glyph glyph-name="14" unicode="&#xe014;"
d="M400 800h100v-800h-100v800zM200 700h100v-600h-100v600zM600 600h100v-400h-100v400zM0 500h100v-200h-100v200z" />
<glyph glyph-name="15" unicode="&#xe015;"
d="M116 600l72 -72c-54 -54 -88 -126 -88 -209s34 -159 88 -213l-72 -72c-72 72 -116 175 -116 285s44 209 116 281zM684 600c72 -72 116 -171 116 -281s-44 -213 -116 -285l-72 72c54 54 88 130 88 213s-34 155 -88 209zM259 460l69 -72c-18 -18 -28 -41 -28 -69
s10 -54 28 -72l-69 -72c-36 36 -59 89 -59 144s23 105 59 141zM541 459c36 -36 59 -85 59 -140s-23 -108 -59 -144l-69 72c18 18 28 44 28 72s-10 51 -28 69z" />
<glyph glyph-name="16" unicode="&#xe016;" horiz-adv-x="400"
d="M200 800c110 0 200 -90 200 -200s-90 -200 -200 -200s-200 90 -200 200s90 200 200 200zM100 319c31 -11 65 -19 100 -19s68 8 100 19v-319l-100 100l-100 -100v319z" />
<glyph glyph-name="17" unicode="&#xe017;"
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300c0 -66 21 -126 56 -175l419 419c-49 35 -109 56 -175 56zM644 575l-419 -419c49 -35 109 -56 175 -56c166 0 300 134 300 300
c0 66 -21 126 -56 175z" />
<glyph glyph-name="18" unicode="&#xe018;"
d="M0 700h100v-600h700v-100h-800v700zM500 700h200v-500h-200v500zM200 500h200v-300h-200v300z" />
<glyph glyph-name="19" unicode="&#xe019;"
d="M397 800c13 1 23 -4 34 -13c2 -2 214 -254 241 -287h128v-100h-100v-366c0 -18 -16 -34 -34 -34h-532c-18 0 -34 16 -34 34v366h-100v100h128l234 281c9 11 22 18 35 19zM400 672l-144 -172h288zM250 300c-28 0 -50 -22 -50 -50v-100c0 -28 22 -50 50 -50s50 22 50 50
v100c0 28 -22 50 -50 50zM550 300c-28 0 -50 -22 -50 -50v-100c0 -28 22 -50 50 -50s50 22 50 50v100c0 28 -22 50 -50 50z" />
<glyph glyph-name="1a" unicode="&#xe01a;"
d="M9 700h682c6 0 9 -4 9 -10v-190h100v-200h-100v-191c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v582c0 6 3 9 9 9zM100 600v-400h500v400h-500z" />
<glyph glyph-name="1b" unicode="&#xe01b;"
d="M9 700h682c6 0 9 -4 9 -10v-190h100v-200h-100v-191c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v582c0 6 3 9 9 9z" />
<glyph glyph-name="1c" unicode="&#xe01c;"
d="M92 650c0 23 19 50 45 50h3h5h5h500c28 0 50 -22 50 -50s-22 -50 -50 -50h-50v-141c9 -17 120 -231 166 -309c16 -26 34 -61 34 -106c0 -39 -15 -77 -41 -103h-3c-26 -25 -62 -41 -100 -41h-512c-39 0 -77 15 -103 41s-41 64 -41 103c0 46 18 80 34 106
c46 78 157 292 166 309v141h-50c-2 0 -6 -1 -8 -1c-28 0 -50 23 -50 51zM500 600h-200v-162l-6 -10s-63 -123 -119 -228h450c-56 105 -119 228 -119 228l-6 10v162z" />
<glyph glyph-name="1d" unicode="&#xe01d;"
d="M400 800c110 0 200 -90 200 -200c0 -104 52 -198 134 -266c41 -34 66 -82 66 -134h-800c0 52 25 100 66 134c82 68 134 162 134 266c0 110 90 200 200 200zM300 100h200c0 -55 -45 -100 -100 -100s-100 45 -100 100z" />
<glyph glyph-name="1e" unicode="&#xe01e;" horiz-adv-x="600"
d="M150 800h50l350 -250l-225 -147l225 -153l-350 -250h-50v250l-75 -75l-75 75l150 150l-150 150l75 75l75 -75v250zM250 650v-200l150 100zM250 350v-200l150 100z" />
<glyph glyph-name="1f" unicode="&#xe01f;"
d="M0 800h500c110 0 200 -90 200 -200c0 -47 -17 -91 -44 -125c85 -40 144 -125 144 -225c0 -138 -112 -250 -250 -250h-550v100c55 0 100 45 100 100v400c0 55 -45 100 -100 100v100zM300 700v-200h100c55 0 100 45 100 100s-45 100 -100 100h-100zM300 400v-300h150
c83 0 150 67 150 150s-67 150 -150 150h-150z" />
<glyph glyph-name="20" unicode="&#xe020;" horiz-adv-x="600"
d="M300 800v-300h200l-300 -500v300h-200z" />
<glyph glyph-name="21" unicode="&#xe021;"
d="M100 800h300v-300l100 100l100 -100v300h50c28 0 50 -22 50 -50v-550h-550c-28 0 -50 -22 -50 -50s22 -50 50 -50h550v-100h-550c-83 0 -150 67 -150 150v550l3 19c8 39 39 70 78 78z" />
<glyph glyph-name="22" unicode="&#xe022;" horiz-adv-x="400"
d="M0 800h400v-800l-200 200l-200 -200v800z" />
<glyph glyph-name="23" unicode="&#xe023;"
d="M0 800h800v-100h-800v100zM0 600h300v-103h203v103h297v-591c0 -6 -3 -9 -9 -9h-782c-6 0 -9 3 -9 9v591z" />
<glyph glyph-name="24" unicode="&#xe024;"
d="M300 800h200c55 0 100 -45 100 -100v-100h191c6 0 9 -3 9 -9v-241c0 -28 -22 -50 -50 -50h-700c-28 0 -50 22 -50 50v241c0 6 3 9 9 9h191v100c0 55 45 100 100 100zM300 700v-100h200v100h-200zM0 209c16 -6 32 -9 50 -9h700c18 0 34 3 50 9v-200c0 -6 -3 -9 -9 -9h-782
c-6 0 -9 3 -9 9v200z" />
<glyph glyph-name="25" unicode="&#xe025;" horiz-adv-x="600"
d="M300 800c58 0 110 -16 147 -53s53 -89 53 -147h-100c0 39 -11 61 -25 75s-36 25 -75 25c-35 0 -55 -10 -72 -31s-28 -55 -28 -94c0 -51 20 -107 28 -175h172v-100h-178c-14 -60 -49 -127 -113 -200h491v-100h-600v122l16 12c69 69 95 121 106 166h-122v100h125
c-8 50 -25 106 -25 175c0 58 16 114 50 156c34 43 88 69 150 69z" />
<glyph glyph-name="26" unicode="&#xe026;"
d="M34 700h4h3h4h5h700c28 0 50 -22 50 -50v-700c0 -28 -22 -50 -50 -50h-700c-28 0 -50 22 -50 50v700v2c0 20 15 42 34 48zM150 600c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50zM350 600c-28 0 -50 -22 -50 -50s22 -50 50 -50h300c28 0 50 22 50 50
s-22 50 -50 50h-300zM100 400v-400h600v400h-600z" />
<glyph glyph-name="27" unicode="&#xe027;"
d="M744 797l6 -3l44 -44c4 -4 3 -8 0 -12l-266 -375l-15 -13l-25 -12c-23 72 -78 127 -150 150l12 25l13 15l375 266zM266 400c74 0 134 -60 134 -134c0 -147 -119 -266 -266 -266c-48 0 -95 12 -134 34c80 46 134 133 134 232c0 74 58 134 132 134z" />
<glyph glyph-name="28" unicode="&#xe028;"
d="M9 451c0 23 19 50 46 50c8 0 19 -3 26 -7l131 -66l29 22c-79 81 -1 250 118 250s197 -167 119 -250l28 -22l131 66c6 4 12 7 21 7c28 0 50 -22 50 -50c0 -17 -12 -37 -27 -45l-115 -56c9 -16 19 -33 25 -50h68c28 0 50 -22 50 -50s-22 -50 -50 -50h-50
c0 -23 -2 -45 -6 -66l78 -40c21 -5 37 -28 37 -49c0 -28 -22 -50 -50 -50c-10 0 -23 5 -31 11l-65 35c-24 -46 -62 -86 -103 -110c-35 19 -60 45 -60 72v135v4v5v6v5v5v87c0 28 -22 50 -50 50c-24 0 -45 -17 -50 -40c1 -3 1 -8 1 -11s0 -8 -1 -11v-82v-4v-5v-144
c0 -28 -24 -53 -59 -72c-41 25 -79 64 -103 110l-66 -35c-8 -6 -21 -11 -31 -11c-28 0 -50 22 -50 50c0 21 16 44 37 49l78 40c-4 21 -6 43 -6 66h-50h-5c-28 0 -50 22 -50 50c0 26 22 50 50 50h5h69c6 17 16 34 25 50l-116 56c-16 7 -28 27 -28 45z" />
<glyph glyph-name="29" unicode="&#xe029;"
d="M600 700h91c6 0 9 -3 9 -9v-582c0 -6 -3 -9 -9 -9h-91v600zM210 503l290 147v-500l-250 125v-3c-15 0 -25 -8 -28 -22l75 -178c11 -25 0 -58 -25 -69s-58 0 -69 25l-103 272h-91c-6 0 -9 3 -9 9v182c0 6 3 9 9 9h182z" />
<glyph glyph-name="2a" unicode="&#xe02a;"
d="M9 800h682c6 0 9 -3 9 -9v-782c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v782c0 6 3 9 9 9zM100 700v-200h500v200h-500zM100 400v-100h100v100h-100zM300 400v-100h100v100h-100zM500 400v-300h100v300h-100zM100 200v-100h100v100h-100zM300 200v-100h100v100h-100z" />
<glyph glyph-name="2b" unicode="&#xe02b;"
d="M0 800h700v-200h-700v200zM0 500h700v-491c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v491zM100 400v-100h100v100h-100zM300 400v-100h100v100h-100zM500 400v-100h100v100h-100zM100 200v-100h100v100h-100zM300 200v-100h100v100h-100z" />
<glyph glyph-name="2c" unicode="&#xe02c;"
d="M409 800h182c6 0 10 -4 12 -9l94 -182c2 -5 6 -9 12 -9h82c6 0 9 -3 9 -9v-582c0 -6 -3 -9 -9 -9h-782c-6 0 -9 3 -9 9v441c0 83 67 150 150 150h141c6 0 10 4 12 9l94 182c2 5 6 9 12 9zM150 500c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z
M500 500c-110 0 -200 -90 -200 -200s90 -200 200 -200s200 90 200 200s-90 200 -200 200zM500 400c55 0 100 -45 100 -100s-45 -100 -100 -100s-100 45 -100 100s45 100 100 100z" />
<glyph glyph-name="2d" unicode="&#xe02d;"
d="M0 600h800l-400 -400z" />
<glyph glyph-name="2e" unicode="&#xe02e;" horiz-adv-x="400"
d="M400 800v-800l-400 400z" />
<glyph glyph-name="2f" unicode="&#xe02f;" horiz-adv-x="400"
d="M0 800l400 -400l-400 -400v800z" />
<glyph glyph-name="30" unicode="&#xe030;"
d="M400 600l400 -400h-800z" />
<glyph glyph-name="31" unicode="&#xe031;"
d="M0 550c0 23 20 50 46 50h3h5h4h200c17 0 37 -13 44 -28l38 -72h444c14 0 19 -12 15 -25l-81 -250c-4 -13 -21 -25 -35 -25h-350c-14 0 -30 12 -34 25c-27 83 -54 167 -81 250l-10 25h-150c-2 0 -5 -1 -7 -1c-28 0 -51 23 -51 51zM358 100c28 0 50 -22 50 -50
s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM658 100c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z" />
<glyph glyph-name="32" unicode="&#xe032;"
d="M0 700h500v-100h-300v-300h-100l-100 -100v500zM300 500h500v-500l-100 100h-400v400z" />
<glyph glyph-name="33" unicode="&#xe033;"
d="M641 700l143 -141l-493 -493c-71 76 -146 148 -219 222l-72 71l141 141c50 -51 101 -101 153 -150c116 117 234 231 347 350z" />
<glyph glyph-name="34" unicode="&#xe034;"
d="M150 600l250 -250l250 250l150 -150l-400 -400l-400 400z" />
<glyph glyph-name="35" unicode="&#xe035;" horiz-adv-x="600"
d="M400 800l150 -150l-250 -250l250 -250l-150 -150l-400 400z" />
<glyph glyph-name="36" unicode="&#xe036;" horiz-adv-x="600"
d="M150 800l400 -400l-400 -400l-150 150l250 250l-250 250z" />
<glyph glyph-name="37" unicode="&#xe037;"
d="M400 600l400 -400l-150 -150l-250 250l-250 -250l-150 150z" />
<glyph glyph-name="38" unicode="&#xe038;"
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM600 622l-250 -250l-100 100l-72 -72l172 -172l322 322z" />
<glyph glyph-name="39" unicode="&#xe039;"
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM250 622l-72 -72l150 -150l-150 -150l72 -72l150 150l150 -150l72 72l-150 150l150 150l-72 72l-150 -150z" />
<glyph glyph-name="3a" unicode="&#xe03a;"
d="M350 800c28 0 50 -22 50 -50v-50h75c14 0 25 -11 25 -25v-75h-300v75c0 14 11 25 25 25h75v50c0 28 22 50 50 50zM25 700h75v-200h500v200h75c14 0 25 -11 25 -25v-650c0 -14 -11 -25 -25 -25h-650c-14 0 -25 11 -25 25v650c0 14 11 25 25 25z" />
<glyph glyph-name="3b" unicode="&#xe03b;"
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300s134 -300 300 -300s300 134 300 300s-134 300 -300 300zM350 600h100v-181c23 -24 47 -47 72 -69l-72 -72c-27 30 -55 59 -84 88l-16 12
v222z" />
<glyph glyph-name="3c" unicode="&#xe03c;"
d="M450 800c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -18 -3 -34 -9 -50h-191v50c0 83 -67 150 -150 150s-150 -67 -150 -150v-50h-272c-17 30 -28 63 -28 100c0 110 90 200 200 200c23 114 129 200 250 200zM434 400h3h4c3 0 6 1 9 1c28 0 50 -22 50 -50v-1
v-150h150l-200 -200l-200 200h150v150v2c0 20 15 42 34 48z" />
<glyph glyph-name="3d" unicode="&#xe03d;"
d="M450 800c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -18 -3 -34 -9 -50h-141l-200 200l-200 -200h-222c-17 30 -28 63 -28 100c0 110 90 200 200 200c23 114 129 200 250 200zM450 350l250 -250h-200v-50c0 -28 -22 -50 -50 -50s-50 22 -50 50v50h-200z" />
<glyph glyph-name="3e" unicode="&#xe03e;"
d="M450 700c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -83 -67 -150 -150 -150h-450c-110 0 -200 90 -200 200s90 200 200 200c23 114 129 200 250 200z" />
<glyph glyph-name="3f" unicode="&#xe03f;"
d="M250 800c82 0 154 -40 200 -100c-143 0 -270 -85 -325 -209c-36 -10 -70 -25 -100 -47c-16 33 -25 67 -25 106c0 138 112 250 250 250zM450 600c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -83 -67 -150 -150 -150h-450c-110 0 -200 90 -200 200
s90 200 200 200c23 114 129 200 250 200z" />
<glyph glyph-name="40" unicode="&#xe040;"
d="M500 700h100l-300 -600h-100zM100 600h100l-100 -200l100 -200h-100l-100 200zM600 600h100l100 -200l-100 -200h-100l100 200z" />
<glyph glyph-name="41" unicode="&#xe041;"
d="M350 800h100l50 -119l28 -12l119 50l72 -72l-50 -119l12 -28l119 -50v-100l-119 -50l-12 -28l50 -119l-72 -72l-119 50l-28 -12l-50 -119h-100l-50 119l-28 12l-119 -50l-72 72l50 119l-12 28l-119 50v100l119 50l12 28l-50 119l72 72l119 -50l28 12zM400 550
c-83 0 -150 -67 -150 -150s67 -150 150 -150s150 67 150 150s-67 150 -150 150z" />
<glyph glyph-name="42" unicode="&#xe042;"
d="M0 800h800v-200h-800v200zM200 500h400l-200 -200zM0 100h800v-100h-800v100z" />
<glyph glyph-name="43" unicode="&#xe043;"
d="M0 800h100v-800h-100v800zM600 800h200v-800h-200v800zM500 600v-400l-200 200z" />
<glyph glyph-name="44" unicode="&#xe044;"
d="M0 800h200v-800h-200v800zM700 800h100v-800h-100v800zM300 600l200 -200l-200 -200v400z" />
<glyph glyph-name="45" unicode="&#xe045;"
d="M0 800h800v-100h-800v100zM400 500l200 -200h-400zM0 200h800v-200h-800v200z" />
<glyph glyph-name="46" unicode="&#xe046;"
d="M150 700c83 0 150 -67 150 -150v-50h100v50c0 83 67 150 150 150s150 -67 150 -150s-67 -150 -150 -150h-50v-100h50c83 0 150 -67 150 -150s-67 -150 -150 -150s-150 67 -150 150v50h-100v-50c0 -83 -67 -150 -150 -150s-150 67 -150 150s67 150 150 150h50v100h-50
c-83 0 -150 67 -150 150s67 150 150 150zM150 600c-28 0 -50 -22 -50 -50s22 -50 50 -50h50v50c0 28 -22 50 -50 50zM550 600c-28 0 -50 -22 -50 -50v-50h50c28 0 50 22 50 50s-22 50 -50 50zM300 400v-100h100v100h-100zM150 200c-28 0 -50 -22 -50 -50s22 -50 50 -50
s50 22 50 50v50h-50zM500 200v-50c0 -28 22 -50 50 -50s50 22 50 50s-22 50 -50 50h-50z" />
<glyph glyph-name="47" unicode="&#xe047;"
d="M0 791c0 5 4 9 9 9h782c6 0 9 -4 9 -10v-790l-200 200h-591c-6 0 -9 3 -9 9v582z" />
<glyph glyph-name="48" unicode="&#xe048;"
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300s134 -300 300 -300s300 134 300 300s-134 300 -300 300zM600 600l-100 -300l-300 -100l100 300zM400 450c-28 0 -50 -22 -50 -50
s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
<glyph glyph-name="49" unicode="&#xe049;"
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700v-600c166 0 300 134 300 300s-134 300 -300 300z" />
<glyph glyph-name="4a" unicode="&#xe04a;"
d="M0 800h800v-100h-800v100zM0 600h500v-100h-500v100zM0 300h800v-100h-800v100zM0 100h600v-100h-600v100zM750 100c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z" />
<glyph glyph-name="4b" unicode="&#xe04b;"
d="M25 700h750c14 0 25 -11 25 -25v-75h-800v75c0 14 11 25 25 25zM0 500h800v-375c0 -14 -11 -25 -25 -25h-750c-14 0 -25 11 -25 25v375zM100 300v-100h100v100h-100zM300 300v-100h100v100h-100z" />
<glyph glyph-name="4c" unicode="&#xe04c;"
d="M100 800h100v-100h450l100 100l50 -50l-100 -100v-450h100v-100h-100v-100h-100v100h-500v500h-100v100h100v100zM200 600v-350l350 350h-350zM600 550l-350 -350h350v350z" />
<glyph glyph-name="4d" unicode="&#xe04d;"
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300s134 -300 300 -300s300 134 300 300s-134 300 -300 300zM400 600c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z
M200 452c0 20 15 42 34 48h3h3h8c12 0 28 -7 36 -16l91 -90l25 6c55 0 100 -45 100 -100s-45 -100 -100 -100s-100 45 -100 100l6 25l-90 91c-9 8 -16 24 -16 36zM550 500c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z" />
<glyph glyph-name="4e" unicode="&#xe04e;"
d="M300 800h200v-300h200l-300 -300l-300 300h200v300zM0 100h800v-100h-800v100z" />
<glyph glyph-name="4f" unicode="&#xe04f;"
d="M0 800h800v-100h-800v100zM400 600l300 -300h-200v-300h-200v300h-200z" />
<glyph glyph-name="50" unicode="&#xe050;"
d="M200 700h600v-600h-600l-200 300zM350 622l-72 -72l150 -150l-150 -150l72 -72l150 150l150 -150l72 72l-150 150l150 150l-72 72l-150 -150z" />
<glyph glyph-name="51" unicode="&#xe051;"
d="M400 700c220 0 400 -180 400 -400h-100c0 166 -134 300 -300 300s-300 -134 -300 -300h-100c0 220 180 400 400 400zM341 491l59 -88l59 88c81 -25 141 -101 141 -191c0 -110 -90 -200 -200 -200s-200 90 -200 200c0 90 60 166 141 191z" />
<glyph glyph-name="52" unicode="&#xe052;"
d="M0 800h300v-400h400v-400h-700v800zM400 800l300 -300h-300v300zM100 600v-100h100v100h-100zM100 400v-100h100v100h-100zM100 200v-100h400v100h-400z" />
<glyph glyph-name="53" unicode="&#xe053;" horiz-adv-x="600"
d="M200 700h100v-100h75c30 0 58 -6 81 -22s44 -44 44 -78v-100h-100v94c-4 3 -13 6 -25 6h-250c-14 0 -25 -11 -25 -25v-50c0 -15 20 -40 34 -44l257 -65c66 -16 109 -73 109 -141v-50c0 -68 -57 -125 -125 -125h-75v-100h-100v100h-75c-30 0 -58 6 -81 22s-44 44 -44 78
v100h100v-94c4 -3 13 -6 25 -6h250c14 0 25 11 25 25v50c0 15 -20 40 -34 44l-257 65c-66 16 -109 73 -109 141v50c0 68 57 125 125 125h75v100z" />
<glyph glyph-name="54" unicode="&#xe054;"
d="M0 700h300v-300l-300 -300v600zM500 700h300v-300l-300 -300v600z" />
<glyph glyph-name="55" unicode="&#xe055;"
d="M300 700v-600h-300v300zM800 700v-600h-300v300z" />
<glyph glyph-name="56" unicode="&#xe056;"
d="M300 700v-100c-111 0 -200 -89 -200 -200h200v-300h-300v300c0 165 135 300 300 300zM800 700v-100c-111 0 -200 -89 -200 -200h200v-300h-300v300c0 165 135 300 300 300z" />
<glyph glyph-name="57" unicode="&#xe057;"
d="M0 700h300v-300c0 -165 -135 -300 -300 -300v100c111 0 200 89 200 200h-200v300zM500 700h300v-300c0 -165 -135 -300 -300 -300v100c111 0 200 89 200 200h-200v300z" />
<glyph glyph-name="58" unicode="&#xe058;" horiz-adv-x="600"
d="M300 800l34 -34c11 -11 266 -270 266 -488c0 -165 -135 -300 -300 -300s-300 135 -300 300c0 218 255 477 266 488zM150 328c-28 0 -50 -22 -50 -50c0 -110 90 -200 200 -200c28 0 50 22 50 50s-22 50 -50 50c-55 0 -100 45 -100 100c0 28 -22 50 -50 50z" />
<glyph glyph-name="59" unicode="&#xe059;"
d="M400 800l400 -500h-800zM0 200h800v-200h-800v200z" />
<glyph glyph-name="5a" unicode="&#xe05a;" horiz-adv-x="600"
d="M300 800l300 -300h-600zM0 300h600l-300 -300z" />
<glyph glyph-name="5b" unicode="&#xe05b;"
d="M0 500h200v-200h-200v200zM300 500h200v-200h-200v200zM600 500h200v-200h-200v200z" />
<glyph glyph-name="5c" unicode="&#xe05c;"
d="M0 700h800v-100l-400 -200l-400 200v100zM0 500l400 -200l400 200v-400h-800v400z" />
<glyph glyph-name="5d" unicode="&#xe05d;"
d="M400 800l400 -200v-600h-800v600zM400 688l-300 -150v-188l300 -150l300 150v188zM200 500h400v-100l-200 -100l-200 100v100z" />
<glyph glyph-name="5e" unicode="&#xe05e;"
d="M600 700c69 0 134 -19 191 -50l-16 -106c-49 35 -109 56 -175 56c-131 0 -240 -84 -281 -200h331l-16 -100h-334c0 -36 8 -68 19 -100h297l-16 -100h-222c55 -61 133 -100 222 -100c78 0 147 30 200 78v-122c-59 -35 -127 -56 -200 -56c-147 0 -274 82 -344 200h-256
l19 100h197c-8 32 -16 66 -16 100h-200l25 100h191c45 172 198 300 384 300z" />
<glyph glyph-name="5f" unicode="&#xe05f;"
d="M0 700h700v-100h-700v100zM0 500h500v-100h-500v100zM0 300h800v-100h-800v100zM0 100h100v-100h-100v100zM200 100h100v-100h-100v100zM400 100h100v-100h-100v100z" />
<glyph glyph-name="60" unicode="&#xe060;"
d="M0 800h800v-100h-800v100zM200 600h400l-200 -200zM0 200h800v-200h-800v200z" />
<glyph glyph-name="61" unicode="&#xe061;"
d="M0 800h100v-800h-100v800zM600 800h200v-800h-200v800zM200 600l200 -200l-200 -200v400z" />
<glyph glyph-name="62" unicode="&#xe062;"
d="M0 800h200v-800h-200v800zM700 800h100v-800h-100v800zM600 600v-400l-200 200z" />
<glyph glyph-name="63" unicode="&#xe063;"
d="M0 800h800v-200h-800v200zM400 400l200 -200h-400zM0 100h800v-100h-800v100z" />
<glyph glyph-name="64" unicode="&#xe064;"
d="M0 800h200v-100h-100v-600h600v100h100v-200h-800v800zM400 800h400v-400l-150 150l-250 -250l-100 100l250 250z" />
<glyph glyph-name="65" unicode="&#xe065;"
d="M403 700c247 0 397 -300 397 -300s-150 -300 -397 -300c-253 0 -403 300 -403 300s150 300 403 300zM400 600c-110 0 -200 -90 -200 -200s90 -200 200 -200s200 90 200 200s-90 200 -200 200zM400 500c10 0 19 -3 28 -6c-16 -8 -28 -24 -28 -44c0 -28 22 -50 50 -50
c20 0 36 12 44 28c3 -9 6 -18 6 -28c0 -55 -45 -100 -100 -100s-100 45 -100 100s45 100 100 100z" />
<glyph glyph-name="66" unicode="&#xe066;" horiz-adv-x="900"
d="M331 700h3h3c3 1 7 1 10 1c12 0 29 -8 37 -17l94 -93l66 65c57 57 155 57 212 0c58 -58 58 -154 0 -212l-65 -66l93 -94c10 -8 18 -25 18 -38c0 -28 -22 -50 -50 -50c-13 0 -32 9 -40 20l-62 65l-381 -381h-269v272l375 381l-63 63c-9 8 -16 24 -16 36c0 20 16 42 35 48z
M447 481l-313 -315l128 -132l316 316z" />
<glyph glyph-name="67" unicode="&#xe067;"
d="M0 800h300v-400h400v-400h-700v800zM400 800l300 -300h-300v300z" />
<glyph glyph-name="68" unicode="&#xe068;"
d="M200 800c0 0 200 -100 200 -300s-298 -302 -200 -500c0 0 -200 100 -200 300s300 300 200 500zM500 500c0 0 200 -100 200 -300c0 -150 -60 -200 -100 -200h-300c0 200 300 300 200 500z" />
<glyph glyph-name="69" unicode="&#xe069;"
d="M0 800h100v-800h-100v800zM200 800h300v-100h300l-200 -203l200 -197h-400v100h-200v400z" />
<glyph glyph-name="6a" unicode="&#xe06a;" horiz-adv-x="400"
d="M150 800h150l-100 -200h200l-150 -300h150l-300 -300l-100 300h134l66 200h-200z" />
<glyph glyph-name="6b" unicode="&#xe06b;"
d="M0 800h300v-100h500v-100h-800v200zM0 500h800v-450c0 -28 -22 -50 -50 -50h-700c-28 0 -50 22 -50 50v450z" />
<glyph glyph-name="6c" unicode="&#xe06c;"
d="M150 800c83 0 150 -67 150 -150c0 -66 -41 -121 -100 -141v-118c15 5 33 9 50 9h200c28 0 50 22 50 50v59c-59 20 -100 75 -100 141c0 83 67 150 150 150s150 -67 150 -150c0 -66 -41 -121 -100 -141v-59c0 -82 -68 -150 -150 -150h-200c-14 0 -25 -7 -34 -16
c50 -24 84 -74 84 -134c0 -83 -67 -150 -150 -150s-150 67 -150 150c0 66 41 121 100 141v218c-59 20 -100 75 -100 141c0 83 67 150 150 150z" />
<glyph glyph-name="6d" unicode="&#xe06d;"
d="M0 800h400l-150 -150l150 -150l-100 -100l-150 150l-150 -150v400zM500 400l150 -150l150 150v-400h-400l150 150l-150 150z" />
<glyph glyph-name="6e" unicode="&#xe06e;"
d="M100 800l150 -150l150 150v-400h-400l150 150l-150 150zM400 400h400l-150 -150l150 -150l-100 -100l-150 150l-150 -150v400z" />
<glyph glyph-name="6f" unicode="&#xe06f;"
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM400 700c-56 0 -108 -17 -153 -44l22 -19c33 -18 13 -48 -13 -59c-30 -13 -77 10 -65 -41c13 -55 -27 -3 -47 -15c-42 -26 49 -152 31 -156l-59 34c-8 0 -13 -5 -16 -10
c1 -30 10 -57 19 -84c28 -11 77 -2 100 -25c47 -28 97 -115 75 -159c34 -13 68 -22 106 -22c101 0 193 48 247 125c3 24 -8 44 -50 44c-69 0 -156 13 -153 97c2 46 101 108 66 143c-30 30 12 39 12 66c0 37 -65 32 -69 50s20 36 41 56c-30 10 -60 19 -94 19zM631 591
c-38 -11 -94 -35 -87 -53c6 -15 52 -1 65 -13c11 -10 16 -59 44 -31l22 22v3c-11 26 -26 50 -44 72z" />
<glyph glyph-name="70" unicode="&#xe070;"
d="M703 800l97 -100l-400 -400l-100 100l-200 -203l-100 100l300 303l100 -100zM0 100h800v-100h-800v100z" />
<glyph glyph-name="71" unicode="&#xe071;"
d="M0 700h100v-100h-100v100zM200 700h100v-100h-100v100zM400 700h100v-100h-100v100zM600 700h100v-100h-100v100zM0 500h100v-100h-100v100zM200 500h100v-100h-100v100zM400 500h100v-100h-100v100zM600 500h100v-100h-100v100zM0 300h100v-100h-100v100zM200 300h100
v-100h-100v100zM400 300h100v-100h-100v100zM600 300h100v-100h-100v100zM0 100h100v-100h-100v100zM200 100h100v-100h-100v100zM400 100h100v-100h-100v100zM600 100h100v-100h-100v100z" />
<glyph glyph-name="72" unicode="&#xe072;"
d="M0 800h200v-200h-200v200zM300 800h200v-200h-200v200zM600 800h200v-200h-200v200zM0 500h200v-200h-200v200zM300 500h200v-200h-200v200zM600 500h200v-200h-200v200zM0 200h200v-200h-200v200zM300 200h200v-200h-200v200zM600 200h200v-200h-200v200z" />
<glyph glyph-name="73" unicode="&#xe073;"
d="M0 800h300v-300h-300v300zM500 800h300v-300h-300v300zM0 300h300v-300h-300v300zM500 300h300v-300h-300v300z" />
<glyph glyph-name="74" unicode="&#xe074;"
d="M19 800h662c11 0 19 -8 19 -19v-331c0 -28 -22 -50 -50 -50h-600c-28 0 -50 22 -50 50v331c0 11 8 19 19 19zM0 309c16 -6 32 -9 50 -9h600c18 0 34 3 50 9v-290c0 -11 -8 -19 -19 -19h-662c-11 0 -19 8 -19 19v290zM550 200c-28 0 -50 -22 -50 -50s22 -50 50 -50
s50 22 50 50s-22 50 -50 50z" />
<glyph glyph-name="75" unicode="&#xe075;"
d="M0 700h300v-100h-50c-28 0 -50 -22 -50 -50v-150h300v150c0 28 -22 50 -50 50h-50v100h300v-100h-50c-28 0 -50 -22 -50 -50v-400c0 -28 22 -50 50 -50h50v-100h-300v100h50c28 0 50 22 50 50v150h-300v-150c0 -28 22 -50 50 -50h50v-100h-300v100h50c28 0 50 22 50 50
v400c0 28 -22 50 -50 50h-50v100z" />
<glyph glyph-name="76" unicode="&#xe076;"
d="M400 700c165 0 300 -135 300 -300v-100h50c28 0 50 -22 50 -50v-200c0 -28 -22 -50 -50 -50h-100c-28 0 -50 22 -50 50v350c0 111 -89 200 -200 200s-200 -89 -200 -200v-350c0 -28 -22 -50 -50 -50h-100c-28 0 -50 22 -50 50v200c0 28 22 50 50 50h50v100
c0 165 135 300 300 300z" />
<glyph glyph-name="77" unicode="&#xe077;"
d="M0 500c0 109 91 200 200 200s200 -91 200 -200c0 109 91 200 200 200s200 -91 200 -200c0 -55 -23 -105 -59 -141l-341 -340l-341 340c-36 36 -59 86 -59 141z" />
<glyph glyph-name="78" unicode="&#xe078;"
d="M400 700l400 -300l-100 3v-403h-200v200h-200v-200h-200v400h-100z" />
<glyph glyph-name="79" unicode="&#xe079;"
d="M0 800h800v-800h-800v800zM100 700v-300l100 100l400 -400h100v100l-200 200l100 100l100 -100v300h-600z" />
<glyph glyph-name="7a" unicode="&#xe07a;"
d="M19 800h762c11 0 19 -8 19 -19v-762c0 -11 -8 -19 -19 -19h-762c-11 0 -19 8 -19 19v762c0 11 8 19 19 19zM100 600v-300h100l100 -100h200l100 100h100v300h-600z" />
<glyph glyph-name="7b" unicode="&#xe07b;"
d="M200 600c80 0 142 -56 200 -122c58 66 119 122 200 122c131 0 200 -101 200 -200s-69 -200 -200 -200c-81 0 -142 56 -200 122c-58 -66 -121 -122 -200 -122c-131 0 -200 101 -200 200s69 200 200 200zM200 500c-74 0 -100 -54 -100 -100s26 -100 100 -100
c42 0 88 47 134 100c-46 53 -92 100 -134 100zM600 500c-43 0 -88 -47 -134 -100c46 -53 91 -100 134 -100c74 0 100 54 100 100s-26 100 -100 100z" />
<glyph glyph-name="7c" unicode="&#xe07c;" horiz-adv-x="400"
d="M300 800c55 0 100 -45 100 -100s-45 -100 -100 -100s-100 45 -100 100s45 100 100 100zM150 550c83 0 150 -69 150 -150c0 -66 -100 -214 -100 -250c0 -28 22 -50 50 -50s50 22 50 50h100c0 -83 -67 -150 -150 -150s-150 64 -150 150s100 222 100 250s-22 50 -50 50
s-50 -22 -50 -50h-100c0 83 67 150 150 150z" />
<glyph glyph-name="7d" unicode="&#xe07d;"
d="M200 800h500v-100h-122c-77 -197 -156 -392 -234 -588l-6 -12h162v-100h-500v100h122c77 197 156 392 234 588l7 12h-163v100z" />
<glyph glyph-name="7e" unicode="&#xe07e;"
d="M0 700h800v-100h-800v100zM0 500h800v-100h-800v100zM0 300h800v-100h-800v100zM100 100h600v-100h-600v100z" />
<glyph glyph-name="7f" unicode="&#xe07f;"
d="M0 700h800v-100h-800v100zM0 500h800v-100h-800v100zM0 300h800v-100h-800v100zM0 100h600v-100h-600v100z" />
<glyph glyph-name="80" unicode="&#xe080;"
d="M0 700h800v-100h-800v100zM0 500h800v-100h-800v100zM0 300h800v-100h-800v100zM200 100h600v-100h-600v100z" />
<glyph glyph-name="81" unicode="&#xe081;"
d="M550 800c138 0 250 -112 250 -250s-112 -250 -250 -250c-16 0 -32 0 -47 3l-3 -3v-100h-200v-200h-300v200l303 303c-3 15 -3 31 -3 47c0 138 112 250 250 250zM600 700c-55 0 -100 -45 -100 -100s45 -100 100 -100s100 45 100 100s-45 100 -100 100z" />
<glyph glyph-name="82" unicode="&#xe082;"
d="M134 600h3h4h4h5h500c28 0 50 -22 50 -50v-350h100v-150c0 -28 -22 -50 -50 -50h-700c-28 0 -50 22 -50 50v150h100v350v2c0 20 15 42 34 48zM200 500v-300h100v-100h200v100h100v300h-400z" />
<glyph glyph-name="83" unicode="&#xe083;"
d="M0 800h400v-400h-400v400zM500 600h100v-400h-400v100h300v300zM700 400h100v-400h-400v100h300v300z" />
<glyph glyph-name="84" unicode="&#xe084;" horiz-adv-x="600"
d="M337 694c6 4 12 7 21 7c28 0 50 -22 50 -50c0 -17 -12 -37 -27 -45l-300 -150c-8 -6 -21 -11 -31 -11c-28 0 -50 22 -50 50c0 21 16 44 37 49zM437 544c6 4 12 7 21 7c28 0 50 -22 50 -50c0 -17 -12 -37 -27 -45l-400 -200c-8 -6 -21 -11 -31 -11c-28 0 -50 22 -50 50
c0 21 16 44 37 49zM437 344c6 4 12 7 21 7c28 0 50 -22 50 -50c0 -17 -12 -37 -27 -45l-106 -56c24 -4 43 -26 43 -50c0 -28 -23 -51 -51 -51c-2 0 -6 1 -8 1h-200c-26 1 -48 24 -48 50c0 16 12 36 26 44zM151 -50c0 23 20 50 46 50h3h4h5h100c28 0 50 -22 50 -50
s-22 -50 -50 -50h-100c-2 0 -6 -1 -8 -1c-28 0 -50 23 -50 51z" />
<glyph glyph-name="85" unicode="&#xe085;"
d="M199 800h100v-200h-200v100h100v100zM586 797h1c18 1 38 1 56 -3c36 -8 69 -26 97 -54c78 -78 78 -203 0 -281l-150 -150c-8 -13 -28 -24 -43 -24c-28 0 -50 22 -50 50c0 15 11 35 24 43l150 150c40 40 39 105 0 144c-41 41 -110 34 -144 0l-44 -44
c-8 -13 -27 -24 -42 -24c-28 0 -50 22 -50 50c0 15 11 35 24 43l43 44c32 33 72 53 128 56zM208 490c4 5 14 16 22 16h3c2 0 6 1 8 1c28 0 50 -22 50 -50c0 -11 -6 -27 -14 -35l-150 -150c-40 -40 -39 -105 0 -144c41 -41 110 -34 144 0l44 44c8 13 27 24 42 24
c28 0 50 -22 50 -50c0 -15 -11 -35 -24 -43l-43 -44c-22 -22 -48 -37 -75 -47c-70 -25 -151 -9 -207 47c-78 78 -78 203 0 281zM499 200h200v-100h-100v-100h-100v200z" />
<glyph glyph-name="86" unicode="&#xe086;"
d="M586 797c18 1 39 1 57 -3c36 -8 69 -26 97 -54c78 -78 78 -203 0 -281l-150 -150c-62 -62 -132 -81 -182 -78s-69 17 -84 25s-26 27 -26 44c0 28 22 51 50 51c8 0 19 -3 26 -7c0 0 15 -11 41 -13s62 3 106 47l150 150c40 40 39 105 0 144c-41 41 -110 34 -144 0
c-8 -13 -28 -24 -43 -24c-28 0 -50 22 -50 50c0 15 11 35 24 43c32 33 72 53 128 56zM386 566c50 -2 64 -17 85 -22s37 -28 37 -49c0 -28 -22 -50 -50 -50c-10 0 -23 5 -31 11c0 0 -19 9 -47 10s-63 -4 -103 -44l-150 -150c-40 -40 -39 -105 0 -144c41 -41 110 -34 144 0
c8 13 27 24 42 24c28 0 50 -22 50 -50c0 -15 -10 -35 -23 -43c-22 -22 -48 -37 -75 -47c-70 -25 -151 -9 -207 47c-78 78 -78 203 0 281l150 150c60 60 128 78 178 76z" />
<glyph glyph-name="87" unicode="&#xe087;"
d="M0 700h300v-300h-300v300zM400 700h400v-100h-400v100zM400 500h300v-100h-300v100zM0 300h300v-300h-300v300zM400 300h400v-100h-400v100zM400 100h300v-100h-300v100z" />
<glyph glyph-name="88" unicode="&#xe088;"
d="M50 700c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM200 700h600v-100h-600v100zM50 500c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM200 500h600v-100h-600v100zM50 300c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50
s22 50 50 50zM200 300h600v-100h-600v100zM50 100c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM200 100h600v-100h-600v100z" />
<glyph glyph-name="89" unicode="&#xe089;"
d="M800 800l-400 -800l-100 300l-300 100z" />
<glyph glyph-name="8a" unicode="&#xe08a;" horiz-adv-x="600"
d="M300 700c110 0 200 -90 200 -200v-100h100v-400h-600v400h100v100c0 110 90 200 200 200zM300 600c-56 0 -100 -44 -100 -100v-100h200v100c0 56 -44 100 -100 100z" />
<glyph glyph-name="8b" unicode="&#xe08b;" horiz-adv-x="600"
d="M300 800c110 0 200 -90 200 -200v-200h100v-400h-600v400h400v200c0 56 -44 100 -100 100s-100 -44 -100 -100h-100c0 110 90 200 200 200z" />
<glyph glyph-name="8c" unicode="&#xe08c;"
d="M400 700v-100c-111 0 -200 -89 -200 -200h100l-150 -200l-150 200h100c0 165 135 300 300 300zM650 600l150 -200h-100c0 -165 -135 -300 -300 -300v100c111 0 200 89 200 200h-100z" />
<glyph glyph-name="8d" unicode="&#xe08d;"
d="M100 800h600v-300h100l-150 -250l-150 250h100v200h-400v-100h-100v200zM150 550l150 -250h-100v-200h400v100h100v-200h-600v300h-100z" />
<glyph glyph-name="8e" unicode="&#xe08e;"
d="M600 700l200 -150l-200 -150v100h-500v-100h-100v100c0 55 45 100 100 100h500v100zM200 300v-100h500v100h100v-100c0 -55 -45 -100 -100 -100h-500v-100l-200 150z" />
<glyph glyph-name="8f" unicode="&#xe08f;" horiz-adv-x="900"
d="M350 800c193 0 350 -157 350 -350c0 -60 -17 -117 -44 -166c5 -3 12 -8 16 -12l100 -100c16 -16 30 -49 30 -72c0 -56 -46 -102 -102 -102c-23 0 -56 14 -72 30l-100 100c-4 3 -9 9 -12 13c-49 -26 -107 -41 -166 -41c-193 0 -350 157 -350 350s157 350 350 350zM350 200
c142 0 250 108 250 250c0 139 -111 250 -250 250s-250 -111 -250 -250s111 -250 250 -250z" />
<glyph glyph-name="90" unicode="&#xe090;" horiz-adv-x="600"
d="M300 800c166 0 300 -134 300 -300c0 -200 -300 -500 -300 -500s-300 300 -300 500c0 166 134 300 300 300zM300 700c-110 0 -200 -90 -200 -200s90 -200 200 -200s200 90 200 200s-90 200 -200 200z" />
<glyph glyph-name="91" unicode="&#xe091;" horiz-adv-x="900"
d="M0 800h800v-541c1 -3 1 -8 1 -11s0 -7 -1 -10v-238h-800v800zM495 250c0 26 22 50 50 50h5h150v400h-600v-600h600v100h-150h-5c-28 0 -50 22 -50 50zM350 600c83 0 150 -67 150 -150c0 -100 -150 -250 -150 -250s-150 150 -150 250c0 83 67 150 150 150zM350 500
c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
<glyph glyph-name="92" unicode="&#xe092;" horiz-adv-x="600"
d="M0 700h200v-600h-200v600zM400 700h200v-600h-200v600z" />
<glyph glyph-name="93" unicode="&#xe093;" horiz-adv-x="600"
d="M0 700l600 -300l-600 -300v600z" />
<glyph glyph-name="94" unicode="&#xe094;" horiz-adv-x="600"
d="M300 700c166 0 300 -134 300 -300s-134 -300 -300 -300s-300 134 -300 300s134 300 300 300z" />
<glyph glyph-name="95" unicode="&#xe095;"
d="M400 700v-600l-400 300zM400 400l400 300v-600z" />
<glyph glyph-name="96" unicode="&#xe096;"
d="M0 700l400 -300l-400 -300v600zM400 100v600l400 -300z" />
<glyph glyph-name="97" unicode="&#xe097;"
d="M0 700h200v-600h-200v600zM200 400l500 300v-600z" />
<glyph glyph-name="98" unicode="&#xe098;"
d="M0 700l500 -300l-500 -300v600zM500 100v600h200v-600h-200z" />
<glyph glyph-name="99" unicode="&#xe099;" horiz-adv-x="600"
d="M0 700h600v-600h-600v600z" />
<glyph glyph-name="9a" unicode="&#xe09a;"
d="M200 800h400v-200h200v-400h-200v-200h-400v200h-200v400h200v200z" />
<glyph glyph-name="9b" unicode="&#xe09b;"
d="M0 700h800v-100h-800v100zM0 403h800v-100h-800v100zM0 103h800v-100h-800v100z" />
<glyph glyph-name="9c" unicode="&#xe09c;" horiz-adv-x="600"
d="M278 700c7 2 13 4 22 4c55 0 100 -45 100 -100v-4v-200c0 -55 -45 -100 -100 -100s-100 45 -100 100v200v2c0 44 35 88 78 98zM34 500h4h3c3 0 6 1 9 1c28 0 50 -22 50 -50v-1v-50c0 -111 89 -200 200 -200s200 89 200 200v50c0 28 22 50 50 50s50 -22 50 -50v-50
c0 -148 -109 -270 -250 -294v-106h50c55 0 100 -45 100 -100h-400c0 55 45 100 100 100h50v106c-141 24 -250 146 -250 294v50v2c0 20 15 42 34 48z" />
<glyph glyph-name="9d" unicode="&#xe09d;"
d="M0 500h800v-200h-800v200z" />
<glyph glyph-name="9e" unicode="&#xe09e;"
d="M34 700h4h3h4h5h700c28 0 50 -22 50 -50v-500c0 -28 -22 -50 -50 -50h-250v-100h100c55 0 100 -45 100 -100h-600c0 55 45 100 100 100h100v100h-250c-28 0 -50 22 -50 50v500v2c0 20 15 42 34 48zM100 600v-400h600v400h-600z" />
<glyph glyph-name="9f" unicode="&#xe09f;"
d="M272 700c-14 -40 -22 -83 -22 -128c0 -221 179 -400 400 -400c45 0 88 8 128 22c-53 -158 -202 -272 -378 -272c-221 0 -400 179 -400 400c0 176 114 325 272 378z" />
<glyph glyph-name="a0" unicode="&#xe0a0;"
d="M350 700l150 -150h-100v-150h150v100l150 -150l-150 -150v100h-150v-150h100l-150 -150l-150 150h100v150h-150v-100l-150 150l150 150v-100h150v150h-100z" />
<glyph glyph-name="a1" unicode="&#xe0a1;"
d="M800 800v-550c0 -83 -67 -150 -150 -150s-150 67 -150 150s67 150 150 150c17 0 35 -4 50 -9v206c-201 -6 -327 -27 -400 -50v-397c0 -83 -67 -150 -150 -150s-150 67 -150 150s67 150 150 150c17 0 35 -4 50 -9v409s100 100 600 100z" />
<glyph glyph-name="a2" unicode="&#xe0a2;" horiz-adv-x="700"
d="M499 700c51 0 102 -20 141 -59c78 -78 78 -203 0 -281l-250 -244c-48 -48 -127 -48 -175 0s-48 127 0 175l96 97l69 -69l-90 -94l-7 -3c-10 -10 -10 -28 0 -38s28 -10 38 0l250 247c37 40 39 102 0 141s-104 40 -144 0l-278 -275c-66 -69 -68 -179 0 -247
c69 -69 181 -69 250 0l9 12l116 113l69 -69l-125 -125c-107 -107 -281 -107 -388 0s-107 281 0 388l278 272c39 39 90 59 141 59z" />
<glyph glyph-name="a3" unicode="&#xe0a3;"
d="M600 800l200 -200l-100 -100l-200 200zM400 600l200 -200l-400 -400h-200v200z" />
<glyph glyph-name="a4" unicode="&#xe0a4;"
d="M550 800c83 0 150 -90 150 -200s-67 -200 -150 -200c-22 0 -40 8 -59 19c6 26 9 52 9 81c0 84 -27 158 -72 212c27 52 71 88 122 88zM250 700c83 0 150 -90 150 -200s-67 -200 -150 -200s-150 90 -150 200s67 200 150 200zM725 384c44 -22 75 -66 75 -118v-166h-200v66
c0 50 -17 96 -44 134c66 2 126 33 169 84zM75 284c45 -53 106 -84 175 -84s130 31 175 84c44 -22 75 -66 75 -118v-166h-500v166c0 52 31 96 75 118z" />
<glyph glyph-name="a5" unicode="&#xe0a5;"
d="M400 800c110 0 200 -112 200 -250s-90 -250 -200 -250s-200 112 -200 250s90 250 200 250zM191 300c54 -61 128 -100 209 -100s155 39 209 100c106 -5 191 -92 191 -200v-100h-800v100c0 108 85 195 191 200z" />
<glyph glyph-name="a6" unicode="&#xe0a6;" horiz-adv-x="600"
d="M19 800h462c11 0 19 -8 19 -19v-762c0 -11 -8 -19 -19 -19h-462c-11 0 -19 8 -19 19v762c0 11 8 19 19 19zM100 700v-500h300v500h-300zM250 150c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
<glyph glyph-name="a7" unicode="&#xe0a7;"
d="M350 800c17 0 34 -1 50 -3v-397l-297 297c63 64 150 103 247 103zM500 694c169 -25 300 -168 300 -344c0 -193 -157 -350 -350 -350c-85 0 -161 31 -222 81l272 272v341zM91 562l237 -234l-212 -212c-70 55 -116 138 -116 234c0 84 35 158 91 212z" />
<glyph glyph-name="a8" unicode="&#xe0a8;"
d="M92 650c0 23 20 50 46 50h3h4h5h400c28 0 50 -22 50 -50s-22 -50 -50 -50h-50v-200h100c55 0 100 -45 100 -100h-300v-300l-56 -100l-44 100v300h-300c0 55 45 100 100 100h100v200h-50c-2 0 -6 -1 -8 -1c-28 0 -50 23 -50 51z" />
<glyph glyph-name="a9" unicode="&#xe0a9;"
d="M400 800c221 0 400 -179 400 -400s-179 -400 -400 -400s-400 179 -400 400s179 400 400 400zM300 600v-400l300 200z" />
<glyph glyph-name="aa" unicode="&#xe0aa;"
d="M300 800h200v-300h300v-200h-300v-300h-200v300h-300v200h300v300z" />
<glyph glyph-name="ab" unicode="&#xe0ab;"
d="M300 800h100v-400h-100v400zM172 656l62 -78l-40 -31c-58 -46 -94 -117 -94 -197c0 -139 111 -250 250 -250s250 111 250 250c0 80 -39 151 -97 197l-37 31l62 78l38 -31c82 -64 134 -164 134 -275c0 -193 -157 -350 -350 -350s-350 157 -350 350c0 111 53 211 134 275z
" />
<glyph glyph-name="ac" unicode="&#xe0ac;"
d="M200 800h400v-200h-400v200zM9 500h782c6 0 9 -3 9 -9v-282c0 -6 -3 -9 -9 -9h-91v200h-600v-200h-91c-6 0 -9 3 -9 9v282c0 6 3 9 9 9zM200 300h400v-300h-400v300z" />
<glyph glyph-name="ad" unicode="&#xe0ad;"
d="M0 700h100v-700h-100v700zM700 700h100v-700h-100v700zM200 600h200v-100h-200v100zM300 400h200v-100h-200v100zM400 200h200v-100h-200v100z" />
<glyph glyph-name="ae" unicode="&#xe0ae;"
d="M325 700c42 -141 87 -280 131 -419c29 74 59 148 88 222c30 -57 58 -114 87 -172h169v-100h-231l-13 28c-37 -92 -74 -184 -112 -275c-38 129 -79 257 -119 385c-42 -133 -83 -267 -125 -400c-28 88 -56 175 -84 262h-116v100h188l9 -34l3 -6c42 137 83 273 125 409z" />
<glyph glyph-name="af" unicode="&#xe0af;"
d="M200 600c0 57 43 100 100 100s100 -43 100 -100c0 -28 -18 -48 -28 -72c-3 -6 -3 -16 -3 -28h231v-231c12 0 22 0 28 3c24 10 44 28 72 28c57 0 100 -43 100 -100s-43 -100 -100 -100c-28 0 -48 18 -72 28c-6 3 -16 3 -28 3v-231h-231c0 12 0 22 3 28c10 24 28 44 28 72
c0 57 -43 100 -100 100s-100 -43 -100 -100c0 -28 18 -48 28 -72c3 -6 3 -16 3 -28h-231v600h231c0 12 0 22 -3 28c-10 24 -28 44 -28 72z" />
<glyph glyph-name="b0" unicode="&#xe0b0;" horiz-adv-x="500"
d="M247 700c84 0 148 -20 191 -59s59 -93 59 -141c0 -117 -69 -181 -119 -225s-81 -67 -81 -150v-25h-100v25c0 117 65 181 115 225s85 67 85 150c0 25 -8 48 -28 66s-56 34 -122 34s-97 -18 -116 -37s-27 -43 -31 -69l-100 12c5 38 19 88 59 128s103 66 188 66zM197 0h100
v-100h-100v100z" />
<glyph glyph-name="b1" unicode="&#xe0b1;"
d="M450 800c138 0 250 -112 250 -250v-50c58 -21 100 -85 100 -150c0 -69 -48 -127 -112 -144c-22 55 -75 94 -138 94c-20 0 -39 -5 -56 -12c-17 64 -75 112 -144 112s-127 -48 -144 -112c-17 7 -36 12 -56 12c-37 0 -71 -12 -97 -34c-33 36 -53 82 -53 134
c0 110 90 200 200 200c23 114 129 200 250 200zM334 300h4h3c3 0 6 1 9 1c28 0 50 -22 50 -50v-1v-200c0 -28 -22 -50 -50 -50s-50 22 -50 50v200v2c0 20 15 42 34 48zM134 200h4h3c3 0 6 1 9 1c28 0 50 -22 50 -50v-1v-100c0 -28 -22 -50 -50 -50s-50 22 -50 50v100v2
c0 20 15 42 34 48zM534 200h3h4c3 0 6 1 9 1c28 0 50 -22 50 -50v-1v-100c0 -28 -22 -50 -50 -50s-50 22 -50 50v100v2c0 20 15 42 34 48z" />
<glyph glyph-name="b2" unicode="&#xe0b2;"
d="M600 800l200 -150l-200 -150v100h-50l-153 -191l175 -206l6 -3h22v100l200 -150l-200 -150v100h-25c-35 0 -56 12 -78 38l-166 190l-153 -190c-22 -27 -43 -38 -78 -38h-100v100h100l166 206l-163 191l-3 3h-100v100h100c34 0 56 -12 78 -38l153 -178l141 178
c22 27 43 38 78 38h50v100z" />
<glyph glyph-name="b3" unicode="&#xe0b3;"
d="M400 800c110 0 209 -47 281 -119l119 119v-300h-300l109 109c-54 55 -126 91 -209 91c-166 0 -300 -134 -300 -300s134 -300 300 -300c83 0 158 34 212 88l72 -72c-72 -72 -174 -116 -284 -116c-220 0 -400 180 -400 400s180 400 400 400z" />
<glyph glyph-name="b4" unicode="&#xe0b4;"
d="M400 800h400v-400l-166 166l-400 -400l166 -166h-400v400l166 -166l400 400z" />
<glyph glyph-name="b5" unicode="&#xe0b5;" horiz-adv-x="600"
d="M250 800l250 -300h-200v-200h200l-250 -300l-250 300h200v200h-200z" />
<glyph glyph-name="b6" unicode="&#xe0b6;"
d="M300 600v-200h200v200l300 -250l-300 -250v200h-200v-200l-300 250z" />
<glyph glyph-name="b7" unicode="&#xe0b7;"
d="M0 800c441 0 800 -359 800 -800h-200c0 333 -267 600 -600 600v200zM0 500c275 0 500 -225 500 -500h-200c0 167 -133 300 -300 300v200zM0 200c110 0 200 -90 200 -200h-200v200z" />
<glyph glyph-name="b8" unicode="&#xe0b8;"
d="M100 800c386 0 700 -314 700 -700h-100c0 332 -268 600 -600 600v100zM100 600c276 0 500 -224 500 -500h-100c0 222 -178 400 -400 400v100zM100 400c165 0 300 -135 300 -300h-100c0 111 -89 200 -200 200v100zM100 200c55 0 100 -45 100 -100s-45 -100 -100 -100
s-100 45 -100 100s45 100 100 100z" />
<glyph glyph-name="b9" unicode="&#xe0b9;"
d="M300 800h400c55 0 100 -45 100 -100v-200h-400v150c0 28 -22 50 -50 50s-50 -22 -50 -50v-250h400v-300c0 -55 -45 -100 -100 -100h-500c-55 0 -100 45 -100 100v200h100v-150c0 -28 22 -50 50 -50s50 22 50 50v550c0 55 45 100 100 100z" />
<glyph glyph-name="ba" unicode="&#xe0ba;"
d="M75 700h225v-100h-200v-500h400v100h100v-125c0 -41 -34 -75 -75 -75h-450c-41 0 -75 34 -75 75v550c0 41 34 75 75 75zM600 700l200 -200l-200 -200v100h-200c-94 0 -173 -65 -194 -153c23 199 189 353 394 353v100z" />
<glyph glyph-name="bb" unicode="&#xe0bb;"
d="M500 700l300 -284l-300 -316v200h-100c-200 0 -348 -102 -400 -300c0 295 100 500 500 500v200z" />
<glyph glyph-name="bc" unicode="&#xe0bc;"
d="M381 791l19 9l19 -9c127 -53 253 -108 381 -160v-31c0 -166 -67 -313 -147 -419c-40 -53 -83 -97 -125 -128s-82 -53 -128 -53s-86 22 -128 53s-85 75 -125 128c-80 107 -147 253 -147 419v31c128 52 254 107 381 160zM400 100v591l-294 -122c8 -126 58 -243 122 -328
c35 -46 73 -86 106 -110s62 -31 66 -31z" />
<glyph glyph-name="bd" unicode="&#xe0bd;"
d="M600 800h100v-800h-100v800zM400 700h100v-700h-100v700zM200 500h100v-500h-100v500zM0 300h100v-300h-100v300z" />
<glyph glyph-name="be" unicode="&#xe0be;"
d="M300 800h100v-200h200l100 -100l-100 -100h-200v-400h-100v500h-200l-100 100l100 100h200v100z" />
<glyph glyph-name="bf" unicode="&#xe0bf;"
d="M200 800h100v-600h200l-250 -200l-250 200h200v600zM400 800h200v-100h-200v100zM400 600h300v-100h-300v100zM400 400h400v-100h-400v100z" />
<glyph glyph-name="c0" unicode="&#xe0c0;"
d="M200 800h100v-600h200l-250 -200l-250 200h200v600zM400 800h400v-100h-400v100zM400 600h300v-100h-300v100zM400 400h200v-100h-200v100z" />
<glyph glyph-name="c1" unicode="&#xe0c1;"
d="M75 700h650c41 0 75 -34 75 -75v-550c0 -41 -34 -75 -75 -75h-650c-41 0 -75 34 -75 75v550c0 41 34 75 75 75zM100 600v-100h100v100h-100zM300 600v-100h400v100h-400zM100 400v-100h100v100h-100zM300 400v-100h400v100h-400zM100 200v-100h100v100h-100zM300 200
v-100h400v100h-400z" />
<glyph glyph-name="c2" unicode="&#xe0c2;"
d="M400 800l100 -300h300l-250 -200l100 -300l-250 200l-250 -200l100 300l-250 200h300z" />
<glyph glyph-name="c3" unicode="&#xe0c3;"
d="M400 800c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM150 700c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM650 700c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM400 600c110 0 200 -90 200 -200
s-90 -200 -200 -200s-200 90 -200 200s90 200 200 200zM50 450c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM750 450c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM150 200c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50
s22 50 50 50zM650 200c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50zM400 100c28 0 50 -22 50 -50s-22 -50 -50 -50s-50 22 -50 50s22 50 50 50z" />
<glyph glyph-name="c4" unicode="&#xe0c4;"
d="M34 800h632c18 0 34 -16 34 -34v-732c0 -18 -16 -34 -34 -34h-632c-18 0 -34 16 -34 34v732c0 18 16 34 34 34zM100 700v-500h500v500h-500zM350 150c-38 0 -63 -42 -44 -75s69 -33 88 0s-6 75 -44 75z" />
<glyph glyph-name="c5" unicode="&#xe0c5;"
d="M0 800h300l500 -500l-300 -300l-500 500v300zM200 700c-55 0 -100 -45 -100 -100s45 -100 100 -100s100 45 100 100s-45 100 -100 100z" />
<glyph glyph-name="c6" unicode="&#xe0c6;"
d="M0 600h200l300 -300l-200 -200l-300 300v200zM340 600h160l300 -300l-200 -200l-78 78l119 122zM150 500c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
<glyph glyph-name="c7" unicode="&#xe0c7;"
d="M400 800c220 0 400 -180 400 -400s-180 -400 -400 -400s-400 180 -400 400s180 400 400 400zM400 700c-166 0 -300 -134 -300 -300s134 -300 300 -300s300 134 300 300s-134 300 -300 300zM400 600c110 0 200 -90 200 -200s-90 -200 -200 -200s-200 90 -200 200
s90 200 200 200zM400 500c-56 0 -100 -44 -100 -100s44 -100 100 -100s100 44 100 100s-44 100 -100 100z" />
<glyph glyph-name="c8" unicode="&#xe0c8;"
d="M0 700h559l-100 -100h-359v-500h500v159l100 100v-359h-700v700zM700 700l100 -100l-400 -400l-200 200l100 100l100 -100z" />
<glyph glyph-name="c9" unicode="&#xe0c9;"
d="M9 800h782c6 0 9 -3 9 -9v-782c0 -6 -3 -9 -9 -9h-782c-6 0 -9 3 -9 9v782c0 6 3 9 9 9zM150 722l-72 -72l100 -100l-100 -100l72 -72l172 172zM400 500v-100h300v100h-300z" />
<glyph glyph-name="ca" unicode="&#xe0ca;"
d="M0 800h800v-200h-50c0 55 -45 100 -100 100h-150v-550c0 -28 22 -50 50 -50h50v-100h-400v100h50c28 0 50 22 50 50v550h-150c-55 0 -100 -45 -100 -100h-50v200z" />
<glyph glyph-name="cb" unicode="&#xe0cb;"
d="M0 700h100v-400h-100v400zM200 700h350c21 0 39 -13 47 -31c0 0 103 -291 103 -319s-22 -50 -50 -50h-150c-28 0 -50 -25 -50 -50s39 -158 47 -184s-5 -55 -31 -63s-52 5 -66 31s-109 219 -128 238s-44 28 -72 28v400z" />
<glyph glyph-name="cc" unicode="&#xe0cc;"
d="M400 666c10 19 28 32 47 34l19 -3c26 -8 39 -37 31 -63s-47 -159 -47 -184s22 -50 50 -50h150c28 0 50 -22 50 -50s-103 -319 -103 -319c-8 -18 -26 -31 -47 -31h-350v400c28 0 53 9 72 28s114 212 128 238zM0 400h100v-400h-100v400z" />
<glyph glyph-name="cd" unicode="&#xe0cd;"
d="M200 700h300v-100h-100v-6c25 -4 50 -8 72 -16l-34 -94c-28 11 -58 16 -88 16c-139 0 -250 -111 -250 -250s111 -250 250 -250s250 111 250 250c0 31 -5 60 -16 88l91 37c14 -38 25 -81 25 -125c0 -193 -157 -350 -350 -350s-350 157 -350 350c0 176 130 323 300 347v3
h-100v100zM700 584c0 0 -296 -348 -316 -368s-48 -20 -68 0s-20 48 0 68s384 300 384 300z" />
<glyph glyph-name="ce" unicode="&#xe0ce;"
d="M600 700l200 -150l-200 -150v100h-600v100h600v100zM200 300v-100h600v-100h-600v-100l-200 150z" />
<glyph glyph-name="cf" unicode="&#xe0cf;"
d="M300 800h100c55 0 100 -45 100 -100h100c55 0 100 -45 100 -100h-700c0 55 45 100 100 100h100c0 55 45 100 100 100zM100 500h100v-350c0 -28 22 -50 50 -50s50 22 50 50v350h100v-350c0 -28 22 -50 50 -50s50 22 50 50v350h100v-481c0 -11 -8 -19 -19 -19h-462
c-11 0 -19 8 -19 19v481z" />
<glyph glyph-name="d0" unicode="&#xe0d0;"
d="M100 800h200v-400c0 -55 45 -100 100 -100s100 45 100 100v400h100v-400c0 -110 -90 -200 -200 -200h-50c-138 0 -250 90 -250 200v400zM0 100h700v-100h-700v100z" />
<glyph glyph-name="d1" unicode="&#xe0d1;"
d="M9 700h182c6 0 9 -3 9 -9v-482c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v482c0 6 3 9 9 9zM609 700h182c6 0 9 -3 9 -9v-482c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v482c0 6 3 9 9 9zM309 500h182c6 0 9 -3 9 -9v-282c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v282
c0 6 3 9 9 9zM0 100h800v-100h-800v100z" />
<glyph glyph-name="d2" unicode="&#xe0d2;"
d="M10 700h181c6 0 9 -3 9 -9v-191h-200v191c0 6 4 9 10 9zM610 700h181c6 0 9 -3 9 -9v-191h-200v191c0 6 5 9 10 9zM310 600h181c6 0 9 -3 9 -9v-91h-200v91c0 6 4 9 10 9zM0 400h800v-100h-800v100zM0 200h200v-191c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v191zM300 200
h200v-91c0 -6 -3 -9 -9 -9h-181c-6 0 -10 3 -10 9v91zM600 200h200v-191c0 -6 -3 -9 -9 -9h-181c-6 0 -10 3 -10 9v191z" />
<glyph glyph-name="d3" unicode="&#xe0d3;"
d="M0 700h800v-100h-800v100zM9 500h182c6 0 9 -3 9 -9v-482c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v482c0 6 3 9 9 9zM309 500h182c6 0 9 -3 9 -9v-282c0 -6 -3 -9 -9 -9h-182c-6 0 -9 3 -9 9v282c0 6 3 9 9 9zM609 500h182c6 0 9 -3 9 -9v-482c0 -6 -3 -9 -9 -9h-182
c-6 0 -9 3 -9 9v482c0 6 3 9 9 9z" />
<glyph glyph-name="d4" unicode="&#xe0d4;"
d="M50 600h500c28 0 50 -22 50 -50v-150l100 100h100v-300h-100l-100 100v-150c0 -28 -22 -50 -50 -50h-500c-28 0 -50 22 -50 50v400c0 28 22 50 50 50z" />
<glyph glyph-name="d5" unicode="&#xe0d5;"
d="M334 800h66v-800h-66l-134 200h-200v400h200zM500 600v100c26 0 52 -4 75 -10c130 -33 225 -150 225 -290s-95 -258 -225 -291h-3c-23 -6 -47 -9 -72 -9v100c17 0 34 2 50 6c86 22 150 100 150 194s-64 172 -150 194c-16 4 -33 6 -50 6zM500 500l25 -3
c44 -11 75 -51 75 -97s-32 -86 -75 -97l-25 -3v200z" />
<glyph glyph-name="d6" unicode="&#xe0d6;" horiz-adv-x="600"
d="M334 800h66v-800h-66l-134 200h-200v400h200zM500 500l25 -3c44 -11 75 -51 75 -97s-32 -86 -75 -97l-25 -3v200z" />
<glyph glyph-name="d7" unicode="&#xe0d7;" horiz-adv-x="400"
d="M334 800h66v-800h-66l-134 200h-200v400h200z" />
<glyph glyph-name="d8" unicode="&#xe0d8;"
d="M309 800h82c6 0 10 -4 12 -9l294 -682l3 -19v-81c0 -6 -3 -9 -9 -9h-682c-6 0 -9 3 -9 9v81l3 19l294 682c2 5 6 9 12 9zM300 500v-200h100v200h-100zM300 200v-100h100v100h-100z" />
<glyph glyph-name="d9" unicode="&#xe0d9;"
d="M375 800c138 0 269 -39 378 -109l-53 -82c-93 60 -205 91 -325 91c-119 0 -229 -32 -322 -91l-53 82c109 70 237 109 375 109zM375 500c78 0 154 -23 216 -62l-53 -85c-46 30 -104 47 -163 47c-60 0 -112 -17 -159 -47l-54 85c62 40 134 62 213 62zM375 200
c55 0 100 -45 100 -100s-45 -100 -100 -100s-100 45 -100 100s45 100 100 100z" />
<glyph glyph-name="da" unicode="&#xe0da;" horiz-adv-x="900"
d="M551 800c16 0 32 0 47 -3l-97 -97v-200h200l97 97c3 -15 3 -31 3 -47c0 -138 -112 -250 -250 -250c-32 0 -62 8 -90 19l-288 -291c-20 -20 -46 -28 -72 -28s-52 8 -72 28c-39 39 -39 105 0 144l291 287c-11 28 -19 59 -19 91c0 138 112 250 250 250zM101 150
c-28 0 -50 -22 -50 -50s22 -50 50 -50s50 22 50 50s-22 50 -50 50z" />
<glyph glyph-name="db" unicode="&#xe0db;"
d="M141 700c84 -84 169 -167 253 -250c82 83 167 165 247 250l143 -141l-253 -253c84 -82 167 -166 253 -247l-143 -143c-81 86 -165 169 -247 253l-253 -253l-141 143c85 80 167 164 250 247c-83 84 -166 169 -250 253z" />
<glyph glyph-name="dc" unicode="&#xe0dc;"
d="M0 800h100l231 -300h38l231 300h100l-225 -300h225v-100h-300v-100h300v-100h-300v-200h-100v200h-300v100h300v100h-300v100h225z" />
<glyph glyph-name="dd" unicode="&#xe0dd;" horiz-adv-x="900"
d="M350 800c193 0 350 -157 350 -350c0 -61 -17 -119 -44 -169c4 -2 10 -6 13 -9l103 -100c16 -16 30 -49 30 -72c0 -56 -46 -102 -102 -102c-23 0 -56 14 -72 30l-100 103c-3 3 -7 9 -9 13c-50 -28 -108 -44 -169 -44c-193 0 -350 157 -350 350s157 350 350 350zM350 700
c-139 0 -250 -111 -250 -250s111 -250 250 -250c62 0 119 23 163 60c7 11 19 25 31 31l3 3c34 43 53 97 53 156c0 139 -111 250 -250 250zM300 600h100v-100h100v-100h-100v-100h-100v100h-100v100h100v100z" />
<glyph glyph-name="de" unicode="&#xe0de;" horiz-adv-x="900"
d="M350 800c193 0 350 -157 350 -350c0 -61 -17 -119 -44 -169c4 -2 10 -6 13 -9l103 -100c16 -16 30 -49 30 -72c0 -56 -46 -102 -102 -102c-23 0 -56 14 -72 30l-100 103c-3 3 -7 9 -9 13c-50 -28 -108 -44 -169 -44c-193 0 -350 157 -350 350s157 350 350 350zM350 700
c-139 0 -250 -111 -250 -250s111 -250 250 -250c62 0 119 23 163 60c7 11 19 25 31 31l3 3c34 43 53 97 53 156c0 139 -111 250 -250 250zM200 500h300v-100h-300v100z" />
</font>
</defs></svg>

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,9 @@
.autocomplete-suggestions {
text-align: left; cursor: default; border: 1px solid #ccc; border-top: 0; background: #fff; box-shadow: -1px 1px 3px rgba(0,0,0,.1);
/* core styles should not be changed */
position: absolute; display: none; z-index: 9999; max-height: 254px; overflow: hidden; overflow-y: auto; box-sizing: border-box;
}
.autocomplete-suggestion { position: relative; padding: 0 .6em; line-height: 23px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1.02em; color: #333; }
.autocomplete-suggestion b { font-weight: normal; color: #1f8dd6; }
.autocomplete-suggestion.selected { background: #f0f0f0; }

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,7 @@
function showAlert(text) { function showAlert(text) {
console.log("[INFO] Function showAlert() called."); console.log("[INFO] Function showAlert() called.");
$("#alert").html(text); $("#alert").html(text);
$("#alert").slideDown().delay(<?php echo ALERT_DISAPPEAR_IN*1000 ?>).slideUp(); $("#alert").slideDown().delay(<?php echo $GLOBALS['ALERT_DISSAPEAR_IN']*1000 ?>).slideUp();
} }
<?php if (Alert::defined()): ?> <?php if (Alert::defined()): ?>

View File

@ -1,19 +1,18 @@
<?php <?php
// Preload the first 10 files to not call via AJAX when the user open the first time the media manager // 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); $listOfFiles = Filesystem::listFiles(PATH_UPLOADS_THUMBNAILS, '*', '*', $GLOBALS['BLUDIT_MEDIA_MANAGER_SORT_BY_DATE'], false);
$listOfFilesByPage = array_chunk($listOfFiles, $GLOBALS['BLUDIT_MEDIA_MANAGER_AMOUNT_OF_FILES']);
$preLoadFiles = array(); $preLoadFiles = array();
if (!empty($listOfFilesByPage[0])) { if (!empty($listOfFilesByPage[0])) {
foreach ($listOfFilesByPage[0] as $file) { foreach ($listOfFilesByPage[0] as $file) {
$filename = Filesystem::filename($file); array_push($preLoadFiles, basename($file));
array_push($preLoadFiles, $filename);
} }
} }
// Amount of pages for the paginator // Amount of pages for the paginator
$numberOfPages = count($listOfFilesByPage); $amountOfPages = count($listOfFilesByPage);
?> ?>
<div id="jsmediaManagerModal" class="modal" tabindex="-1" role="dialog"> <div id="jsbluditMediaModal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="container-fluid"> <div class="container-fluid">
@ -23,35 +22,42 @@ $numberOfPages = count($listOfFilesByPage);
<!-- <!--
UPLOAD INPUT UPLOAD INPUT
--> -->
<h3 class="mt-2 mb-3"><i class="fa fa-image"></i> <?php $L->p('Images'); ?></h3> <h3 class="mt-2 mb-3">Upload</h3>
<div id="jsalertMedia" class="alert alert-warning d-none" role="alert"></div>
<!-- Form and Input file --> <!-- Form and Input file -->
<form name="bluditFormUpload" id="jsbluditFormUpload" enctype="multipart/form-data"> <form name="bluditFormUpload" id="jsbluditFormUpload" enctype="multipart/form-data">
<input type="hidden" name="tokenCSRF" value="<?php echo $security->getTokenCSRF() ?>">
<div class="custom-file"> <div class="custom-file">
<input type="file" class="custom-file-input" id="jsimages" name="images[]" multiple> <input type="file" class="custom-file-input" id="jsbluditInputFiles" name="bluditInputFiles[]" multiple>
<label class="custom-file-label" for="jsimages"><?php $L->p('Choose images to upload'); ?></label> <label class="custom-file-label" for="jsbluditInputFiles">Choose images</label>
</div> </div>
</form> </form>
<!-- Progress bar --> <!-- Progress bar -->
<div class="progress mt-2"> <div class="progress mt-2">
<div id="jsbluditProgressBar" class="progress-bar bg-primary" role="progressbar" style="width:0%"></div> <div id="jsbluditProgressBar" class="progress-bar bg-info" role="progressbar" style="width:0%"></div>
</div> </div>
<!-- <!--
IMAGES LIST MANAGER
--> -->
<h3 class="mt-4 mb-3">Manage</h3>
<!-- Table for list files --> <!-- Table for list files -->
<table id="jsbluditMediaTable" class="table mt-2"> <table id="jsbluditMediaTable" class="table">
<tr> <tr>
<td><?php $L->p('There are no images'); ?></td> <td>There are not images.</td>
</tr> </tr>
</table> </table>
<!-- Paginator --> <!-- Paginator -->
<nav id="jsbluditMediaTablePagination"></nav> <nav>
<ul class="pagination justify-content-center">
<?php for ($i=1; $i<=$amountOfPages; $i++): ?>
<li class="page-item"><button type="button" class="btn btn-link page-link" onClick="getFiles(<?php echo $i ?>)"><?php echo $i ?></button></li>
<?php endfor; ?>
</ul>
</nav>
</div> </div>
</div> </div>
@ -67,144 +73,81 @@ echo 'var preLoadFiles = '.json_encode($preLoadFiles).';';
?> ?>
function openMediaManager() { function openMediaManager() {
$('#jsmediaManagerModal').modal('show'); $('#jsbluditMediaModal').modal('show');
} }
function closeMediaManager() { function closeMediaManager() {
$('#jsmediaManagerModal').modal('hide'); $('#jsbluditMediaModal').modal('hide');
} }
// Remove all files from the table // Remove all files from the table
function cleanTable() { function cleanFiles() {
$('#jsbluditMediaTable').empty(); $('#jsbluditMediaTable').empty();
} }
function showMediaAlert(message) {
$("#jsalertMedia").html(message).removeClass('d-none');
}
function hideMediaAlert() {
$("#jsalertMedia").addClass('d-none');
}
// Show the files in the table // Show the files in the table
function displayFiles(files, numberOfPages = <?= $numberOfPages ?>) { function displayFiles(files) {
if (!Array.isArray(files)) {
return false;
}
// Clean table // Clean table
cleanTable(); cleanFiles();
// Regenerate the table // Regenerate the table
if (files.length > 0) {
$.each(files, function(key, filename) { $.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+'">'+ tableRow = '<tr id="js'+filename+'">'+
'<td style="width:80px"><img class="img-thumbnail" alt="200x200" src="'+thumbnail+'" style="width: 50px; height: 50px;"><\/td>'+ '<td style="width:80px"><img class="img-thumbnail" alt="200x200" src="<?php echo HTML_PATH_UPLOADS_THUMBNAILS ?>'+filename+'" style="width: 50px; height: 50px;"><\/td>'+
'<td class="information">'+ '<td class="information">'+
'<div class="text-primary pb-2">'+filename+'<\/div>'+ '<div class="pb-2">'+filename+'<\/div>'+
'<div>'+ '<div>'+
'<a href="#" class="mr-3 text-secondary" onClick="editorInsertMedia(\''+image+'\'); closeMediaManager();"><i class="fa fa-plus"></i><?php $L->p('Insert') ?><\/a>'+ '<button onClick="editorInsertMedia(\''+filename+'\'); closeMediaManager();" type="button" class="btn btn-primary btn-sm mr-2">Insert<\/button>'+
'<a href="#" class="text-secondary" onClick="setCoverImage(\''+filename+'\'); closeMediaManager();"><i class="fa fa-square-o"></i><?php $L->p('Set as cover image') ?><\/button>'+ '<button onClick="setCoverImage(\''+filename+'\'); closeMediaManager();" type="button" class="btn btn-primary btn-sm mr-2">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>'+ '<button onClick="deleteMedia(\''+filename+'\')" type="button" class="btn btn-sm float-right">Delete<\/button>'+
'<\/div>'+ '<\/div>'+
'<\/td>'+ '<\/td>'+
'<\/tr>'; '<\/tr>';
$('#jsbluditMediaTable').append(tableRow); $('#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 // Get the list of files via AJAX, filter by the page number
function getFiles(pageNumber) { function getFiles(pageNumber) {
$.post(HTML_PATH_ADMIN_ROOT+"ajax/list-images", $.post("<?php echo HTML_PATH_ADMIN_ROOT ?>ajax/list-files",
{ tokenCSRF: tokenCSRF, { tokenCSRF: tokenCSRF,
pageNumber: pageNumber, pageNumber: pageNumber,
uuid: "<?php echo PAGE_IMAGES_KEY ?>", path: "<?php echo PATH_UPLOADS_THUMBNAILS ?>"
path: "thumbnails" // the paths are defined in ajax/list-images
}, },
function(data) { // success function function(data) {
if (data.status==0) { displayFiles(data.files);
displayFiles(data.files, data.numberOfPages); });
} else {
console.log(data.message);
}
}
);
} }
// Delete the file and the thumbnail if exist // Delete the file and the thumbnail if exist
function deleteMedia(filename) { function deleteMedia(filename) {
$.post(HTML_PATH_ADMIN_ROOT+"ajax/delete-image", $.post("<?php echo HTML_PATH_ADMIN_ROOT ?>ajax/delete-file",
{ tokenCSRF: tokenCSRF, { tokenCSRF: tokenCSRF,
filename: filename, filename: filename
uuid: "<?php echo PAGE_IMAGES_KEY; ?>"
}, },
function(data) { // success function function(data) {
if (data.status==0) {
getFiles(1); getFiles(1);
} else { });
console.log(data.message);
}
}
);
} }
function setCoverImage(filename) { function setCoverImage(filename) {
var image = "<?php echo PAGE_IMAGES_URL; ?>"+filename;
$("#jscoverImage").val(filename); $("#jscoverImage").val(filename);
$("#jscoverImagePreview").attr("src", image); $("#jscoverImagePreview").attr("src", HTML_PATH_UPLOADS_THUMBNAILS+filename);
} }
function uploadImages() { $(document).ready(function() {
// Remove current alerts // Display the files preloaded for the first time
hideMediaAlert(); displayFiles(preLoadFiles);
var images = $("#jsimages")[0].files; // Event to wait the selected files
for (var i=0; i < images.length; i++) { $("#jsbluditInputFiles").on("change", function() {
// 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 // Check file size ?
if (images[i].size > UPLOAD_MAX_FILESIZE) { // Check file type/extension ?
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({ $.ajax({
url: HTML_PATH_ADMIN_ROOT+"ajax/upload-images", url: "<?php echo HTML_PATH_ADMIN_ROOT ?>ajax/upload-files",
type: "POST", type: "POST",
data: formData, data: new FormData($("#jsbluditFormUpload")[0]),
cache: false, cache: false,
contentType: false, contentType: false,
processData: false, processData: false,
@ -220,40 +163,10 @@ function uploadImages() {
} }
return xhr; return xhr;
} }
}).done(function(data) { }).done(function() {
if (data.status==0) { // Get the files of the first page, this include the files uploaded
$("#jsbluditProgressBar").removeClass("bg-primary").addClass("bg-success");
// Get the files for the first page, this include the files uploaded
getFiles(1); 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();
}); });
}); });

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

@ -2,38 +2,28 @@
<ul class="nav flex-column pt-4"> <ul class="nav flex-column pt-4">
<li class="nav-item mb-4" style="margin-left: -4px;"> <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> <img src="<?php echo HTML_PATH_ADMIN_THEME ?>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>
<li class="nav-item"> <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> <a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'dashboard' ?>"><span class="oi oi-dashboard"></span><?php $L->p('Dashboard') ?></a>
</li> </li>
<li class="nav-item"> <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> <a class="nav-link" target="_blank" href="<?php echo HTML_PATH_ROOT ?>"><span class="oi oi-external-link"></span><?php $L->p('Website') ?></a>
</li> </li>
<li class="nav-item mt-3"> <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> <a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'new-content' ?>"><span class="oi oi-plus"></span><?php $L->p('New content') ?></a>
</li> </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)): ?> <?php if (checkRole(array('admin'),false)): ?>
<li class="nav-item mt-3"> <li class="nav-item mt-3">
<h4><?php $L->p('Manage') ?></h4> <h4>Manage</h4>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'content' ?>"><?php $L->p('Content') ?></a> <a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'content' ?>"><?php $L->p('Content') ?></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'categories' ?>"><?php $L->p('Categories') ?></a> <a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'categories' ?>"><?php $L->p('Categories') ?></a>
</li> </li>
@ -42,7 +32,7 @@
</li> </li>
<li class="nav-item mt-3"> <li class="nav-item mt-3">
<h4><?php $L->p('Settings') ?></h4> <h4>Settings</h4>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'settings' ?>"><?php $L->p('General') ?></a> <a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'settings' ?>"><?php $L->p('General') ?></a>
@ -57,10 +47,6 @@
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'about' ?>"><?php $L->p('About') ?></a> <a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'about' ?>"><?php $L->p('About') ?></a>
</li> </li>
<?php endif; ?>
<?php if (checkRole(array('admin', 'editor'),false)): ?>
<?php <?php
if (!empty($plugins['adminSidebar'])) { if (!empty($plugins['adminSidebar'])) {
echo '<li class="nav-item"><hr></li>'; echo '<li class="nav-item"><hr></li>';
@ -75,6 +61,6 @@
<?php endif; ?> <?php endif; ?>
<li class="nav-item mt-5"> <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> <a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'logout' ?>"><span class="oi oi-account-logout"></span><?php $L->p('Logout') ?></a>
</li> </li>
</ul> </ul>

View File

@ -0,0 +1,8 @@
<!-- Check if the user is logged -->
<script>
setInterval(
function() {
var ajax = new bluditAjax();
ajax.userLogged(showAlert);
}, 15000);
</script>

View File

Before

Width:  |  Height:  |  Size: 456 B

After

Width:  |  Height:  |  Size: 456 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -5,43 +5,36 @@
<meta charset="<?php echo CHARSET ?>"> <meta charset="<?php echo CHARSET ?>">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="robots" content="noindex,nofollow"> <meta name="robots" content="noindex,nofollow">
<meta name="generator" content="Bludit">
<!-- Favicon --> <!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="<?php echo HTML_PATH_CORE_IMG.'favicon.png?version='.BLUDIT_VERSION ?>"> <link rel="shortcut icon" type="image/x-icon" href="<?php echo DOMAIN_ADMIN_THEME.'img/favicon.png?version='.BLUDIT_VERSION ?>">
<!-- CSS --> <!-- CSS -->
<?php <?php
echo Theme::cssBootstrap(); echo Theme::cssBootstrap();
echo Theme::cssLineAwesome();
echo Theme::css(array(
'bludit.css',
'bludit.bootstrap.css'
), DOMAIN_ADMIN_THEME_CSS);
echo Theme::css(array( echo Theme::css(array(
'jquery-auto-complete.css',
'open-iconic-bootstrap.min.css',
'jquery.datetimepicker.min.css', 'jquery.datetimepicker.min.css',
'select2.min.css', 'bludit.css'
'select2-bootstrap4.min.css' ), DOMAIN_ADMIN_THEME_CSS);
), DOMAIN_CORE_CSS);
?> ?>
<!-- Javascript --> <!-- Javascript -->
<?php <?php
echo Theme::jquery(); echo Theme::jquery();
echo Theme::jsBootstrap(); echo Theme::jsBootstrap();
echo Theme::jsSortable();
echo Theme::js(array( echo Theme::js(array(
'jquery.datetimepicker.full.min.js', 'jquery-auto-complete.min.js',
'select2.full.min.js', 'jquery.datetimepicker.full.min.js'
'functions.js' ), DOMAIN_ADMIN_THEME_JS);
), DOMAIN_CORE_JS);
?> ?>
<!-- Plugins --> <!-- Plugins -->
<?php Theme::plugins('adminHead') ?> <?php Theme::plugins('adminHead') ?>
</head> </head>
<body class="h-100"> <body>
<!-- Plugins --> <!-- Plugins -->
<?php Theme::plugins('adminBodyBegin') ?> <?php Theme::plugins('adminBodyBegin') ?>
@ -57,18 +50,12 @@
echo '</script>'.PHP_EOL; echo '</script>'.PHP_EOL;
?> ?>
<!-- Overlay background -->
<div id="jsshadow"></div>
<!-- Alert --> <!-- Alert -->
<?php include('html/alert.php'); ?> <?php include('html/alert.php'); ?>
<!-- Navbar, only for small devices --> <div class="container">
<?php include('html/navbar.php'); ?>
<div class="container h-100">
<!-- 25%/75% split on large devices, small, medium devices hide --> <!-- 25%/75% split on large devices, small, medium devices hide -->
<div class="row h-100"> <div class="row">
<!-- LEFT SIDEBAR - Display only on large devices --> <!-- LEFT SIDEBAR - Display only on large devices -->
<div class="sidebar col-lg-2 d-none d-lg-block"> <div class="sidebar col-lg-2 d-none d-lg-block">
@ -76,7 +63,7 @@
</div> </div>
<!-- RIGHT MAIN --> <!-- RIGHT MAIN -->
<div class="col-lg-10 pt-3 pb-1 h-100"> <div class="col-lg-10 pt-4">
<?php <?php
if (Sanitize::pathFile(PATH_ADMIN_VIEWS, $layout['view'].'.php')) { if (Sanitize::pathFile(PATH_ADMIN_VIEWS, $layout['view'].'.php')) {
include(PATH_ADMIN_VIEWS.$layout['view'].'.php'); include(PATH_ADMIN_VIEWS.$layout['view'].'.php');
@ -89,6 +76,9 @@
</div> </div>
</div> </div>
<!-- Check user logged and Internet connection -->
<?php include('html/user-logged.php'); ?>
<!-- Plugins --> <!-- Plugins -->
<?php Theme::plugins('adminBodyEnd') ?> <?php Theme::plugins('adminBodyEnd') ?>

View File

@ -2,37 +2,6 @@
class Bootstrap { 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) public static function link($args)
{ {
$options = 'href="'.$args['href'].'"'; $options = 'href="'.$args['href'].'"';
@ -44,7 +13,7 @@ EOF;
} }
if (isset($args['icon'])) { if (isset($args['icon'])) {
return '<a '.$options.'><span class="fa fa-'.$args['icon'].'"></span>'.$args['title'].'</a>'; return '<a '.$options.'><span class="oi oi-'.$args['icon'].'" style="font-size: 0.7em;"></span> '.$args['title'].'</a>';
} }
return '<a '.$options.'>'.$args['title'].'</a>'; return '<a '.$options.'>'.$args['title'].'</a>';
@ -56,7 +25,7 @@ EOF;
$title = $args['title']; $title = $args['title'];
return <<<EOF return <<<EOF
<h2 class="mt-0 mb-3"> <h2 class="mt-0 mb-3">
<span class="fa fa-$icon" style="font-size: 0.9em;"></span><span>$title</span> <span class="oi oi-$icon" style="font-size: 0.7em;"></span> $title
</h2> </h2>
EOF; EOF;
} }
@ -68,10 +37,9 @@ EOF;
$enctype = empty($args['enctype'])?'':'enctype="'.$args['enctype'].'"'; $enctype = empty($args['enctype'])?'':'enctype="'.$args['enctype'].'"';
$action = empty($args['action'])?'action=""':'action="'.$args['action'].'"'; $action = empty($args['action'])?'action=""':'action="'.$args['action'].'"';
$method = empty($args['method'])?'method="post"':'method="'.$args['method'].'"'; $method = empty($args['method'])?'method="post"':'method="'.$args['method'].'"';
$style = empty($args['style'])?'':'style="'.$args['style'].'"';
return <<<EOF return <<<EOF
<form $class $enctype $id $method $action $style autocomplete="off"> <form $class $enctype $id $method $action autocomplete="off">
EOF; EOF;
} }
@ -96,54 +64,37 @@ EOF;
{ {
$title = $args['title']; $title = $args['title'];
return <<<EOF return <<<EOF
<h6 class="mt-4 mb-2 pb-2 border-bottom text-uppercase">$title</h6> <h4 class="mt-4 mb-3 font-weight-normal">$title</h4>
EOF; EOF;
} }
public static function formInputTextBlock($args) public static function formInputTextBlock($args)
{ {
$name = $args['name']; $id = 'js'.$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'])) { if (isset($args['id'])) {
$id = $args['id']; $id = $args['id'];
} }
$tip = ''; $class = 'form-control';
if (!empty($args['tip'])) {
$tip = '<small class="form-text text-muted">'.$args['tip'].'</small>';
}
$class = 'form-group m-0';
if (isset($args['class'])) { if (isset($args['class'])) {
$class = $args['class']; $class = $class.' '.$args['class'];
} }
$labelClass = 'mt-4 mb-2 pb-2 border-bottom text-uppercase w-100'; $html = '<div class="form-group">';
if (isset($args['labelClass'])) {
$labelClass = $args['labelClass']; if (isset($args['label'])) {
$html .= '<label for="'.$id.'">'.$args['label'].'</label>';
} }
$label = ''; $html .= '<input type="text" value="'.$args['value'].'" class="'.$class.'" id="'.$id.'" name="'.$args['name'].'" placeholder="'.$args['placeholder'].'">';
if (!empty($args['label'])) {
$label = '<label class="'.$labelClass.'" for="'.$id.'">'.$args['label'].'</label>'; if (isset($args['tip'])) {
$html .= '<small class="form-text text-muted">'.$args['tip'].'</small>';
} }
$type = 'text'; $html .= '</div>';
if (isset($args['type'])) {
$type = $args['type'];
}
return <<<EOF return $html;
<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) public static function formInputFile($args)
@ -180,12 +131,12 @@ EOF;
$html = '<div class="form-group row">'; $html = '<div class="form-group row">';
if (!empty($args['label'])) { if (isset($args['label'])) {
$html .= '<label for="'.$id.'" class="col-sm-2 col-form-label">'.$args['label'].'</label>'; $html .= '<label for="'.$id.'" class="col-sm-2 col-form-label">'.$args['label'].'</label>';
} }
$html .= '<div class="col-sm-10">'; $html .= '<div class="col-sm-10">';
$html .= '<textarea class="'.$class.'" id="'.$id.'" name="'.$args['name'].'" rows="'.$args['rows'].'" placeholder="'.$args['placeholder'].'">'.$args['value'].'</textarea>'; $html .= '<textarea class="'.$class.'" id="'.$id.'" name="'.$args['name'].'" rows="'.$args['rows'].'" placeholder="'.$args['placeholder'].'"></textarea>';
if (isset($args['tip'])) { if (isset($args['tip'])) {
$html .= '<small class="form-text text-muted">'.$args['tip'].'</small>'; $html .= '<small class="form-text text-muted">'.$args['tip'].'</small>';
} }
@ -209,7 +160,7 @@ EOF;
$html = '<div class="form-group m-0">'; $html = '<div class="form-group m-0">';
if (!empty($args['label'])) { 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 .= '<label for="'.$id.'">'.$args['label'].'</label>';
} }
$html .= '<textarea class="'.$class.'" id="'.$id.'" name="'.$args['name'].'" rows="'.$args['rows'].'" placeholder="'.$args['placeholder'].'">'.$args['value'].'</textarea>'; $html .= '<textarea class="'.$class.'" id="'.$id.'" name="'.$args['name'].'" rows="'.$args['rows'].'" placeholder="'.$args['placeholder'].'">'.$args['value'].'</textarea>';
@ -221,28 +172,45 @@ EOF;
return $html; return $html;
} }
public static function formInputText($args) public static function formInputGroupText($args)
{ {
$label = $args['label'];
$labelInside = $args['labelInside'];
$tip = $args['tip'];
$value = $args['value'];
$name = $args['name']; $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; $id = 'js'.$name;
if (isset($args['id'])) { if (isset($args['id'])) {
$id = $args['id']; $id = $args['id'];
} }
$disabled = isset($args['disabled'])?'disabled':'';
$tip = ''; return <<<EOF
if (isset($args['tip'])) { <div class="form-group">
$tip = '<small class="form-text text-muted">'.$args['tip'].'</small>'; <label for="$id">$label</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text" id="$id">$labelInside</span>
</div>
<input id="$id" name="$name" value="$value" type="text" class="form-control" $disabled>
</div>
<small class="form-text text-muted">$tip</small>
</div>
EOF;
} }
$label = ''; public static function formInputText($args)
if (isset($args['label'])) { {
$label = '<label for="'.$id.'" class="col-sm-2 col-form-label">'.$args['label'].'</label>'; $label = isset($args['label'])?$args['label']:'';
$placeholder = isset($args['placeholder'])?$args['placeholder']:'';
$tip = isset($args['tip'])?$args['tip']:'&nbsp;';
$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-control'; $class = 'form-control';
if (isset($args['class'])) { if (isset($args['class'])) {
@ -256,10 +224,10 @@ EOF;
return <<<EOF return <<<EOF
<div class="form-group row"> <div class="form-group row">
$label <label for="$id" class="col-sm-2 col-form-label">$label</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input class="$class" id="$id" name="$name" value="$value" placeholder="$placeholder" type="$type" $disabled $readonly> <input class="$class" id="$id" name="$name" value="$value" placeholder="$placeholder" type="$type" $disabled>
$tip <small class="form-text text-muted">$tip</small>
</div> </div>
</div> </div>
EOF; EOF;
@ -267,9 +235,10 @@ EOF;
public static function formCheckbox($args) public static function formCheckbox($args)
{ {
$label = isset($args['label'])?$args['label']:'';
$labelForCheckbox = isset($args['labelForCheckbox'])?$args['labelForCheckbox']:''; $labelForCheckbox = isset($args['labelForCheckbox'])?$args['labelForCheckbox']:'';
$placeholder = isset($args['placeholder'])?$args['placeholder']:''; $placeholder = isset($args['placeholder'])?$args['placeholder']:'';
$tip = isset($args['tip'])?'<small class="form-text text-muted">'.$args['tip'].'</small>':''; $tip = isset($args['tip'])?$args['tip']:'&nbsp;';
$value = isset($args['value'])?$args['value']:''; $value = isset($args['value'])?$args['value']:'';
$name = $args['name']; $name = $args['name'];
$id = 'js'.$name; $id = 'js'.$name;
@ -278,14 +247,9 @@ EOF;
} }
$disabled = isset($args['disabled'])?'disabled':''; $disabled = isset($args['disabled'])?'disabled':'';
$class = 'form-group m-0'; $class = 'form-group row';
if (isset($args['class'])) { if (isset($args['class'])) {
$class = $args['class']; $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'; $type = 'text';
@ -293,21 +257,17 @@ EOF;
$type = $args['type']; $type = $args['type'];
} }
$label = '';
if (!empty($args['label'])) {
$label = '<label class="'.$labelClass.'">'.$args['label'].'</label>';
}
$checked = $args['checked']?'checked':''; $checked = $args['checked']?'checked':'';
$value = $checked?'1':'0';
return <<<EOF return <<<EOF
<div class="$class"> <div class="$class">
$label <label for="$id" class="col-sm-2">$label</label>
<div class="col-sm-10">
<div class="form-check"> <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> <input name="$name" class="form-check-input" type="checkbox" id="$id" $checked>
<label class="form-check-label" for="$id">$labelForCheckbox</label> <label class="form-check-label" for="$id">$labelForCheckbox</label>
$tip <small class="form-text text-muted">$tip</small>
</div>
</div> </div>
</div> </div>
EOF; EOF;
@ -361,7 +321,7 @@ EOF;
$html = '<div class="form-group m-0">'; $html = '<div class="form-group m-0">';
if (!empty($args['label'])) { 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 .= '<label for="'.$id.'">'.$args['label'].'</label>';
} }
$html .= '<select id="'.$id.'" name="'.$args['name'].'" class="'.$class.'">'; $html .= '<select id="'.$id.'" name="'.$args['name'].'" class="'.$class.'">';
@ -384,18 +344,4 @@ EOF;
{ {
return '<input type="hidden" id="js'.$args['name'].'" name="'.$args['name'].'" value="'.$args['value'].'">'; 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

@ -0,0 +1,3 @@
// jQuery autoComplete v1.0.7
// https://github.com/Pixabay/jQuery-autoComplete
!function(e){e.fn.autoComplete=function(t){var o=e.extend({},e.fn.autoComplete.defaults,t);return"string"==typeof t?(this.each(function(){var o=e(this);"destroy"==t&&(e(window).off("resize.autocomplete",o.updateSC),o.off("blur.autocomplete focus.autocomplete keydown.autocomplete keyup.autocomplete"),o.data("autocomplete")?o.attr("autocomplete",o.data("autocomplete")):o.removeAttr("autocomplete"),e(o.data("sc")).remove(),o.removeData("sc").removeData("autocomplete"))}),this):this.each(function(){function t(e){var t=s.val();if(s.cache[t]=e,e.length&&t.length>=o.minChars){for(var a="",c=0;c<e.length;c++)a+=o.renderItem(e[c],t);s.sc.html(a),s.updateSC(0)}else s.sc.hide()}var s=e(this);s.sc=e('<div class="autocomplete-suggestions '+o.menuClass+'"></div>'),s.data("sc",s.sc).data("autocomplete",s.attr("autocomplete")),s.attr("autocomplete","off"),s.cache={},s.last_val="",s.updateSC=function(t,o){if(s.sc.css({top:s.offset().top+s.outerHeight(),left:s.offset().left,width:s.outerWidth()}),!t&&(s.sc.show(),s.sc.maxHeight||(s.sc.maxHeight=parseInt(s.sc.css("max-height"))),s.sc.suggestionHeight||(s.sc.suggestionHeight=e(".autocomplete-suggestion",s.sc).first().outerHeight()),s.sc.suggestionHeight))if(o){var a=s.sc.scrollTop(),c=o.offset().top-s.sc.offset().top;c+s.sc.suggestionHeight-s.sc.maxHeight>0?s.sc.scrollTop(c+s.sc.suggestionHeight+a-s.sc.maxHeight):0>c&&s.sc.scrollTop(c+a)}else s.sc.scrollTop(0)},e(window).on("resize.autocomplete",s.updateSC),s.sc.appendTo("body"),s.sc.on("mouseleave",".autocomplete-suggestion",function(){e(".autocomplete-suggestion.selected").removeClass("selected")}),s.sc.on("mouseenter",".autocomplete-suggestion",function(){e(".autocomplete-suggestion.selected").removeClass("selected"),e(this).addClass("selected")}),s.sc.on("mousedown click",".autocomplete-suggestion",function(t){var a=e(this),c=a.data("val");return(c||a.hasClass("autocomplete-suggestion"))&&(s.val(c),o.onSelect(t,c,a),s.sc.hide()),!1}),s.on("blur.autocomplete",function(){try{over_sb=e(".autocomplete-suggestions:hover").length}catch(t){over_sb=0}over_sb?s.is(":focus")||setTimeout(function(){s.focus()},20):(s.last_val=s.val(),s.sc.hide(),setTimeout(function(){s.sc.hide()},350))}),o.minChars||s.on("focus.autocomplete",function(){s.last_val="\n",s.trigger("keyup.autocomplete")}),s.on("keydown.autocomplete",function(t){if((40==t.which||38==t.which)&&s.sc.html()){var a,c=e(".autocomplete-suggestion.selected",s.sc);return c.length?(a=40==t.which?c.next(".autocomplete-suggestion"):c.prev(".autocomplete-suggestion"),a.length?(c.removeClass("selected"),s.val(a.addClass("selected").data("val"))):(c.removeClass("selected"),s.val(s.last_val),a=0)):(a=40==t.which?e(".autocomplete-suggestion",s.sc).first():e(".autocomplete-suggestion",s.sc).last(),s.val(a.addClass("selected").data("val"))),s.updateSC(0,a),!1}if(27==t.which)s.val(s.last_val).sc.hide();else if(13==t.which||9==t.which){var c=e(".autocomplete-suggestion.selected",s.sc);c.length&&s.sc.is(":visible")&&(o.onSelect(t,c.data("val"),c),setTimeout(function(){s.sc.hide()},20))}}),s.on("keyup.autocomplete",function(a){if(!~e.inArray(a.which,[13,27,35,36,37,38,39,40])){var c=s.val();if(c.length>=o.minChars){if(c!=s.last_val){if(s.last_val=c,clearTimeout(s.timer),o.cache){if(c in s.cache)return void t(s.cache[c]);for(var l=1;l<c.length-o.minChars;l++){var i=c.slice(0,c.length-l);if(i in s.cache&&!s.cache[i].length)return void t([])}}s.timer=setTimeout(function(){o.source(c,t)},o.delay)}}else s.last_val=c,s.sc.hide()}})})},e.fn.autoComplete.defaults={source:0,minChars:3,delay:150,cache:1,menuClass:"",renderItem:function(e,t){t=t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");var o=new RegExp("("+t.split(" ").join("|")+")","gi");return'<div class="autocomplete-suggestion" data-val="'+e+'">'+e.replace(o,"<b>$1</b>")+"</div>"},onSelect:function(e,t,o){}}}(jQuery);

View File

@ -7,14 +7,13 @@
<meta name="robots" content="noindex,nofollow"> <meta name="robots" content="noindex,nofollow">
<!-- Favicon --> <!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="<?php echo HTML_PATH_CORE_IMG.'favicon.png?version='.BLUDIT_VERSION ?>"> <link rel="shortcut icon" type="image/x-icon" href="<?php echo HTML_PATH_ADMIN_THEME.'img/favicon.png?version='.BLUDIT_VERSION ?>">
<!-- CSS --> <!-- CSS -->
<?php <?php
echo Theme::cssBootstrap(); echo Theme::cssBootstrap();
echo Theme::css(array( echo Theme::css(array(
'bludit.css', 'bludit.css'
'bludit.bootstrap.css'
), DOMAIN_ADMIN_THEME_CSS); ), DOMAIN_ADMIN_THEME_CSS);
?> ?>
@ -37,7 +36,7 @@
<div class="container"> <div class="container">
<div class="row justify-content-md-center pt-5"> <div class="row justify-content-md-center pt-5">
<div class="col-md-4 pt-5"> <div class="col-4 pt-5">
<?php <?php
if (Sanitize::pathFile(PATH_ADMIN_VIEWS, $layout['view'].'.php')) { if (Sanitize::pathFile(PATH_ADMIN_VIEWS, $layout['view'].'.php')) {
include(PATH_ADMIN_VIEWS.$layout['view'].'.php'); include(PATH_ADMIN_VIEWS.$layout['view'].'.php');

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

View File

@ -1,6 +1,6 @@
<?php <?php
echo Bootstrap::pageTitle(array('title'=>$L->g('About'), 'icon'=>'info-circle')); echo Bootstrap::pageTitle(array('title'=>$L->g('About'), 'icon'=>'person'));
echo ' echo '
<table class="table table-striped mt-3"> <table class="table table-striped mt-3">
@ -10,7 +10,7 @@ echo '
echo '<tr>'; echo '<tr>';
echo '<td>Bludit Edition</td>'; echo '<td>Bludit Edition</td>';
if (defined('BLUDIT_PRO')) { if (defined('BLUDIT_PRO')) {
echo '<td>PRO - '.$L->g('Thanks for supporting Bludit').' <span class="fa fa-heart" style="color: #ffc107"></span></td>'; echo '<td>PRO - '.$L->g('Thanks for support Bludit').'</td>';
} else { } else {
echo '<td>Standard - <a target="_blank" href="https://pro.bludit.com">'.$L->g('Upgrade to Bludit PRO').'</a></td>'; echo '<td>Standard - <a target="_blank" href="https://pro.bludit.com">'.$L->g('Upgrade to Bludit PRO').'</a></td>';
} }
@ -31,16 +31,6 @@ echo '<td>Bludit Build Number</td>';
echo '<td>'.BLUDIT_BUILD.'</td>'; echo '<td>'.BLUDIT_BUILD.'</td>';
echo '</tr>'; 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 ' echo '
</tbody> </tbody>
</table> </table>

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

@ -3,7 +3,7 @@
echo Bootstrap::pageTitle(array('title'=>$L->g('Categories'), 'icon'=>'tags')); echo Bootstrap::pageTitle(array('title'=>$L->g('Categories'), 'icon'=>'tags'));
echo Bootstrap::link(array( echo Bootstrap::link(array(
'title'=>$L->g('Add a new category'), 'title'=>'Add a new category',
'href'=>HTML_PATH_ADMIN_ROOT.'new-category', 'href'=>HTML_PATH_ADMIN_ROOT.'new-category',
'icon'=>'plus' 'icon'=>'plus'
)); ));
@ -12,18 +12,18 @@ echo '
<table class="table table-striped mt-3"> <table class="table table-striped mt-3">
<thead> <thead>
<tr> <tr>
<th class="border-bottom-0" scope="col">'.$L->g('Name').'</th> <th class="border-bottom-0" scope="col">Name</th>
<th class="border-bottom-0" scope="col">'.$L->g('URL').'</th> <th class="border-bottom-0" scope="col">URL</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
'; ';
foreach ($categories->keys() as $key) { $categories = $dbCategories->getKeyNameArray();
$category = new Category($key); foreach ($categories as $categoryKey=>$category) {
echo '<tr>'; echo '<tr>';
echo '<td><a href="'.HTML_PATH_ADMIN_ROOT.'edit-category/'.$key.'">'.$category->name().'</a></td>'; echo '<td><a href="'.HTML_PATH_ADMIN_ROOT.'edit-category/'.$categoryKey.'">'.$category.'</a></td>';
echo '<td><a href="'.$category->permalink().'">'.$url->filters('category', false).$key.'</a></td>'; echo '<td><a href="'.DOMAIN_CATEGORIES.$categoryKey.'">'.$url->filters('category', false).$categoryKey.'</a></td>';
echo '</tr>'; echo '</tr>';
} }

View File

@ -1,19 +1,9 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?> <?php defined('BLUDIT') or die('Bludit CMS.');
<?php echo Bootstrap::formOpen(array('id'=>'jsform', 'class'=>'plugin-form')); ?> echo Bootstrap::pageTitle(array('title'=>$plugin->name(), 'icon'=>'person'));
<div class="align-middle"> echo Bootstrap::formOpen(array('class'=>'plugin-form'));
<?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( echo Bootstrap::formInputHidden(array(
'name'=>'tokenCSRF', 'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF() 'value'=>$security->getTokenCSRF()
@ -21,6 +11,14 @@
// Print the plugin form // Print the plugin form
echo $plugin->form(); echo $plugin->form();
?>
<?php echo Bootstrap::formClose(); ?> if ($plugin->formButtons()) {
echo '
<div class="form-group mt-4">
<button type="submit" class="btn btn-primary mr-2" name="save">'.$L->g('Save').'</button>
<a class="btn btn-secondary" href="'.HTML_PATH_ADMIN_ROOT.'plugins" role="button">'.$L->g('Cancel').'</a>
</div>
';
}
echo Bootstrap::formClose();

View File

@ -1,179 +1,126 @@
<?php <?php
echo Bootstrap::pageTitle(array('title'=>$L->g('Content'), 'icon'=>'archive')); echo Bootstrap::pageTitle(array('title'=>$L->g('Content'), 'icon'=>'cog'));
function table($type) { function table($status) {
global $url; global $url;
global $L; global $Language;
global $published; global $published;
global $drafts; global $drafts;
global $scheduled; global $scheduled;
global $static; global $static;
global $sticky; global $sticky;
global $autosave;
if ($type=='published') { if ($status=='published') {
$list = $published; $list = $published;
if (empty($list)) { if (empty($list)) {
echo '<p class="mt-4 text-muted">'; echo '<p class="mt-4 text-muted">';
echo $L->g('There are no pages at this moment.'); echo $Language->g('There are not pages in this moment.');
echo '</p>'; echo '</p>';
return false; return false;
} }
} elseif ($type=='draft') { } elseif ($status=='draft') {
$list = $drafts; $list = $drafts;
if (empty($list)) { if (empty($list)) {
echo '<p class="mt-4 text-muted">'; echo '<p class="mt-4 text-muted">';
echo $L->g('There are no draft pages at this moment.'); echo $Language->g('There are not draft pages in this moment.');
echo '</p>'; echo '</p>';
return false; return false;
} }
} elseif ($type=='scheduled') { } elseif ($status=='scheduled') {
$list = $scheduled; $list = $scheduled;
if (empty($list)) { if (empty($list)) {
echo '<p class="mt-4 text-muted">'; echo '<p class="mt-4 text-muted">';
echo $L->g('There are no scheduled pages at this moment.'); echo $Language->g('There are not scheduled pages in this moment.');
echo '</p>'; echo '</p>';
return false; return false;
} }
} elseif ($type=='static') { } elseif ($status=='static') {
$list = $static; $list = $static;
if (empty($list)) { if (empty($list)) {
echo '<p class="mt-4 text-muted">'; echo '<p class="mt-4 text-muted">';
echo $L->g('There are no static pages at this moment.'); echo $Language->g('There are not static pages in this moment.');
echo '</p>'; echo '</p>';
return false; return false;
} }
} elseif ($type=='sticky') { } elseif ($status=='sticky') {
$list = $sticky; $list = $sticky;
if (empty($list)) { if (empty($list)) {
echo '<p class="mt-4 text-muted">'; echo '<p class="mt-4 text-muted">';
echo $L->g('There are no sticky pages at this moment.'); echo $Language->g('There are not sticky pages in this moment.');
echo '</p>'; echo '</p>';
return false; return false;
} }
} elseif ($type=='autosave') {
$list = $autosave;
} }
echo ' echo '
<table class="table mt-3"> <table class="table mt-3">
<thead> <thead>
<tr> <tr>
<th class="border-0" scope="col">'.$L->g('Title').'</th> <th class="border-0" scope="col">'.$Language->g('Title').'</th>
'; <th class="border-0 d-none d-lg-table-cell" scope="col">'.$Language->g('URL').'</th>
<th class="border-0 text-center d-none d-sm-table-cell" scope="col">'.( ((ORDER_BY=='position') || ($status!='published'))?$Language->g('Position'):$Language->g('Creation date')).'</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> </tr>
</thead> </thead>
<tbody> <tbody>
'; ';
if ( (ORDER_BY=='position') || $type=='static' ) { if (ORDER_BY=='position') {
foreach ($list as $pageKey) { foreach ($list as $pageKey) {
try { $page = buildPage($pageKey);
$page = new Page($pageKey); if ($page) {
if (!$page->isChild()) { if (!$page->isChild() || $status!='published') {
echo '<tr> echo '<tr>
<td> <td>
<div> <a href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'">'
<a style="font-size: 1.1em" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'">' .($page->title()?$page->title():'<span>'.$Language->g('Empty title').'</span> ')
.($page->title()?$page->title():'<span class="label-empty-title">'.$L->g('Empty title').'</span> ')
.'</a> .'</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>'; </td>';
if ($type=='published' || $type=='static' || $type=='sticky') {
$friendlyURL = Text::isEmpty($url->filters('page')) ? '/'.$page->key() : '/'.$url->filters('page').'/'.$page->key(); $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="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 '<td class="text-center d-none d-sm-table-cell">'.$page->position().'</td>';
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>'; echo '</tr>';
foreach ($page->children() as $child) { foreach ($page->children() as $child) {
//if ($child->published()) { if ($child->published()) {
echo '<tr> echo '<tr>
<td class="child"> <td>
<div> <a href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$child->key().'">'
<a style="font-size: 1.1em" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$child->key().'">' .($child->title()?$child->title():'<span>'.$Language->g('Empty title').'</span> ')
.($child->title()?$child->title():'<span class="label-empty-title">'.$L->g('Empty title').'</span> ')
.'</a> .'</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>'; </td>';
if ($type=='published' || $type=='static' || $type=='sticky') {
$friendlyURL = Text::isEmpty($url->filters('page')) ? '/'.$child->key() : '/'.$url->filters('page').'/'.$child->key(); $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><a target="_blank" href="'.$child->permalink().'">'.$friendlyURL.'</a></td>';
}
echo '<td class="contentTools pt-3 text-center d-sm-table-cell">'.PHP_EOL; echo '<td>'.$child->position().'</td>';
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>'; echo '</tr>';
//}
} }
} }
} catch (Exception $e) { }
// Continue
} }
} }
} else { } else {
foreach ($list as $pageKey) { foreach ($list as $pageKey) {
try { $page = buildPage($pageKey);
$page = new Page($pageKey); if ($page) {
echo '<tr>'; echo '<tr>';
echo '<td class="pt-3"> echo '<td>
<div> <a href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'">'
<a style="font-size: 1.1em" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'">' .($page->title()?$page->title():'<span class="label-empty-title">'.$Language->g('Empty title').'</span> ')
.($page->title()?$page->title():'<span class="label-empty-title">'.$L->g('Empty title').'</span> ')
.'</a> .'</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>'; </td>';
if ($type=='published' || $type=='static' || $type=='sticky') {
$friendlyURL = Text::isEmpty($url->filters('page')) ? '/'.$page->key() : '/'.$url->filters('page').'/'.$page->key(); $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="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 '<td class="text-center d-none d-sm-table-cell">'.( ((ORDER_BY=='position') || ($status!='published'))?$page->position():$page->dateRaw(ADMIN_PANEL_DATE_FORMAT) ).'</td>';
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>'; echo '</tr>';
} catch (Exception $e) {
// Continue
} }
} }
} }
@ -189,60 +136,25 @@ function table($type) {
<!-- TABS --> <!-- TABS -->
<ul class="nav nav-tabs" role="tablist"> <ul class="nav nav-tabs" role="tablist">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link active" id="pages-tab" data-toggle="tab" href="#pages" role="tab"><?php $L->p('Pages') ?></a> <a class="nav-link active" id="pages-tab" data-toggle="tab" href="#pages" role="tab">Pages</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" id="static-tab" data-toggle="tab" href="#static" role="tab"><?php $L->p('Static') ?></a> <a class="nav-link" id="static-tab" data-toggle="tab" href="#static" role="tab">Static</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" id="sticky-tab" data-toggle="tab" href="#sticky" role="tab"><?php $L->p('Sticky') ?></a> <a class="nav-link" id="sticky-tab" data-toggle="tab" href="#sticky" role="tab">Sticky</a>
</li> </li>
<li class="nav-item"> <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> <a class="nav-link" id="scheduled-tab" data-toggle="tab" href="#scheduled" role="tab">Schedule <?php if (count($scheduled)>0) { echo '<span class="badge badge-danger">'.count($scheduled).'</span>'; } ?></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" id="draft-tab" data-toggle="tab" href="#draft" role="tab"><?php $L->p('Draft') ?></a> <a class="nav-link" id="draft-tab" data-toggle="tab" href="#draft" role="tab">Draft <?php if (count($drafts)>0) { echo '<span class="badge badge-danger">'.count($drafts).'</span>'; } ?></a>
</li> </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> </ul>
<div class="tab-content"> <div class="tab-content">
<!-- TABS PAGES --> <!-- TABS PAGES -->
<div class="tab-pane show active" id="pages" role="tabpanel"> <div class="tab-pane show active" id="pages" role="tabpanel">
<?php table('published'); ?> <?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> </div>
<!-- TABS STATIC --> <!-- TABS STATIC -->
@ -264,64 +176,4 @@ function table($type) {
<div class="tab-pane" id="draft" role="tabpanel"> <div class="tab-pane" id="draft" role="tabpanel">
<?php table('draft'); ?> <?php table('draft'); ?>
</div> </div>
<!-- TABS AUTOSAVE -->
<?php if (!empty($autosave)): ?>
<div class="tab-pane" id="autosave" role="tabpanel">
<?php table('autosave'); ?>
</div>
<?php endif; ?>
</div> </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,116 +1,49 @@
<div id="dashboard" class="container"> <div id="dashboard" class="container mt-3">
<div class="row"> <div class="row">
<div class="col-md-7"> <div class="col-7">
<!-- 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>
<!-- Quick Links --> <!-- Quick Links -->
<div class="container border-bottom pb-5" id="jsclippyContainer"> <div class="container border-bottom pb-4">
<h4 class="pb-3">Quick links</h4>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<div class="form-group"> <a class="quick-links text-center" style="color: #4586d4" href="<?php echo HTML_PATH_ADMIN_ROOT.'new-content' ?>">
<select id="jsclippy" class="clippy" name="state"></select> <div class="oi oi-justify-left quick-links-icons"></div>
<div>New content</div>
</a>
</div>
<div class="col border-left border-right">
<a class="quick-links text-center" href="<?php echo HTML_PATH_ADMIN_ROOT.'categories' ?>">
<div class="oi oi-tags quick-links-icons"></div>
<div>Categories</div>
</a>
</div>
<div class="col">
<a class="quick-links text-center" href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>">
<div class="oi oi-people quick-links-icons"></div>
<div>Users</div>
</a>
</div> </div>
</div> </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="container mt-4">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<a class="quick-links text-center" target="_blank" href="https://docs.bludit.com"> <a class="quick-links text-center" target="_blank" href="https://docs.bludit.com">
<div class="fa fa-compass quick-links-icons"></div> <div class="oi oi-compass quick-links-icons"></div>
<div><?php $L->p('Documentation') ?></div> <div>Documentation</div>
</a> </a>
</div> </div>
<div class="col border-left border-right"> <div class="col border-left border-right">
<a class="quick-links text-center" target="_blank" href="https://forum.bludit.org"> <a class="quick-links text-center" target="_blank" href="https://forum.bludit.org">
<div class="fa fa-support quick-links-icons"></div> <div class="oi oi-loop-square quick-links-icons"></div>
<div><?php $L->p('Forum support') ?></div> <div>Forum support</div>
</a> </a>
</div> </div>
<div class="col"> <div class="col">
<a class="quick-links text-center" target="_blank" href="https://gitter.im/bludit/support"> <a class="quick-links text-center" target="_blank" href="https://gitter.im/bludit/support">
<div class="fa fa-comments quick-links-icons"></div> <div class="oi oi-chat quick-links-icons"></div>
<div><?php $L->p('Chat support') ?></div> <div>Chat support</div>
</a> </a>
</div> </div>
</div> </div>
@ -118,11 +51,11 @@
<?php Theme::plugins('dashboard') ?> <?php Theme::plugins('dashboard') ?>
</div> </div>
<div class="col-md-5"> <div class="col-5">
<!-- Notifications --> <!-- Notifications -->
<ul class="list-group list-group-striped b-0"> <ul class="list-group list-group-striped b-0">
<li class="list-group-item pt-0"><h4><?php $L->p('Notifications') ?></h4></li> <li class="list-group-item pt-0"><h4>Notifications</h4></li>
<?php <?php
$logs = array_slice($syslog->db, 0, NOTIFICATIONS_AMOUNT); $logs = array_slice($syslog->db, 0, NOTIFICATIONS_AMOUNT);
foreach ($logs as $log) { foreach ($logs as $log) {
@ -134,7 +67,7 @@
} }
echo '<br><span class="notification-date"><small>'; echo '<br><span class="notification-date"><small>';
echo Date::format($log['date'], DB_DATE_FORMAT, NOTIFICATIONS_DATE_FORMAT); echo Date::format($log['date'], DB_DATE_FORMAT, NOTIFICATIONS_DATE_FORMAT);
echo ' [ '.$log['username'] .' ]'; echo ' - by '.$log['username'];
echo '</small></span>'; echo '</small></span>';
echo '</li>'; echo '</li>';
} }

View File

@ -1,6 +1,6 @@
<?php <?php
echo Bootstrap::pageTitle(array('title'=>$L->g('Developers'), 'icon'=>'gears')); echo Bootstrap::pageTitle(array('title'=>$L->g('Developers'), 'icon'=>'beaker'));
echo '<h2 class="mb-4 mt-4"><b>PHP version: '.phpversion().'</b></h2>'; echo '<h2 class="mb-4 mt-4"><b>PHP version: '.phpversion().'</b></h2>';
@ -34,5 +34,5 @@ $constants = get_defined_constants(true);
printTable('Bludit Constants', $constants['user']); printTable('Bludit Constants', $constants['user']);
// Site object // Site object
printTable('$site object database',$site->db); printTable('$Site object database',$site->db);

View File

@ -1,92 +1,53 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?> <?php defined('BLUDIT') or die('Bludit CMS.');
<?php echo Bootstrap::formOpen(array('id'=>'jsform')); ?> echo Bootstrap::pageTitle(array('title'=>$L->g('Edit Category'), 'icon'=>'tags'));
<div class="align-middle"> echo Bootstrap::formOpen(array());
<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( echo Bootstrap::formInputHidden(array(
'name'=>'tokenCSRF', 'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF() 'value'=>$security->getTokenCSRF()
)); ));
echo Bootstrap::formInputHidden(array(
'name'=>'action',
'value'=>'edit'
));
echo Bootstrap::formInputHidden(array( echo Bootstrap::formInputHidden(array(
'name'=>'oldKey', 'name'=>'oldKey',
'value'=>$categoryMap['key'] 'value'=>$categoryMap['key']
)); ));
echo Bootstrap::formInputText(array( echo Bootstrap::formInputTextBlock(array(
'name'=>'name', 'name'=>'name',
'label'=>$L->g('Name'), 'label'=>$L->g('Category name'),
'value'=>$categoryMap['name'], 'value'=>$categoryMap['name'],
'class'=>'', 'class'=>'',
'placeholder'=>'', 'placeholder'=>'',
'tip'=>'' 'tip'=>''
)); ));
echo Bootstrap::formTextarea(array( echo Bootstrap::formInputGroupText(array(
'name'=>'description', 'name'=>'newKey',
'label'=>$L->g('Description'), 'label'=>$L->g('Category key'),
'value'=>isset($categoryMap['description'])?$categoryMap['description']:'', 'labelInside'=>DOMAIN_CATEGORIES,
'value'=>$categoryMap['key'],
'class'=>'', 'class'=>'',
'placeholder'=>'', 'placeholder'=>'',
'tip'=>'', 'tip'=>''
'rows'=>3
)); ));
echo Bootstrap::formInputText(array( echo Bootstrap::formInputTextBlock(array(
'name'=>'template', 'name'=>'template',
'label'=>$L->g('Template'), 'label'=>$L->g('Category template'),
'value'=>isset($categoryMap['template'])?$categoryMap['template']:'', 'value'=>isset($categoryMap['template'])?$categoryMap['template']:'',
'class'=>'', 'class'=>'',
'placeholder'=>'', 'placeholder'=>'',
'tip'=>'' 'tip'=>''
)); ));
echo Bootstrap::formInputText(array( echo '
'name'=>'newKey', <div class="form-group mt-4">
'label'=>$L->g('Friendly URL'), <button type="submit" class="btn btn-primary mr-2" name="edit">'.$L->g('Save').'</button>
'value'=>$categoryMap['key'], <button type="submit" class="btn btn-secondary mr-2" name="delete">'.$L->g('Delete').'</button>
'class'=>'', <a class="btn btn-secondary" href="'.HTML_PATH_ADMIN_ROOT.'categories" role="button">'.$L->g('Cancel').'</a>
'placeholder'=>'', </div>
'tip'=>DOMAIN_CATEGORIES.$categoryMap['key'] ';
));
echo Bootstrap::formClose(); 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>

View File

@ -1,12 +1,22 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?> <?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<?php <!-- TABS -->
<ul class="nav nav-tabs" id="dynamicTab" role="tablist">
// FORM START <li class="nav-item">
echo Bootstrap::formOpen(array( <a class="nav-link active" id="content-tab" data-toggle="tab" href="#content" role="tab" aria-controls="content" aria-selected="true">Content</a>
</li>
<li class="nav-item">
<a class="nav-link" id="images-tab" data-toggle="tab" href="#images" role="tab" aria-controls="images" aria-selected="false">Images</a>
</li>
<li class="nav-item">
<a class="nav-link " id="options-tab" data-toggle="tab" href="#options" role="tab" aria-controls="options" aria-selected="false">Options</a>
</li>
</ul>
<?php
echo Bootstrap::formOpen(array(
'id'=>'jsform', 'id'=>'jsform',
'class'=>'d-flex flex-column h-100' 'class'=>'tab-content mt-1'
)); ));
// Token CSRF // Token CSRF
echo Bootstrap::formInputHidden(array( echo Bootstrap::formInputHidden(array(
@ -14,23 +24,34 @@ echo Bootstrap::formOpen(array(
'value'=>$security->getTokenCSRF() 'value'=>$security->getTokenCSRF()
)); ));
// Parent
echo Bootstrap::formInputHidden(array(
'name'=>'parent',
'value'=>$page->parent()
));
// UUID // UUID
// The UUID is generated in the controller
echo Bootstrap::formInputHidden(array( echo Bootstrap::formInputHidden(array(
'name'=>'uuid', 'name'=>'uuid',
'value'=>$page->uuid() 'value'=>$page->uuid()
)); ));
// Type = published, draft, sticky, static // Status = published, draft, sticky, static
echo Bootstrap::formInputHidden(array( echo Bootstrap::formInputHidden(array(
'name'=>'type', 'name'=>'type',
'value'=>$page->type() 'value'=>$page->type()
)); ));
// Page current key
echo Bootstrap::formInputHidden(array(
'name'=>'key',
'value'=>$page->key()
));
// Cover image // Cover image
echo Bootstrap::formInputHidden(array( echo Bootstrap::formInputHidden(array(
'name'=>'coverImage', 'name'=>'coverImage',
'value'=>$page->coverImage(false) 'value'=>$page->coverImage()
)); ));
// Content // Content
@ -38,84 +59,53 @@ echo Bootstrap::formOpen(array(
'name'=>'content', 'name'=>'content',
'value'=>'' '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 --> <!-- TABS CONTENT -->
<div class="tab-pane show active" id="content" role="tabpanel" aria-labelledby="content-tab">
<div class="form-group m-0">
<input value="<?php echo $page->title() ?>" class="form-control form-control-lg rounded-0 " id="jstitle" name="title" placeholder="Enter title" type="text">
</div>
<div class="form-group m-0 mt-1">
<button id="jsmediaManagerButton" type="button" class="btn btn-form btn-sm" data-toggle="modal" data-target="#jsbluditMediaModal"><span class="oi oi-image"></span> Media Manager</button>
<button id="jscategoryButton" type="button" class="btn btn-form btn-sm" data-toggle="modal" data-target="#jscategoryModal"><span class="oi oi-tags"></span> Category: <span class="option">-</span></button>
<button id="jsdescriptionButton" type="button" class="btn btn-form btn-sm" data-toggle="modal" data-target="#jsdescriptionModal"><span class="oi oi-tags"></span> Description: <span class="option">-</span></button>
</div>
<div class="form-group mt-1">
<textarea id="jseditor" style="display:none;"><?php echo $page->contentRaw(false) ?></textarea>
</div>
<?php if($page->draft()): ?>
<div class="alert alert-primary mt-2 mb-2">The content is saved as a draft. To publish it click on the button <b>Publish</b> or if you still working on it click on <b>Save as draft</b>.</div>
<?php endif; ?>
<div class="form-group mt-2">
<button type="button" class="jsbuttonSave btn btn-primary"><?php echo ($page->draft()?$L->g('Publish'):$L->g('Update')) ?></button>
<button type="button" class="jsbuttonDraft btn btn-secondary"><?php echo $L->g('Save as draft') ?></button>
<a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn btn-secondary"><?php echo $L->g('Cancel') ?></a>
<?php
if (count($page->children())===0) {
echo '<button type="button" class="jsbuttonDelete btn btn-secondary">'.$L->g('Delete').'</button>';
}
?>
</div>
</div>
<!-- TABS IMAGES -->
<div class="tab-pane" id="images" role="tabpanel" aria-labelledby="images-tab">
<div>
<div class="float-right">
<button type="button" class="jsbuttonSave btn btn-primary btn-sm"><?php echo ($page->draft()?$L->g('Publish'):$L->g('Update')) ?></button>
<button type="button" class="jsbuttonDraft btn btn-secondary btn-sm"><?php echo $L->g('Save as draft') ?></button>
</div>
<h4 class="mt-4 mb-4 font-weight-normal">Cover Image</h4>
</div>
<?php <?php
$coverImage = $page->coverImage(false); $coverImage = $page->coverImage(false);
$externalCoverImage = ''; $externalCoverImage = '';
@ -124,341 +114,229 @@ echo Bootstrap::formOpen(array(
$externalCoverImage = $page->coverImage(false); $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() { <img id="jscoverImagePreview" style="width: 350px; height: 200px;" class="img-thumbnail" alt="coverImagePreview" src="<?php echo HTML_PATH_ADMIN_THEME_IMG ?>default.svg" />
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 <?php
echo Bootstrap::formTitle(array('title'=>'External Cover image'));
// 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( echo Bootstrap::formInputTextBlock(array(
'name'=>'externalCoverImage', 'name'=>'externalCoverImage',
'label'=>$L->g('External cover image'), 'placeholder'=>'https://',
'placeholder'=>"https://",
'value'=>$externalCoverImage, 'value'=>$externalCoverImage,
'tip'=>$L->g('Set a cover image from external URL, such as a CDN or some server dedicated for images.') 'tip'=>'Set a cover image from external URL, such as a CDN or some server dedicate for images.'
)); ));
?>
// Username </div>
echo Bootstrap::formInputTextBlock(array(
'name'=>'', <!-- TABS OPTIONS -->
'label'=>$L->g('Author'), <div class="tab-pane" id="options" role="tabpanel" aria-labelledby="options-tab">
<div>
<div class="float-right">
<button type="button" class="jsbuttonSave btn btn-primary btn-sm"><?php echo ($page->draft()?$L->g('Publish'):$L->g('Update')) ?></button>
<button type="button" class="jsbuttonDraft btn btn-secondary btn-sm"><?php echo $L->g('Save as draft') ?></button>
</div>
<h4 class="mt-4 mb-4 font-weight-normal">Cover Image</h4>
</div>
<?php
// Date
echo Bootstrap::formInputText(array(
'name'=>'date',
'label'=>'Date',
'placeholder'=>'', 'placeholder'=>'',
'value'=>$page->username(), 'value'=>$page->dateRaw(),
'tip'=>'', 'tip'=>'Date format: <code>YYYY-MM-DD Hours:Minutes:Seconds</code>'
'disabled'=>true
)); ));
?>
<script>
$(document).ready(function() {
// Changes in External cover image input
$("#jsexternalCoverImage").change(function() {
$("#jscoverImage").val( $(this).val() );
});
// Datepicker // Type
$("#jsdate").datetimepicker({format:DB_DATE_FORMAT}); echo Bootstrap::formSelect(array(
}); 'name'=>'typeTMP',
</script> 'label'=>'Type',
</div> 'selected'=>$page->type(),
'options'=>array(
<?php if (!empty($site->customFields())): ?> 'published'=>'- Default -',
<div id="nav-custom" class="tab-pane fade" role="tabpanel" aria-labelledby="custom-tab"> 'sticky'=>'Sticky',
<?php 'static'=>'Static'
$customFields = $site->customFields(); ),
foreach ($customFields as $field=>$options) { 'tip'=>'???'
if ( !isset($options['position']) ) { ));
if ($options['type']=="string") {
echo Bootstrap::formInputTextBlock(array( // Parent
'name'=>'custom['.$field.']', $parentTMP = buildPage($page->parent());
'value'=>(isset($options['default'])?$options['default']:''), echo Bootstrap::formInputText(array(
'tip'=>(isset($options['tip'])?$options['tip']:''), 'name'=>'parentTMP',
'label'=>(isset($options['label'])?$options['label']:''), 'label'=>$L->g('Parent'),
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''), 'placeholder'=>'',
'value'=>$page->custom($field) 'tip'=>'Start typing a page title to see a list of suggestions.',
'value'=>($parentTMP?$parentTMP->title():'')
));
// Position
echo Bootstrap::formInputText(array(
'name'=>'position',
'label'=>$L->g('Position'),
'tip'=>'Field used when ordering content by position',
'value'=>$page->position()
));
// Template
echo Bootstrap::formInputText(array(
'name'=>'template',
'label'=>'Template',
'placeholder'=>'',
'value'=>$page->template(),
'tip'=>'Write a template name to filter the page in the theme and change the style of the page.'
));
echo Bootstrap::formTitle(array('title'=>'SEO'));
// Tags
echo Bootstrap::formInputText(array(
'name'=>'tags',
'label'=>'Tags',
'placeholder'=>'',
'value'=>$page->tags(),
'tip'=>'Write the tags separeted by comma'
)); ));
} 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 // Friendly URL
echo Bootstrap::formInputTextBlock(array( echo Bootstrap::formInputText(array(
'name'=>'slug', 'name'=>'slug',
'tip'=>$L->g('URL associated with the content'), 'tip'=>$L->g('URL associated with the content'),
'label'=>$L->g('Friendly URL'), 'label'=>$L->g('Friendly URL'),
'placeholder'=>$L->g('Leave empty for autocomplete by Bludit.'), 'placeholder'=>'Leave empty for autocomplete by Bludit.',
'value'=>$page->slug() 'value'=>$page->slug()
)); ));
// Robots
echo Bootstrap::formCheckbox(array( echo Bootstrap::formCheckbox(array(
'name'=>'noindex', 'name'=>'noindex',
'label'=>'Robots', 'label'=>'Robots',
'labelForCheckbox'=>$L->g('apply-code-noindex-code-to-this-page'), 'labelForCheckbox'=>'Apply <code>noindex</code> to this page',
'placeholder'=>'', 'placeholder'=>'',
'class'=>'mt-4',
'checked'=>$page->noindex(), 'checked'=>$page->noindex(),
'tip'=>$L->g('This tells search engines not to show this page in their search results.') 'tip'=>'This tells search engines not to show this page in their search results.'
)); ));
// Robots
echo Bootstrap::formCheckbox(array( echo Bootstrap::formCheckbox(array(
'name'=>'nofollow', 'name'=>'nofollow',
'label'=>'', 'label'=>'',
'labelForCheckbox'=>$L->g('apply-code-nofollow-code-to-this-page'), 'labelForCheckbox'=>'Apply <code>nofollow</code> to this page',
'placeholder'=>'', 'placeholder'=>'',
'checked'=>$page->nofollow(), 'checked'=>$page->nofollow(),
'tip'=>$L->g('This tells search engines not to follow links on this page.') 'tip'=>'This tells search engines not to follow links on this page.'
)); ));
// Robots
echo Bootstrap::formCheckbox(array( echo Bootstrap::formCheckbox(array(
'name'=>'noarchive', 'name'=>'noarchive',
'label'=>'', 'label'=>'',
'labelForCheckbox'=>$L->g('apply-code-noarchive-code-to-this-page'), 'labelForCheckbox'=>'Apply <code>noarchive</code> to this page',
'placeholder'=>'', 'placeholder'=>'',
'checked'=>$page->noarchive(), 'checked'=>$page->noarchive(),
'tip'=>$L->g('This tells search engines not to save a cached copy of this page.') 'tip'=>'This tells search engines not to save a cached copy of this page.'
));
?>
</div>
<!-- Modal for Categories -->
<div id="jscategoryModal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Category</h5>
</div>
<div class="modal-body">
<?php
echo Bootstrap::formSelectBlock(array(
'name'=>'category',
'label'=>'',
'selected'=>$page->categoryKey(),
'class'=>'',
'emptyOption'=>'- Without category -',
'options'=>$dbCategories->getKeyNameArray()
)); ));
?> ?>
</div> </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"> <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-primary" data-dismiss="modal">Done</button>
<button type="button" class="btn btn-danger" data-dismiss="modal" id="jsbuttonDeleteAccept"><?php $L->p('Delete') ?></button> </div>
</div> </div>
</div> </div>
</div> </div>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$("#jsbuttonDeleteAccept").on("click", function() { function setCategoryBox(value) {
$("#jstype").val("delete"); var selected = $("#jscategory option:selected");
$("#jscontent").val(""); var value = selected.val().trim();
$("#jsform").submit(); if (value) {
$("#jscategoryButton").find("span.option").html(selected.text());
} else {
$("#jscategoryButton").find("span.option").html("-");
}
}
// Set the current category selected
setCategoryBox();
// When the user select the category update the category button
$("#jscategory").on("change", function() {
setCategoryBox();
}); });
}); });
</script> </script>
</div>
<!-- Modal for Description -->
<div id="jsdescriptionModal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Description</h5>
</div>
<div class="modal-body">
<?php
echo Bootstrap::formTextareaBlock(array(
'name'=>'description',
'label'=>'',
'selected'=>'',
'class'=>'',
'value'=>$page->description(),
'rows'=>3,
'placeholder'=>$Language->get('this-field-can-help-describe-the-content')
));
?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Done</button>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
function setDescriptionBox(value) {
var value = $("#jsdescription").val();
if (!value) {
value = '-';
} else {
value = jQuery.trim(value).substring(0, 60).split(" ").slice(0, -1).join(" ") + "...";
}
$("#jsdescriptionButton").find("span.option").html(value);
}
// Set the current description
setDescriptionBox();
// When the user write the description update the description button
$("#jsdescription").on("change", function() {
setDescriptionBox();
});
});
</script>
</form>
<!-- Modal for Media Manager --> <!-- Modal for Media Manager -->
<?php include(PATH_ADMIN_THEMES.'booty/html/media.php'); ?> <?php include(PATH_ADMIN_THEMES.'booty/html/media.php'); ?>
@ -466,91 +344,86 @@ echo Bootstrap::formOpen(array(
<script> <script>
$(document).ready(function() { $(document).ready(function() {
// Define function if they doesn't exist // Datepicker
// This helps if the user doesn't activate any plugin as editor $("#jsdate").datetimepicker({format:DB_DATE_FORMAT});
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 // Button Save
$("#jsbuttonSave").on("click", function() { $(".jsbuttonSave").on("click", function() {
// If the switch is setted to "published", get the value from the selector var type = $("#jstypeTMP option:selected").val();
if ($("#jsswitchButton").data("switch")=="publish") { $("#jstype").val(type);
var value = $("#jstypeSelector option:selected").val();
$("#jstype").val(value);
} else {
$("#jstype").val("draft");
}
// Get the content
$("#jscontent").val( editorGetContent() ); $("#jscontent").val( editorGetContent() );
// Submit the form
$("#jsform").submit(); $("#jsform").submit();
}); });
// Button Save as draft // Button Save as draft
$("#jsbuttonDraft").on("click", function() { $(".jsbuttonDraft").on("click", function() {
// Set the type as draft
$("#jstype").val("draft"); $("#jstype").val("draft");
// Get the content
$("#jscontent").val( editorGetContent() ); $("#jscontent").val( editorGetContent() );
// Submit the form
$("#jsform").submit(); $("#jsform").submit();
}); });
// Autosave // Button Delete
var currentContent = editorGetContent(); $(".jsbuttonDelete").on("click", function() {
$("#jstype").val("delete");
$("#jscontent").val("");
$("#jsform").submit();
});
// External cover image
$("#jsexternalCoverImage").change(function() {
$("#jscoverImage").val( $(this).val() );
});
// Autosave interval
// Autosave works when the content of the page is bigger than 100 characters
setInterval(function() { setInterval(function() {
var uuid = $("#jsuuid").val(); var uuid = $("#jsuuid").val();
var title = $("#jstitle").val() + "[<?php $L->p('Autosave') ?>]"; var title = $("#jstitle").val();
var content = editorGetContent(); var content = editorGetContent();
// Autosave when content has at least 100 characters var ajax = new bluditAjax();
if (content.length<100) { // showAlert is the function to display an alert defined in alert.php
return false; ajax.autosave(uuid, title, content, showAlert);
} },1000*60*AUTOSAVE_INTERVAL);
// Autosave only when the user change the content
if (currentContent!=content) { // Template autocomplete
currentContent = content; $('input[name="template"]').autoComplete({
bluditAjax.saveAsDraft(uuid, title, content).then(function(data) { minChars: 2,
if (data.status==0) { source: function(term, suggest){
showAlert("<?php $L->p('Autosave') ?>"); term = term.toLowerCase();
var choices = ['ActionScript', 'Acti', 'Asp'];
var matches = [];
for (i=0; i<choices.length; i++)
if (~choices[i].toLowerCase().indexOf(term)) matches.push(choices[i]);
suggest(matches);
} }
}); });
// Parent autocomplete
var parentsXHR;
var parentsList; // Keep the parent list returned to get the key by the title page
$("#jsparentTMP").autoComplete({
minChars: 1,
source: function(term, response) {
// Prevent call inmediatly another ajax request
try { parentsXHR.abort(); } catch(e){}
parentsXHR = $.getJSON(HTML_PATH_ADMIN_ROOT+"ajax/get-parents", {query: term},
function(data) {
parentsList = data;
term = term.toLowerCase();
var matches = [];
for (var title in data) {
if (~title.toLowerCase().indexOf(term))
matches.push(title);
} }
},1000*60*AUTOSAVE_INTERVAL); response(matches);
});
},
onSelect: function(e, term, item) {
// parentsList = array( pageTitle => pageKey )
var parentKey = parentsList[term];
$("#jsparent").attr("value", parentKey);
}
});
}); });
</script> </script>

View File

@ -1,44 +1,19 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?> <?php defined('BLUDIT') or die('Bludit CMS.');
<?php echo Bootstrap::formOpen(array('id'=>'jsform', 'class'=>'tab-content')); ?> echo Bootstrap::pageTitle(array('title'=>$L->g('Edit user'), 'icon'=>'person'));
<div class="align-middle"> echo Bootstrap::formOpen(array());
<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( echo Bootstrap::formInputHidden(array(
'name'=>'tokenCSRF', 'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF() 'value'=>$security->getTokenCSRF()
)); ));
// Username
echo Bootstrap::formInputHidden(array( echo Bootstrap::formInputHidden(array(
'name'=>'username', 'name'=>'username',
'value'=>$user->username() 'value'=>$user->username()
)); ));
?>
<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( echo Bootstrap::formInputText(array(
'name'=>'usernameDisabled', 'name'=>'usernameDisabled',
'label'=>$L->g('Username'), 'label'=>$L->g('Username'),
@ -53,10 +28,10 @@
echo Bootstrap::formSelect(array( echo Bootstrap::formSelect(array(
'name'=>'role', 'name'=>'role',
'label'=>$L->g('Role'), 'label'=>$L->g('Role'),
'options'=>array('author'=>$L->g('Author'), 'editor'=>$L->g('Editor'), 'admin'=>$L->g('Administrator')), 'options'=>array('editor'=>$L->g('Editor'), 'moderator'=>$L->g('Moderator'), 'admin'=>$L->g('Administrator')),
'selected'=>$user->role(), 'selected'=>$user->role(),
'class'=>'', 'class'=>'',
'tip'=>$L->g('author-can-write-and-edit-their-own-content') 'tip'=>''
)); ));
} }
@ -69,14 +44,7 @@
'tip'=>'' 'tip'=>''
)); ));
echo Bootstrap::formInputText(array( echo Bootstrap::formTitle(array('title'=>$L->g('Profile')));
'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( echo Bootstrap::formInputText(array(
'name'=>'firstName', 'name'=>'firstName',
@ -95,64 +63,16 @@
'placeholder'=>'', 'placeholder'=>'',
'tip'=>'' '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 Bootstrap::formTitle(array('title'=>$L->g('Password')));
echo ' echo '
<div class="form-group"> <div class="form-group row">
<div class="col-sm-2"></div>
<div class="col-sm-10">
<a href="'.HTML_PATH_ADMIN_ROOT.'user-password/'.$user->username().'" class="btn btn-primary mr-2">'.$L->g('Change password').'</a> <a href="'.HTML_PATH_ADMIN_ROOT.'user-password/'.$user->username().'" class="btn btn-primary mr-2">'.$L->g('Change password').'</a>
</div> </div>
</div>
'; ';
echo Bootstrap::formTitle(array('title'=>$L->g('Authentication Token'))); echo Bootstrap::formTitle(array('title'=>$L->g('Authentication Token')));
@ -165,7 +85,6 @@
'tip'=>$L->g('this-token-is-similar-to-a-password-it-should-not-be-shared') '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::formTitle(array('title'=>$L->g('Status')));
echo Bootstrap::formInputText(array( echo Bootstrap::formInputText(array(
@ -182,26 +101,21 @@
<div class="form-group row"> <div class="form-group row">
<div class="col-sm-2"></div> <div class="col-sm-2"></div>
<div class="col-sm-10"> <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-primary 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="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> <button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndDeleteContent" name="deleteUserAndDeleteContent">'.$L->g('Delete user and delete content !!!').'</button>
</div> </div>
</div> </div>
'; ';
} }
}
?>
</div>
<!-- Social Networks tab --> echo Bootstrap::formTitle(array('title'=>$L->g('Social Networks')));
<div class="tab-pane fade" id="social" role="tabpanel" aria-labelledby="nav-social-tab">
<?php
echo Bootstrap::formInputText(array( echo Bootstrap::formInputText(array(
'name'=>'twitter', 'name'=>'twitter',
'label'=>'Twitter', 'label'=>'Twitter',
'value'=>$user->twitter(), 'value'=>$user->twitter(),
'class'=>'', 'class'=>'',
'placeholder'=>'',
'tip'=>'' 'tip'=>''
)); ));
@ -210,16 +124,22 @@
'label'=>'Facebook', 'label'=>'Facebook',
'value'=>$user->facebook(), 'value'=>$user->facebook(),
'class'=>'', 'class'=>'',
'placeholder'=>'',
'tip'=>'' 'tip'=>''
)); ));
echo Bootstrap::formInputText(array( echo Bootstrap::formInputText(array(
'name'=>'codepen', 'name'=>'codepen',
'label'=>'CodePen', 'label'=>'Codepen',
'value'=>$user->codepen(), 'value'=>$user->codepen(),
'class'=>'', 'class'=>'',
'placeholder'=>'', 'tip'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'googlePlus',
'label'=>'Google+',
'value'=>$user->googlePlus(),
'class'=>'',
'tip'=>'' 'tip'=>''
)); ));
@ -228,71 +148,34 @@
'label'=>'Instagram', 'label'=>'Instagram',
'value'=>$user->instagram(), 'value'=>$user->instagram(),
'class'=>'', 'class'=>'',
'placeholder'=>'',
'tip'=>'' 'tip'=>''
)); ));
echo Bootstrap::formInputText(array( echo '
'name'=>'gitlab', <div class="form-group mt-4">
'label'=>'GitLab', <button type="submit" class="btn btn-primary mr-2" name="save">'.$L->g('Save').'</button>
'value'=>$user->gitlab(), <a class="btn btn-secondary" href="'.HTML_PATH_ADMIN_ROOT.'users" role="button">'.$L->g('Cancel').'</a>
'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>
</div> ';
<?php echo Bootstrap::formClose(); ?> echo Bootstrap::formClose();
?>
<script> <script>
// Open current tab after refresh page $(document).ready(function() {
$(function() {
$('a[data-toggle="tab"]').on('click', function(e) { $("#jsdeleteUserAndDeleteContent").click(function() {
window.localStorage.setItem('activeTab', $(e.target).attr('href')); if(confirm("<?php $Language->p('Confirm delete this action cannot be undone') ?>")==false) {
console.log($(e.target).attr('href')); return false;
});
var activeTab = window.localStorage.getItem('activeTab');
if (activeTab) {
$('#nav-tab a[href="' + activeTab + '"]').tab('show');
//window.localStorage.removeItem("activeTab");
} }
}); });
$("#jsdeleteUserAndKeepContent").click(function() {
if(confirm("<?php $Language->p('Confirm delete this action cannot be undone') ?>")==false) {
return false;
}
});
});
</script> </script>

View File

@ -11,7 +11,7 @@ echo Bootstrap::formOpen(array());
echo ' echo '
<div class="form-group"> <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> <input type="text" value="'.(isset($_POST['username'])?$_POST['username']:'').'" class="form-control form-control-lg" id="jsusername" name="username" placeholder="'.$L->g('Username').'">
</div> </div>
'; ';
@ -28,7 +28,7 @@ echo Bootstrap::formOpen(array());
</div> </div>
<div class="form-group mt-4"> <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> <button type="submit" class="btn btn-primary mr-2 w-100 text-" name="save">'.$L->g('Login').'</button>
</div> </div>
'; ';

View File

@ -1,39 +1,28 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?> <?php defined('BLUDIT') or die('Bludit CMS.');
<?php echo Bootstrap::formOpen(array('id'=>'jsform', 'class'=>'tab-content')); ?> echo Bootstrap::pageTitle(array('title'=>$L->g('New Category'), 'icon'=>'grid-three-up'));
<div class="align-middle"> echo Bootstrap::formOpen(array());
<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( echo Bootstrap::formInputHidden(array(
'name'=>'tokenCSRF', 'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF() 'value'=>$security->getTokenCSRF()
)); ));
echo Bootstrap::formInputText(array( echo Bootstrap::formInputTextBlock(array(
'name'=>'name', 'name'=>'category',
'label'=>$L->g('Name'), 'label'=>$L->g('Category name'),
'value'=>isset($_POST['category'])?$_POST['category']:'', 'value'=>isset($_POST['category'])?$_POST['category']:'',
'class'=>'', 'class'=>'',
'placeholder'=>'', 'placeholder'=>'',
'tip'=>'' 'tip'=>''
)); ));
echo Bootstrap::formTextarea(array( echo '
'name'=>'description', <div class="form-group mt-4">
'label'=>$L->g('Description'), <button type="submit" class="btn btn-primary mr-2">Save</button>
'value'=>isset($_POST['description'])?$_POST['description']:'', <a class="btn btn-secondary" href="'.HTML_PATH_ADMIN_ROOT.'categories" role="button">Cancel</a>
'class'=>'', </div>
'placeholder'=>'', ';
'tip'=>'',
'rows'=>3
));
?>
<?php echo Bootstrap::formClose(); ?> echo Bootstrap::formClose();

View File

@ -1,12 +1,22 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?> <?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<?php <!-- TABS -->
<ul class="nav nav-tabs" id="dynamicTab" role="tablist">
// Start form <li class="nav-item">
echo Bootstrap::formOpen(array( <a class="nav-link active" id="content-tab" data-toggle="tab" href="#content" role="tab" aria-controls="content" aria-selected="true">Editor</a>
</li>
<li class="nav-item">
<a class="nav-link" id="images-tab" data-toggle="tab" href="#images" role="tab" aria-controls="images" aria-selected="false">Images</a>
</li>
<li class="nav-item">
<a class="nav-link " id="options-tab" data-toggle="tab" href="#options" role="tab" aria-controls="options" aria-selected="false">Options</a>
</li>
</ul>
<?php
echo Bootstrap::formOpen(array(
'id'=>'jsform', 'id'=>'jsform',
'class'=>'d-flex flex-column h-100' 'class'=>'tab-content mt-1'
)); ));
// Token CSRF // Token CSRF
echo Bootstrap::formInputHidden(array( echo Bootstrap::formInputHidden(array(
@ -14,14 +24,19 @@ echo Bootstrap::formOpen(array(
'value'=>$security->getTokenCSRF() 'value'=>$security->getTokenCSRF()
)); ));
// UUID // Parent
// The UUID is generated in the controller
echo Bootstrap::formInputHidden(array( echo Bootstrap::formInputHidden(array(
'name'=>'uuid', 'name'=>'parent',
'value'=>$uuid 'value'=>''
)); ));
// Type = published, draft, sticky, static // UUID
echo Bootstrap::formInputHidden(array(
'name'=>'uuid',
'value'=>$dbPages->generateUUID()
));
// Status = published, draft, sticky, static
echo Bootstrap::formInputHidden(array( echo Bootstrap::formInputHidden(array(
'name'=>'type', 'name'=>'type',
'value'=>'published' 'value'=>'published'
@ -38,218 +53,289 @@ echo Bootstrap::formOpen(array(
'name'=>'content', 'name'=>'content',
'value'=>'' '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 --> <!-- TABS CONTENT -->
<label class="mt-4 mb-2 pb-2 border-bottom text-uppercase w-100"><?php $L->p('Cover Image') ?></label> <div class="tab-pane show active" id="content" role="tabpanel" aria-labelledby="content-tab">
<div class="form-group m-0">
<input value="" class="form-control form-control-lg rounded-0 " id="jstitle" name="title" placeholder="Enter title" type="text">
</div>
<div class="form-group m-0 mt-1">
<button id="jsmediaManagerButton" type="button" class="btn btn-form btn-sm" data-toggle="modal" data-target="#jsbluditMediaModal"><span class="oi oi-image"></span> Media Manager</button>
<button id="jscategoryButton" type="button" class="btn btn-form btn-sm" data-toggle="modal" data-target="#jscategoryModal"><span class="oi oi-tags"></span> Category: <span class="option">-</span></button>
<button id="jsdescriptionButton" type="button" class="btn btn-form btn-sm" data-toggle="modal" data-target="#jsdescriptionModal"><span class="oi oi-tags"></span> Description: <span class="option">-</span></button>
</div>
<div class="form-group mt-1">
<textarea id="jseditor" style="display:none;"></textarea>
</div>
<div class="form-group mt-2">
<button type="button" class="jsbuttonSave btn btn-primary"><?php echo $L->g('Publish') ?></button>
<button type="button" class="jsbuttonDraft btn btn-secondary"><?php echo $L->g('Save as draft') ?></button>
<a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn btn-secondary"><?php echo $L->g('Cancel') ?></a>
</div>
</div>
<!-- TABS IMAGES -->
<div class="tab-pane" id="images" role="tabpanel" aria-labelledby="images-tab">
<div> <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 class="float-right">
<button type="button" class="jsbuttonSave btn btn-primary btn-sm"><?php echo $L->g('Publish') ?></button>
<button type="button" class="jsbuttonDraft btn btn-secondary btn-sm"><?php echo $L->g('Save as draft') ?></button>
</div> </div>
<div class="mt-2 text-center"> <h4 class="mt-4 mb-4 font-weight-normal">Cover Image</h4>
<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> </div>
<script>
$(document).ready(function() {
$("#jscoverImagePreview").on("click", function() {
openMediaManager();
});
$("#jsbuttonSelectCoverImage").on("click", function() { <img id="jscoverImagePreview" style="width: 350px; height: 200px;" class="img-thumbnail" alt="coverImagePreview" src="<?php echo HTML_PATH_ADMIN_THEME_IMG ?>default.svg" />
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 <?php
// Template echo Bootstrap::formTitle(array('title'=>$L->g('External Cover Image')));
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( echo Bootstrap::formInputTextBlock(array(
'name'=>'externalCoverImage', 'name'=>'externalCoverImage',
'label'=>$L->g('External cover image'),
'placeholder'=>"https://", 'placeholder'=>"https://",
'value'=>'', 'value'=>'',
'tip'=>$L->g('Set a cover image from external URL, such as a CDN or some server dedicated for images.') 'tip'=>'Set a cover image from external URL, such as a CDN or some server dedicate for images.'
));
// Username
echo Bootstrap::formInputTextBlock(array(
'name'=>'',
'label'=>$L->g('Author'),
'placeholder'=>'',
'value'=>$login->username(),
'tip'=>'',
'disabled'=>true
)); ));
?> ?>
</div>
<!-- TABS OPTIONS -->
<div class="tab-pane" id="options" role="tabpanel" aria-labelledby="options-tab">
<div>
<div class="float-right">
<button type="button" class="jsbuttonSave btn btn-primary btn-sm"><?php echo $L->g('Publish') ?></button>
<button type="button" class="jsbuttonDraft btn btn-secondary btn-sm"><?php echo $L->g('Save as draft') ?></button>
</div>
<h4 class="mt-4 mb-4 font-weight-normal">Advanced</h4>
</div>
<?php
// Date
echo Bootstrap::formInputText(array(
'name'=>'date',
'label'=>'Date',
'placeholder'=>'',
'value'=>Date::current(DB_DATE_FORMAT),
'tip'=>'Date format: <code>YYYY-MM-DD Hours:Minutes:Seconds</code>'
));
// Type
echo Bootstrap::formSelect(array(
'name'=>'typeTMP',
'label'=>'Type',
'selected'=>'',
'options'=>array(
'published'=>'- Default -',
'sticky'=>'Sticky',
'static'=>'Static'
),
'tip'=>'???'
));
// Parent
echo Bootstrap::formInputText(array(
'name'=>'parentTMP',
'label'=>$L->g('Parent'),
'placeholder'=>'',
'tip'=>'Start typing a page title to see a list of suggestions.',
'value'=>''
));
// Position
echo Bootstrap::formInputText(array(
'name'=>'position',
'label'=>$L->g('Position'),
'tip'=>'Field used when ordering content by position',
'value'=>$dbPages->nextPositionNumber()
));
// Template
echo Bootstrap::formInputText(array(
'name'=>'template',
'label'=>'Template',
'placeholder'=>'',
'value'=>'',
'tip'=>'Write a template name to filter the page in the theme and change the style of the page.'
));
echo Bootstrap::formTitle(array('title'=>'SEO'));
// Tags
echo Bootstrap::formInputText(array(
'name'=>'tags',
'label'=>'Tags',
'placeholder'=>'',
'tip'=>'Write the tags separeted by comma'
));
// Friendly URL
echo Bootstrap::formInputText(array(
'name'=>'slug',
'tip'=>$L->g('URL associated with the content'),
'label'=>$L->g('Friendly URL'),
'placeholder'=>'Leave empty for autocomplete by Bludit.'
));
echo Bootstrap::formCheckbox(array(
'name'=>'noindex',
'label'=>'Robots',
'labelForCheckbox'=>'Apply <code>noindex</code> to this page',
'placeholder'=>'',
'class'=>'mt-4',
'checked'=>false,
'tip'=>'This tells search engines not to show this page in their search results.'
));
echo Bootstrap::formCheckbox(array(
'name'=>'nofollow',
'label'=>'',
'labelForCheckbox'=>'Apply <code>nofollow</code> to this page',
'placeholder'=>'',
'checked'=>false,
'tip'=>'This tells search engines not to follow links on this page.'
));
echo Bootstrap::formCheckbox(array(
'name'=>'noarchive',
'label'=>'',
'labelForCheckbox'=>'Apply <code>noarchive</code> to this page',
'placeholder'=>'',
'checked'=>false,
'tip'=>'This tells search engines not to save a cached copy of this page.'
));
?>
</div>
<!-- Modal for Categories -->
<div id="jscategoryModal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Category</h5>
</div>
<div class="modal-body">
<?php
echo Bootstrap::formSelectBlock(array(
'name'=>'category',
'label'=>'',
'selected'=>'',
'class'=>'',
'emptyOption'=>'- Without category -',
'options'=>$dbCategories->getKeyNameArray()
));
?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Done</button>
</div>
</div>
</div>
</div>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
function setCategoryBox(value) {
var selected = $("#jscategory option:selected");
var value = selected.val().trim();
if (value) {
$("#jscategoryButton").find("span.option").html(selected.text());
} else {
$("#jscategoryButton").find("span.option").html("-");
}
}
// Changes in External cover image input // Set the current category selected
setCategoryBox();
// When the user select the category update the category button
$("#jscategory").on("change", function() {
setCategoryBox();
});
});
</script>
<!-- Modal for Description -->
<div id="jsdescriptionModal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Description</h5>
</div>
<div class="modal-body">
<?php
echo Bootstrap::formTextareaBlock(array(
'name'=>'description',
'label'=>'',
'selected'=>'',
'class'=>'',
'value'=>'',
'rows'=>3,
'placeholder'=>$Language->get('this-field-can-help-describe-the-content')
));
?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Done</button>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
function setDescriptionBox(value) {
var value = $("#jsdescription").val();
if (!value) {
value = '-';
} else {
value = jQuery.trim(value).substring(0, 60).split(" ").slice(0, -1).join(" ") + "...";
}
$("#jsdescriptionButton").find("span.option").html(value);
}
// Set the current description
setDescriptionBox();
// When the user write the description update the description button
$("#jsdescription").on("change", function() {
setDescriptionBox();
});
});
</script>
</form>
<!-- Modal for Media Manager -->
<?php include(PATH_ADMIN_THEMES.'booty/html/media.php'); ?>
<script>
$(document).ready(function() {
// Datepicker
$("#jsdate").datetimepicker({format:DB_DATE_FORMAT});
// Button Save
$(".jsbuttonSave").on("click", function() {
var type = $("#jstypeTMP option:selected").val();
$("#jstype").val(type);
$("#jscontent").val( editorGetContent() );
$("#jsform").submit();
});
// Button Save as draft
$(".jsbuttonDraft").on("click", function() {
$("#jstype").val("draft");
$("#jscontent").val( editorGetContent() );
$("#jsform").submit();
});
// External cover image
$("#jsexternalCoverImage").change(function() { $("#jsexternalCoverImage").change(function() {
$("#jscoverImage").val( $(this).val() ); $("#jscoverImage").val( $(this).val() );
}); });
@ -260,240 +346,59 @@ echo Bootstrap::formOpen(array(
var parent = $("#jsparent").val(); var parent = $("#jsparent").val();
var currentKey = ""; var currentKey = "";
var ajax = new bluditAjax(); var ajax = new bluditAjax();
var callBack = $("#jsslug"); ajax.generateSlug(text, parent, currentKey, $("#jsslug"));
ajax.generateSlug(text, parent, currentKey, callBack);
}); });
// Datepicker // Autosave interval
$("#jsdate").datetimepicker({format:DB_DATE_FORMAT}); // Autosave works when the content of the page is bigger than 100 characters
setInterval(function() {
});
</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 uuid = $("#jsuuid").val();
var title = $("#jstitle").val(); var title = $("#jstitle").val();
var content = editorGetContent(); var content = editorGetContent();
bluditAjax.saveAsDraft(uuid, title, content).then(function(data) { var ajax = new bluditAjax();
var preview = window.open("<?php echo DOMAIN_PAGES.'autosave-'.$uuid.'?preview='.md5('autosave-'.$uuid) ?>", "bludit-preview"); // showAlert is the function to display an alert defined in alert.php
preview.focus(); ajax.autosave(uuid, title, content, showAlert);
});
});
// 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); },1000*60*AUTOSAVE_INTERVAL);
// Template autocomplete
$('input[name="template"]').autoComplete({
minChars: 2,
source: function(term, suggest){
term = term.toLowerCase();
var choices = ['ActionScript', 'Acti', 'Asp'];
var matches = [];
for (i=0; i<choices.length; i++)
if (~choices[i].toLowerCase().indexOf(term)) matches.push(choices[i]);
suggest(matches);
}
});
// Parent autocomplete
var parentsXHR;
var parentsList; // Keep the parent list returned to get the key by the title page
$("#jsparentTMP").autoComplete({
minChars: 1,
source: function(term, response) {
// Prevent call inmediatly another ajax request
try { parentsXHR.abort(); } catch(e){}
parentsXHR = $.getJSON(HTML_PATH_ADMIN_ROOT+"ajax/get-parents", {query: term},
function(data) {
parentsList = data;
term = term.toLowerCase();
var matches = [];
for (var title in data) {
if (~title.toLowerCase().indexOf(term))
matches.push(title);
}
response(matches);
});
},
onSelect: function(e, term, item) {
// parentsList = array( pageTitle => pageKey )
var parentKey = parentsList[term];
$("#jsparent").attr("value", parentKey);
}
});
}); });
</script> </script>

View File

@ -1,16 +1,9 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?> <?php defined('BLUDIT') or die('Bludit CMS.');
<?php echo Bootstrap::formOpen(array('id'=>'jsform', 'class'=>'tab-content')); ?> echo Bootstrap::pageTitle(array('title'=>$L->g('Add a new user'), 'icon'=>'person'));
<div class="align-middle"> echo Bootstrap::formOpen(array());
<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( echo Bootstrap::formInputHidden(array(
'name'=>'tokenCSRF', 'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF() 'value'=>$security->getTokenCSRF()
@ -48,10 +41,10 @@
echo Bootstrap::formSelect(array( echo Bootstrap::formSelect(array(
'name'=>'role', 'name'=>'role',
'label'=>$L->g('Role'), 'label'=>$L->g('Role'),
'options'=>array('author'=>$L->g('Author'), 'editor'=>$L->g('Editor'), 'admin'=>$L->g('Administrator')), 'options'=>array('editor'=>$L->g('Editor'), 'moderator'=>$L->g('Moderator'), 'admin'=>$L->g('Administrator')),
'selected'=>'Author', 'selected'=>'editor',
'class'=>'', 'class'=>'',
'tip'=>$L->g('author-can-write-and-edit-their-own-content') 'tip'=>''
)); ));
echo Bootstrap::formInputText(array( echo Bootstrap::formInputText(array(
@ -62,6 +55,12 @@
'placeholder'=>'', 'placeholder'=>'',
'tip'=>'' 'tip'=>''
)); ));
?>
<?php echo Bootstrap::formClose(); ?> echo '
<div class="form-group mt-4">
<button type="submit" class="btn btn-primary mr-2" name="save">'.$L->g('Save').'</button>
<a class="btn btn-secondary" href="'.HTML_PATH_ADMIN_ROOT.'users" role="button">'.$L->g('Cancel').'</a>
</div>
';
echo Bootstrap::formClose();

View File

@ -1,51 +1,38 @@
<?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 <?php
// Token CSRF
echo Bootstrap::formInputHidden(array( HTML::title(array('title'=>$L->g('Plugins Position'), 'icon'=>'puzzle-piece'));
echo '<div class="hint">'.$L->g('drag-and-drop-to-set-the-position-of-the-plugin').'</div>';
echo '<form class="uk-form" method="post" action="" autocomplete="off">';
HTML::formInputHidden(array(
'name'=>'tokenCSRF', 'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF() 'value'=>$security->getTokenCSRF()
)); ));
echo Bootstrap::formInputHidden(array( echo '<div class="uk-sortable" data-uk-sortable>';
'name'=>'plugin-list',
'value'=>''
));
echo '<ul class="list-group list-group-sortable">'; foreach ($plugins['siteSidebar'] as $Plugin) {
foreach ($plugins['siteSidebar'] as $Plugin) { echo '<div class="plugin-position" data-plugin="'.$Plugin->className().'"><i class="uk-icon-bars"></i> '.$Plugin->name().'</div>';
echo '<li class="list-group-item" data-plugin="'.$Plugin->className().'"><span class="fa fa-arrows-v"></span> '.$Plugin->name().'</li>'; }
}
echo '</ul>'; echo '</div>';
echo '<input id="plugin-list" name="plugin-list" type="text" value="" hidden/>';
echo '<button class="uk-button uk-button-primary" type="button" id="jsSave">'.$L->g('Save').'</button>';
echo '</form>';
?> ?>
<?php echo Bootstrap::formClose(); ?>
<script> <script>
$(document).ready(function() { $( document ).ready(function() {
$('.list-group-sortable').sortable({ $("#jsSave").on("click", function() {
placeholderClass: 'list-group-item'
});
$(".jsbuttonSave").on("click", function() {
var tmp = []; var tmp = [];
$("li.list-group-item").each(function() { $( "div.plugin-position" ).each(function() {
tmp.push( $(this).attr("data-plugin") ); tmp.push( $(this).attr("data-plugin") );
}); });
$("#jsplugin-list").attr("value", tmp.join(",") ); console.log( tmp.join(",") );
$("#jsform").submit(); $("#plugin-list").attr("value", tmp.join(",") );
$(".uk-form").submit();
}); });
}); });
</script> </script>

View File

@ -5,95 +5,42 @@ echo Bootstrap::pageTitle(array('title'=>$L->g('Plugins'), 'icon'=>'puzzle-piece
echo Bootstrap::link(array( echo Bootstrap::link(array(
'title'=>$L->g('Change the position of the plugins'), 'title'=>$L->g('Change the position of the plugins'),
'href'=>HTML_PATH_ADMIN_ROOT.'plugins-position', 'href'=>HTML_PATH_ADMIN_ROOT.'plugins-position',
'icon'=>'arrows' 'icon'=>'elevator'
)); ));
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')));
echo ' echo '
<table class="table"> <table class="table mt-3">
<thead>
<tr>
<th class="border-bottom-0 w-25" scope="col">'.$L->g('Name').'</th>
<th class="border-bottom-0 d-none d-sm-table-cell" scope="col">'.$L->g('Description').'</th>
<th class="text-center border-bottom-0 d-none d-lg-table-cell" scope="col">'.$L->g('Version').'</th>
<th class="text-center border-bottom-0 d-none d-lg-table-cell" scope="col">'.$L->g('Author').'</th>
</tr>
</thead>
<tbody> <tbody>
'; ';
// Show installed plugins foreach ($plugins['all'] as $plugin) {
foreach ($pluginsInstalled as $plugin) { echo '<tr id="'.$plugin->className().'" '.($plugin->installed()?'class="bg-light"':'').'>
echo '<tr id="'.$plugin->className().'" class="bg-light searchItem">';
echo '<td class="align-middle pt-3 pb-3 w-25"> <td class="align-middle pt-3 pb-3">
<div class="searchText">'.$plugin->name().'</div> <div>'.$plugin->name().'</div>
<div class="mt-1">'; <div class="mt-1">';
if ($plugin->installed()) {
if (method_exists($plugin, 'form')) { 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 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 '<a href="'.HTML_PATH_ADMIN_ROOT.'uninstall-plugin/'.$plugin->className().'">'.$L->g('Deactivate').'</a>';
} else {
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'install-plugin/'.$plugin->className().'">'.$L->g('Activate').'</a>';
}
echo '</div>'; echo '</div>';
echo '</td>'; echo '</td>';
echo '<td class="searchText align-middle d-none d-sm-table-cell">'; echo '<td class="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>
</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 $plugin->description();
echo '</td>'; echo '</td>';

View File

@ -1,30 +1,30 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?> <?php
<?php echo Bootstrap::formOpen(array('id'=>'jsform', 'class'=>'tab-content')); ?> echo Bootstrap::pageTitle(array('title'=>$L->g('Settings'), 'icon'=>'cog'));
<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.'dashboard' ?>" role="button"><?php $L->p('Cancel') ?></a>
</div>
<?php echo Bootstrap::pageTitle(array('title'=>$L->g('Settings'), 'icon'=>'cog')); ?>
</div>
<!-- TABS --> <!-- TABS -->
<nav class="mb-3"> <ul class="nav nav-tabs" id="dynamicTab" role="tablist">
<div class="nav nav-tabs" id="nav-tab" role="tablist"> <li class="nav-item">
<a class="nav-item nav-link active" id="nav-general-tab" data-toggle="tab" href="#general" role="tab" aria-controls="nav-general" aria-selected="false"><?php $L->p('General') ?></a> <a class="nav-link active" id="general-tab" data-toggle="tab" href="#general" role="tab" aria-controls="general" aria-selected="true">General</a>
<a class="nav-item nav-link" id="nav-advanced-tab" data-toggle="tab" href="#advanced" role="tab" aria-controls="nav-advanced" aria-selected="false"><?php $L->p('Advanced') ?></a> </li>
<a class="nav-item nav-link" id="nav-seo-tab" data-toggle="tab" href="#seo" role="tab" aria-controls="nav-seo" aria-selected="false"><?php $L->p('SEO') ?></a> <li class="nav-item">
<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> <a class="nav-link " id="advanced-tab" data-toggle="tab" href="#advanced" role="tab" aria-controls="advanced" aria-selected="false">Advanced</a>
<a class="nav-item nav-link" id="nav-images-tab" data-toggle="tab" href="#images" role="tab" aria-controls="nav-images" aria-selected="false"><?php $L->p('Images') ?></a> </li>
<a class="nav-item nav-link" id="nav-language-tab" data-toggle="tab" href="#language" role="tab" aria-controls="nav-language" aria-selected="false"><?php $L->p('Language') ?></a> <li class="nav-item">
<a class="nav-item nav-link" id="nav-custom-fields-tab" data-toggle="tab" href="#custom-fields" role="tab" aria-controls="nav-custom-fields" aria-selected="false"><?php $L->p('Custom fields') ?></a> <a class="nav-link " id="social-tab" data-toggle="tab" href="#social" role="tab" aria-controls="social" aria-selected="false">Social Networks</a>
<a class="nav-item nav-link" id="nav-logo-tab" data-toggle="tab" href="#logo" role="tab" aria-controls="nav-logo" aria-selected="false"><?php $L->p('Logo') ?></a> </li>
</div> <li class="nav-item">
</nav> <a class="nav-link" id="language-tab" data-toggle="tab" href="#language" role="tab" aria-controls="language" aria-selected="false">Language</a>
</li>
</ul>
<?php <?php
echo Bootstrap::formOpen(array(
'id'=>'dynamicTabContent',
'class'=>'tab-content mt-4'
));
// Token CSRF // Token CSRF
echo Bootstrap::formInputHidden(array( echo Bootstrap::formInputHidden(array(
'name'=>'tokenCSRF', 'name'=>'tokenCSRF',
@ -32,12 +32,9 @@
)); ));
?> ?>
<!-- General tab --> <!-- TABS GENERAL -->
<div class="tab-pane fade show active" id="general" role="tabpanel" aria-labelledby="general-tab"> <div class="tab-pane show active" id="general" role="tabpanel" aria-labelledby="general-tab">
<?php <?php
echo Bootstrap::formTitle(array('title'=>$L->g('Site')));
echo Bootstrap::formInputText(array( echo Bootstrap::formInputText(array(
'name'=>'title', 'name'=>'title',
'label'=>$L->g('Site title'), 'label'=>$L->g('Site title'),
@ -73,11 +70,18 @@
'placeholder'=>'', 'placeholder'=>'',
'tip'=>$L->g('you-can-add-a-small-text-on-the-bottom') 'tip'=>$L->g('you-can-add-a-small-text-on-the-bottom')
)); ));
echo '
<div class="form-group mt-4">
<button type="submit" class="btn btn-primary mr-2" name="save">'.$L->g('Save').'</button>
<a class="btn btn-secondary" href="'.HTML_PATH_ADMIN_ROOT.'dashboard" role="button">'.$L->g('Cancel').'</a>
</div>
';
?> ?>
</div> </div>
<!-- Advanced tab --> <!-- TABS ADVANCED -->
<div class="tab-pane fade" id="advanced" role="tabpanel" aria-labelledby="advanced-tab"> <div class="tab-pane" id="advanced" role="tabpanel" aria-labelledby="advanced-tab">
<?php <?php
echo Bootstrap::formTitle(array('title'=>$L->g('Content'))); echo Bootstrap::formTitle(array('title'=>$L->g('Content')));
@ -101,97 +105,25 @@
echo Bootstrap::formTitle(array('title'=>$L->g('Predefined pages'))); echo Bootstrap::formTitle(array('title'=>$L->g('Predefined pages')));
// Homepage echo Bootstrap::formInputText(array(
try {
$options = array();
$homeKey = $site->homepage();
if (!empty($homeKey)) {
$home = new Page($homeKey);
$options = array($homeKey=>$home->title());
}
} catch (Exception $e) {
// continue
}
echo Bootstrap::formSelect(array(
'name'=>'homepage', 'name'=>'homepage',
'label'=>$L->g('Homepage'), 'label'=>$L->g('Homepage'),
'options'=>$options, 'value'=>(Text::isEmpty($site->homepage())?'':$site->homepage()),
'selected'=>false,
'class'=>'', 'class'=>'',
'placeholder'=>'Start writing the title of the page',
'tip'=>$L->g('Returning page for the main page') 'tip'=>$L->g('Returning page for the main page')
)); ));
?>
<script>
$(document).ready(function() {
var homepage = $("#jshomepage").select2({
placeholder: "<?php $L->p('Start typing to see a list of suggestions.') ?>",
allowClear: true,
theme: "bootstrap4",
minimumInputLength: 2,
ajax: {
url: HTML_PATH_ADMIN_ROOT+"ajax/get-published",
data: function (params) {
var query = { query: params.term }
return query;
},
processResults: function (data) {
return data;
}
},
escapeMarkup: function(markup) {
return markup;
}
});
});
</script>
<?php $homepageOptions[' '] = '- '.$L->g('Default message').' -';
// Page not found 404
try {
$options = array();
$pageNotFoundKey = $site->pageNotFound();
if (!empty($pageNotFoundKey)) {
$pageNotFound = new Page($pageNotFoundKey);
$options = array($pageNotFoundKey=>$pageNotFound->title());
}
} catch (Exception $e) {
// continue
}
echo Bootstrap::formSelect(array( echo Bootstrap::formSelect(array(
'name'=>'pageNotFound', 'name'=>'pageNotFound',
'label'=>$L->g('Page not found'), 'label'=>$L->g('Page not found'),
'options'=>$options, 'options'=>$homepageOptions,
'selected'=>false, 'selected'=>$site->pageNotFound(),
'class'=>'', 'class'=>'',
'tip'=>$L->g('Returning page when the page doesnt exist') 'tip'=>$L->g('Returning page when the page doesnt exist')
)); ));
?>
<script>
$(document).ready(function() {
var homepage = $("#jspageNotFound").select2({
placeholder: "<?php $L->p('Start typing to see a list of suggestions.') ?>",
allowClear: true,
theme: "bootstrap4",
minimumInputLength: 2,
ajax: {
url: HTML_PATH_ADMIN_ROOT+"ajax/get-published",
data: function (params) {
var query = { query: params.term }
return query;
},
processResults: function (data) {
return data;
}
},
escapeMarkup: function(markup) {
return markup;
}
});
});
</script>
<?php
echo Bootstrap::formTitle(array('title'=>$L->g('Email account settings'))); echo Bootstrap::formTitle(array('title'=>$L->g('Email account settings')));
echo Bootstrap::formInputText(array( echo Bootstrap::formInputText(array(
@ -226,15 +158,57 @@
'placeholder'=>'https://' 'placeholder'=>'https://'
)); ));
echo Bootstrap::formTitle(array('title'=>$L->g('Page content'))); echo Bootstrap::formTitle(array('title'=>$L->g('Extreme friendly URL')));
echo Bootstrap::formSelect(array( echo Bootstrap::formSelect(array(
'name'=>'markdownParser', 'name'=>'extremeFriendly',
'label'=>$L->g('Markdown parser'), 'label'=>'Allow Unicode',
'options'=>array('true'=>$L->g('Enabled'), 'false'=>$L->g('Disabled')), 'options'=>array('true'=>'Enabled', 'false'=>'Disable'),
'selected'=>($site->markdownParser()?'true':'false'), 'selected'=>$site->extremeFriendly(),
'class'=>'', 'class'=>'',
'tip'=>$L->g('Enable the markdown parser for the content of the page.') 'tip'=>'Allow unicode characters in the URL and some part of the system.'
));
echo Bootstrap::formTitle(array('title'=>$L->g('Title formats')));
echo Bootstrap::formInputText(array(
'name'=>'titleFormatHomepage',
'label'=>'Homepage',
'value'=>$site->titleFormatHomepage(),
'class'=>'',
'placeholder'=>'',
'tip'=>'Variables allowed: <code>{{site-title}}</code> <code>{{site-slogan}}</code> <code>{{site-description}}</code>',
'placeholder'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'titleFormatPages',
'label'=>'Pages',
'value'=>$site->titleFormatPages(),
'class'=>'',
'placeholder'=>'',
'tip'=>'Variables allowed: <code>{{page-title}}</code> <code>{{page-description}}</code> <code>{{site-title}}</code> <code>{{site-slogan}}</code> <code>{{site-description}}</code>',
'placeholder'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'titleFormatCategory',
'label'=>'Category',
'value'=>$site->titleFormatCategory(),
'class'=>'',
'placeholder'=>'',
'tip'=>'Variables allowed: <code>{{category-name}}</code> <code>{{site-title}}</code> <code>{{site-slogan}}</code> <code>{{site-description}}</code>',
'placeholder'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'titleFormatTag',
'label'=>'Tag',
'value'=>$site->titleFormatTag(),
'class'=>'',
'placeholder'=>'',
'tip'=>'Variables allowed: <code>{{tag-name}}</code> <code>{{site-title}}</code> <code>{{site-slogan}}</code> <code>{{site-description}}</code>',
'placeholder'=>''
)); ));
echo Bootstrap::formTitle(array('title'=>$L->g('URL Filters'))); echo Bootstrap::formTitle(array('title'=>$L->g('URL Filters')));
@ -273,71 +247,20 @@
'class'=>'', 'class'=>'',
'placeholder'=>'', 'placeholder'=>'',
'tip'=>DOMAIN.$site->uriFilters('blog'), 'tip'=>DOMAIN.$site->uriFilters('blog'),
'disabled'=>Text::isEmpty($site->uriFilters('blog')) 'disabled'=>!$site->uriFilters('blog')
)); ));
echo '
<div class="form-group mt-4">
<button type="submit" class="btn btn-primary mr-2" name="save">'.$L->g('Save').'</button>
<a class="btn btn-secondary" href="'.HTML_PATH_ADMIN_ROOT.'dashboard" role="button">'.$L->g('Cancel').'</a>
</div>
';
?> ?>
</div> </div>
<!-- SEO tab --> <!-- TABS SOCIAL NETWORKS -->
<div class="tab-pane fade" id="seo" role="tabpanel" aria-labelledby="seo-tab"> <div class="tab-pane" id="social" role="tabpanel" aria-labelledby="social-tab">
<?php
echo Bootstrap::formTitle(array('title'=>$L->g('Extreme friendly URL')));
echo Bootstrap::formSelect(array(
'name'=>'extremeFriendly',
'label'=>$L->g('Allow Unicode'),
'options'=>array('true'=>$L->g('Enabled'), 'false'=>$L->g('Disabled')),
'selected'=>($site->extremeFriendly()?'true':'false'),
'class'=>'',
'tip'=>$L->g('Allow unicode characters in the URL and some part of the system.')
));
echo Bootstrap::formTitle(array('title'=>$L->g('Title formats')));
echo Bootstrap::formInputText(array(
'name'=>'titleFormatHomepage',
'label'=>$L->g('Homepage'),
'value'=>$site->titleFormatHomepage(),
'class'=>'',
'placeholder'=>'',
'tip'=>$L->g('Variables allowed').' <code>{{site-title}}</code> <code>{{site-slogan}}</code> <code>{{site-description}}</code>',
'placeholder'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'titleFormatPages',
'label'=>$L->g('Pages'),
'value'=>$site->titleFormatPages(),
'class'=>'',
'placeholder'=>'',
'tip'=>$L->g('Variables allowed').' <code>{{page-title}}</code> <code>{{page-description}}</code> <code>{{site-title}}</code> <code>{{site-slogan}}</code> <code>{{site-description}}</code>',
'placeholder'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'titleFormatCategory',
'label'=>$L->g('Category'),
'value'=>$site->titleFormatCategory(),
'class'=>'',
'placeholder'=>'',
'tip'=>$L->g('Variables allowed').' <code>{{category-name}}</code> <code>{{site-title}}</code> <code>{{site-slogan}}</code> <code>{{site-description}}</code>',
'placeholder'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'titleFormatTag',
'label'=>$L->g('Tag'),
'value'=>$site->titleFormatTag(),
'class'=>'',
'placeholder'=>'',
'tip'=>$L->g('Variables allowed').' <code>{{tag-name}}</code> <code>{{site-title}}</code> <code>{{site-slogan}}</code> <code>{{site-description}}</code>',
'placeholder'=>''
));
?>
</div>
<!-- Social Network tab -->
<div class="tab-pane fade" id="social" role="tabpanel" aria-labelledby="social-tab">
<?php <?php
echo Bootstrap::formInputText(array( echo Bootstrap::formInputText(array(
'name'=>'twitter', 'name'=>'twitter',
@ -359,13 +282,22 @@
echo Bootstrap::formInputText(array( echo Bootstrap::formInputText(array(
'name'=>'codepen', 'name'=>'codepen',
'label'=>'CodePen', 'label'=>'Codepen',
'value'=>$site->codepen(), 'value'=>$site->codepen(),
'class'=>'', 'class'=>'',
'placeholder'=>'', 'placeholder'=>'',
'tip'=>'' 'tip'=>''
)); ));
echo Bootstrap::formInputText(array(
'name'=>'googlePlus',
'label'=>'Google+',
'value'=>$site->googlePlus(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
));
echo Bootstrap::formInputText(array( echo Bootstrap::formInputText(array(
'name'=>'instagram', 'name'=>'instagram',
'label'=>'Instagram', 'label'=>'Instagram',
@ -377,7 +309,7 @@
echo Bootstrap::formInputText(array( echo Bootstrap::formInputText(array(
'name'=>'gitlab', 'name'=>'gitlab',
'label'=>'GitLab', 'label'=>'Gitlab',
'value'=>$site->gitlab(), 'value'=>$site->gitlab(),
'class'=>'', 'class'=>'',
'placeholder'=>'', 'placeholder'=>'',
@ -386,7 +318,7 @@
echo Bootstrap::formInputText(array( echo Bootstrap::formInputText(array(
'name'=>'github', 'name'=>'github',
'label'=>'GitHub', 'label'=>'Github',
'value'=>$site->github(), 'value'=>$site->github(),
'class'=>'', 'class'=>'',
'placeholder'=>'', 'placeholder'=>'',
@ -395,85 +327,30 @@
echo Bootstrap::formInputText(array( echo Bootstrap::formInputText(array(
'name'=>'linkedin', 'name'=>'linkedin',
'label'=>'LinkedIn', 'label'=>'Linkedin',
'value'=>$site->linkedin(), 'value'=>$site->linkedin(),
'class'=>'', 'class'=>'',
'placeholder'=>'', 'placeholder'=>'',
'tip'=>'' 'tip'=>''
)); ));
echo Bootstrap::formInputText(array( echo '
'name'=>'mastodon', <div class="form-group mt-4">
'label'=>'Mastodon', <button type="submit" class="btn btn-primary mr-2" name="save">'.$L->g('Save').'</button>
'value'=>$site->mastodon(), <a class="btn btn-secondary" href="'.HTML_PATH_ADMIN_ROOT.'dashboard" role="button">'.$L->g('Cancel').'</a>
'class'=>'', </div>
'placeholder'=>'', ';
'tip'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'dribbble',
'label'=>'Dribbble',
'value'=>$site->dribbble(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
));
echo Bootstrap::formInputText(array(
'name'=>'vk',
'label'=>'VK',
'value'=>$site->vk(),
'class'=>'',
'placeholder'=>'',
'tip'=>''
));
?> ?>
</div> </div>
<!-- Images tab --> <!-- TABS TIMEZONE AND LANGUAGES -->
<div class="tab-pane fade" id="images" role="tabpanel" aria-labelledby="images-tab"> <div class="tab-pane" id="language" role="tabpanel" aria-labelledby="language-tab">
<?php <?php
echo Bootstrap::formTitle(array('title'=>$L->g('Thumbnails')));
echo Bootstrap::formInputText(array(
'name'=>'thumbnailWidth',
'label'=>$L->g('Width'),
'value'=>$site->thumbnailWidth(),
'class'=>'',
'placeholder'=>'',
'tip'=>$L->g('Thumbnail width in pixels')
));
echo Bootstrap::formInputText(array(
'name'=>'thumbnailHeight',
'label'=>$L->g('Height'),
'value'=>$site->thumbnailHeight(),
'class'=>'',
'placeholder'=>'',
'tip'=>$L->g('Thumbnail height in pixels')
));
echo Bootstrap::formInputText(array(
'name'=>'thumbnailQuality',
'label'=>$L->g('Quality'),
'value'=>$site->thumbnailQuality(),
'class'=>'',
'placeholder'=>'',
'tip'=>$L->g('Thumbnail quality in percentage')
));
?>
</div>
<!-- Timezone and language tab -->
<div class="tab-pane fade" id="language" role="tabpanel" aria-labelledby="language-tab">
<?php
echo Bootstrap::formTitle(array('title'=>$L->g('Language and timezone')));
echo Bootstrap::formSelect(array( echo Bootstrap::formSelect(array(
'name'=>'language', 'name'=>'language',
'label'=>$L->g('Language'), 'label'=>$L->g('Language'),
'options'=>$L->getLanguageList(), 'options'=>$Language->getLanguageList(),
'selected'=>$site->language(), 'selected'=>$site->language(),
'class'=>'', 'class'=>'',
'tip'=>$L->g('select-your-sites-language') 'tip'=>$L->g('select-your-sites-language')
@ -507,86 +384,58 @@
'placeholder'=>'', 'placeholder'=>'',
'tip'=>$L->g('Current format').': '.Date::current($site->dateFormat()) 'tip'=>$L->g('Current format').': '.Date::current($site->dateFormat())
)); ));
echo '
<div class="form-group mt-4">
<button type="submit" class="btn btn-primary mr-2" name="save">'.$L->g('Save').'</button>
<a class="btn btn-secondary" href="'.HTML_PATH_ADMIN_ROOT.'dashboard" role="button">'.$L->g('Cancel').'</a>
</div>
';
?> ?>
</div> </div>
<?php
<!-- Custom fields --> echo Bootstrap::formClose();
<div class="tab-pane fade" id="custom-fields" role="tabpanel" aria-labelledby="custom-fields-tab"> ?>
<?php
echo Bootstrap::formTitle(array('title'=>$L->g('Custom fields')));
echo Bootstrap::formTextarea(array(
'name'=>'customFields',
'label'=>'JSON Format',
'value'=>json_encode($site->customFields(), JSON_PRETTY_PRINT),
'class'=>'',
'placeholder'=>'',
'tip'=>$L->g('define-custom-fields-for-the-content'),
'rows'=>15
));
?>
</div>
<!-- Site logo tab -->
<div class="tab-pane fade" id="logo" role="tabpanel" aria-labelledby="logo-tab">
<?php
echo Bootstrap::formTitle(array('title'=>$L->g('Site logo')));
?>
<div class="container">
<div class="row">
<div class="col-lg-4 col-sm-12 p-0 pr-2">
<div class="custom-file">
<input id="jssiteLogoInputFile" class="custom-file-input" type="file" name="inputFile">
<label for="jssiteLogoInputFile" class="custom-file-label"><?php $L->p('Upload image'); ?></label>
</div>
<button id="jsbuttonRemoveLogo" type="button" class="btn btn-primary w-100 mt-4 mb-4"><i class="fa fa-trash"></i><?php $L->p('Remove logo') ?></button>
</div>
<div class="col-lg-8 col-sm-12 p-0 text-center">
<img id="jssiteLogoPreview" class="img-fluid img-thumbnail" alt="Site logo preview" src="<?php echo ($site->logo()?DOMAIN_UPLOADS.$site->logo(false).'?version='.time():HTML_PATH_CORE_IMG.'default.svg') ?>" />
</div>
</div>
</div>
<script>
$("#jsbuttonRemoveLogo").on("click", function() {
bluditAjax.removeLogo();
$("#jssiteLogoPreview").attr("src", "<?php echo HTML_PATH_CORE_IMG.'default.svg' ?>");
});
$("#jssiteLogoInputFile").on("change", function() {
var formData = new FormData();
formData.append('tokenCSRF', tokenCSRF);
formData.append('inputFile', $(this)[0].files[0]);
$.ajax({
url: HTML_PATH_ADMIN_ROOT+"ajax/logo-upload",
type: "POST",
data: formData,
cache: false,
contentType: false,
processData: false
}).done(function(data) {
if (data.status==0) {
$("#jssiteLogoPreview").attr('src',data.absoluteURL+"?time="+Math.random());
} else {
showAlert(data.message);
}
});
});
</script>
</div>
<?php echo Bootstrap::formClose(); ?>
<script> <script>
// Open current tab after refresh page $(document).ready(function() {
$(function() {
$('a[data-toggle="tab"]').on('click', function(e) { // Parent autocomplete
window.localStorage.setItem('activeTab', $(e.target).attr('href')); var homepageXHR;
var homepageList; // Keep the parent list returned to get the key by the title page
$("#jshomepage").autoComplete({
minChars: 1,
source: function(term, response) {
// Prevent call inmediatly another ajax request
try { homepageXHR.abort(); } catch(e){}
homepageXHR = $.getJSON(HTML_PATH_ADMIN_ROOT+"ajax/get-published", {query: term},
function(data) {
homepageList = data;
term = term.toLowerCase();
var matches = [];
for (var title in data) {
if (~title.toLowerCase().indexOf(term))
matches.push(title);
}
response(matches);
}); });
var activeTab = window.localStorage.getItem('activeTab'); },
if (activeTab) { onSelect: function(e, term, item) {
$('#nav-tab a[href="' + activeTab + '"]').tab('show'); // homepageList = array( pageTitle => pageKey )
//window.localStorage.removeItem("activeTab"); var pageKey = homepageList[term];
$("#jsparent").attr("value", pageKey);
} }
}); });
$("#jshomepage").change(function() {
if ($(this).val()) {
$("#jsuriBlog").removeAttr('disabled');
$("#jsuriBlog").attr('value', '/blog/');
} else {
$("#jsuriBlog").attr('value', '');
$("#jsuriBlog").attr('disabled', 'disabled');
}
});
});
</script> </script>

View File

@ -1,6 +1,6 @@
<?php <?php
echo Bootstrap::pageTitle(array('title'=>$L->g('Themes'), 'icon'=>'eye')); echo Bootstrap::pageTitle(array('title'=>$L->g('Themes'), 'icon'=>'puzzle-piece'));
echo ' echo '
<table class="table mt-3"> <table class="table mt-3">

View File

@ -1,29 +1,19 @@
<?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.'edit-user/'.$user->username() ?>" role="button"><?php $L->p('Cancel') ?></a>
</div>
<?php echo Bootstrap::pageTitle(array('title'=>$L->g('Change password'), 'icon'=>'user')); ?>
</div>
<?php <?php
// Token CSRF
echo Bootstrap::pageTitle(array('title'=>$L->g('Change password'), 'icon'=>'person'));
echo Bootstrap::formOpen(array());
echo Bootstrap::formInputHidden(array( echo Bootstrap::formInputHidden(array(
'name'=>'tokenCSRF', 'name'=>'tokenCSRF',
'value'=>$security->getTokenCSRF() 'value'=>$security->getTokenCSRF()
)); ));
// Username
echo Bootstrap::formInputHidden(array( echo Bootstrap::formInputHidden(array(
'name'=>'username', 'name'=>'username',
'value'=>$user->username() 'value'=>$user->username()
)); ));
// Username disabled
echo Bootstrap::formInputText(array( echo Bootstrap::formInputText(array(
'name'=>'usernameDisabled', 'name'=>'usernameDisabled',
'label'=>$L->g('Username'), 'label'=>$L->g('Username'),
@ -34,7 +24,6 @@
'tip'=>'' 'tip'=>''
)); ));
// New password
echo Bootstrap::formInputText(array( echo Bootstrap::formInputText(array(
'name'=>'newPassword', 'name'=>'newPassword',
'label'=>$L->g('New password'), 'label'=>$L->g('New password'),
@ -45,7 +34,6 @@
'tip'=>'' 'tip'=>''
)); ));
// Confirm password
echo Bootstrap::formInputText(array( echo Bootstrap::formInputText(array(
'name'=>'confirmPassword', 'name'=>'confirmPassword',
'label'=>$L->g('Confirm new password'), 'label'=>$L->g('Confirm new password'),
@ -55,6 +43,14 @@
'placeholder'=>'', 'placeholder'=>'',
'tip'=>'' 'tip'=>''
)); ));
?>
<?php echo Bootstrap::formClose(); ?> echo '
<div class="form-group mt-4">
<button type="submit" class="btn btn-primary mr-2" name="save">'.$L->g('Save').'</button>
<a class="btn btn-secondary" href="'.HTML_PATH_ADMIN_ROOT.'users" role="button">'.$L->g('Cancel').'</a>
</div>
';
echo Bootstrap::formClose();
?>

View File

@ -1,8 +1,6 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
<?php <?php
echo Bootstrap::pageTitle(array('title'=>$L->g('Users'), 'icon'=>'users')); echo Bootstrap::pageTitle(array('title'=>$L->g('Users'), 'icon'=>'person'));
echo Bootstrap::link(array( echo Bootstrap::link(array(
'title'=>$L->g('add-a-new-user'), 'title'=>$L->g('add-a-new-user'),
@ -15,7 +13,8 @@ echo '
<thead> <thead>
<tr> <tr>
<th class="border-bottom-0" scope="col">'.$L->g('Username').'</th> <th class="border-bottom-0" scope="col">'.$L->g('Username').'</th>
<th class="border-bottom-0 d-none d-lg-table-cell" scope="col">'.$L->g('Nickname').'</th> <th class="border-bottom-0 d-none d-lg-table-cell" scope="col">'.$L->g('First name').'</th>
<th class="border-bottom-0 d-none d-lg-table-cell" scope="col">'.$L->g('Last name').'</th>
<th class="border-bottom-0" scope="col">'.$L->g('Email').'</th> <th class="border-bottom-0" scope="col">'.$L->g('Email').'</th>
<th class="border-bottom-0" scope="col">'.$L->g('Status').'</th> <th class="border-bottom-0" scope="col">'.$L->g('Status').'</th>
<th class="border-bottom-0" scope="col">'.$L->g('Role').'</th> <th class="border-bottom-0" scope="col">'.$L->g('Role').'</th>
@ -25,29 +24,23 @@ echo '
<tbody> <tbody>
'; ';
$list = $users->keys(); $users = $dbUsers->getAllUsers();
foreach ($list as $username) { foreach ($users as $username=>$User) {
try {
$user = new User($username);
echo '<tr>'; echo '<tr>';
echo '<td><img class="profilePicture mr-1" alt="" src="'.(Sanitize::pathFile(PATH_UPLOADS_PROFILES.$user->username().'.png')?DOMAIN_UPLOADS_PROFILES.$user->username().'.png':HTML_PATH_CORE_IMG.'default.svg').'" /><a href="'.HTML_PATH_ADMIN_ROOT.'edit-user/'.$username.'">'.$username.'</a></td>'; echo '<td><a href="'.HTML_PATH_ADMIN_ROOT.'edit-user/'.$username.'">'.$username.'</a></td>';
echo '<td class="d-none d-lg-table-cell">'.$user->nickname().'</td>'; echo '<td class="d-none d-lg-table-cell">'.$User->firstName().'</td>';
echo '<td>'.$user->email().'</td>'; echo '<td class="d-none d-lg-table-cell">'.$User->lastName().'</td>';
echo '<td>'.($user->enabled()?'<b>'.$L->g('Enabled').'</b>':$L->g('Disabled')).'</td>'; echo '<td>'.$User->email().'</td>';
if ($user->role()=='admin') { echo '<td>'.($User->enabled()?'<b>'.$L->g('Enabled').'</b>':$L->g('Disabled')).'</td>';
if ($User->role()=='admin') {
echo '<td>'.$L->g('Administrator').'</td>'; echo '<td>'.$L->g('Administrator').'</td>';
} elseif ($user->role()=='editor') { } elseif ($User->role()=='moderator') {
echo '<td>'.$L->g('Moderator').'</td>';
} elseif ($User->role()=='editor') {
echo '<td>'.$L->g('Editor').'</td>'; echo '<td>'.$L->g('Editor').'</td>';
} elseif ($user->role()=='author') {
echo '<td>'.$L->g('Author').'</td>';
} else {
echo '<td>'.$L->g('Reader').'</td>';
} }
echo '<td class="d-none d-lg-table-cell">'.Date::format($user->registered(), DB_DATE_FORMAT, ADMIN_PANEL_DATE_FORMAT).'</td>'; echo '<td class="d-none d-lg-table-cell">'.Date::format($User->registered(), DB_DATE_FORMAT, ADMIN_PANEL_DATE_FORMAT).'</td>';
echo '</tr>'; echo '</tr>';
} catch (Exception $e) {
// Continue
}
} }
echo ' echo '

View File

@ -1,68 +0,0 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
header('Content-Type: application/json');
// $_GET
// ----------------------------------------------------------------------------
// (string) $_GET['query']
$query = isset($_GET['query']) ? Text::lowercase($_GET['query']) : false;
// ----------------------------------------------------------------------------
if ($query===false) {
ajaxResponse(1, 'Invalid query.');
}
$result = array();
// MENU
if (Text::stringContains(Text::lowercase($L->g('New content')), $query)) {
$tmp = array('disabled'=>true, 'icon'=>'plus-circle', 'type'=>'menu');
$tmp['text'] = $L->g('New content');
$tmp['url'] = HTML_PATH_ADMIN_ROOT.'new-content';
array_push($result, $tmp);
}
if (Text::stringContains(Text::lowercase($L->g('New category')), $query)) {
$tmp = array('disabled'=>true, 'icon'=>'tag', 'type'=>'menu');
$tmp['text'] = $L->g('New category');
$tmp['url'] = HTML_PATH_ADMIN_ROOT.'new-category';
array_push($result, $tmp);
}
if (Text::stringContains(Text::lowercase($L->g('New user')), $query)) {
$tmp = array('disabled'=>true, 'icon'=>'user', 'type'=>'menu');
$tmp['text'] = $L->g('New user');
$tmp['url'] = HTML_PATH_ADMIN_ROOT.'new-user';
array_push($result, $tmp);
}
if (Text::stringContains(Text::lowercase($L->g('Categories')), $query)) {
$tmp = array('disabled'=>true, 'icon'=>'tags', 'type'=>'menu');
$tmp['text'] = $L->g('Categories');
$tmp['url'] = HTML_PATH_ADMIN_ROOT.'categories';
array_push($result, $tmp);
}
if (Text::stringContains(Text::lowercase($L->g('Users')), $query)) {
$tmp = array('disabled'=>true, 'icon'=>'users', 'type'=>'menu');
$tmp['text'] = $L->g('Users');
$tmp['url'] = HTML_PATH_ADMIN_ROOT.'users';
array_push($result, $tmp);
}
// PAGES
$pagesKey = $pages->getDB();
foreach ($pagesKey as $pageKey) {
try {
$page = new Page($pageKey);
$lowerTitle = Text::lowercase($page->title());
if (Text::stringContains($lowerTitle, $query)) {
$tmp = array('disabled'=>true);
$tmp['id'] = $page->key();
$tmp['text'] = $page->title();
$tmp['type'] = $page->type();
array_push($result, $tmp);
}
} catch (Exception $e) {
// continue
}
}
exit (json_encode(array('results'=>$result)));
?>

View File

@ -1,49 +0,0 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
header('Content-Type: application/json');
/*
| Search for pages that have in the title the string $query and returns the array of pages
|
| @_GET['published'] boolean True to search in published database
| @_GET['static'] boolean True to search in static database
| @_GET['sticky'] boolean True to search in sticky database
| @_GET['scheduled'] boolean True to search in scheduled database
| @_GET['draft'] boolean True to search in draft database
| @_GET['query'] string Text to search in the title
|
| @return array
*/
// $_GET
// ----------------------------------------------------------------------------
$published = empty($_GET['published']) ? false:true;
$static = empty($_GET['static']) ? false:true;
$sticky = empty($_GET['sticky']) ? false:true;
$scheduled = empty($_GET['scheduled']) ? false:true;
$draft = empty($_GET['draft']) ? false:true;
$query = isset($_GET['query']) ? Text::lowercase($_GET['query']) : false;
// ----------------------------------------------------------------------------
if ($query===false) {
ajaxResponse(1, 'Invalid query.');
}
$pageNumber = 1;
$numberOfItems = -1;
$pagesKey = $pages->getList($pageNumber, $numberOfItems, $published, $static, $sticky, $draft, $scheduled);
$tmp = array();
foreach ($pagesKey as $pageKey) {
try {
$page = new Page($pageKey);
$lowerTitle = Text::lowercase($page->title());
if (Text::stringContains($lowerTitle, $query)) {
$tmp[$page->key()] = $page->json(true);
}
} catch (Exception $e) {
// continue
}
}
exit (json_encode($tmp));
?>

View File

@ -0,0 +1,32 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
header('Content-Type: application/json');
// $_POST
// ----------------------------------------------------------------------------
// (string) $_POST['path'] Name of file to delete, just the filename
$filename = isset($_POST['filename']) ? $_POST['filename'] : false;
// ----------------------------------------------------------------------------
if ($filename==false) {
exit (json_encode(array(
'status'=>1,
'message'=>'The filename is empty.'
)));
}
// Check if the filename exist
if (Sanitize::pathFile(PATH_UPLOADS.$filename)) {
Filesystem::rmfile(PATH_UPLOADS.$filename);
}
// Check if the file has a thumbnail
if (Sanitize::pathFile(PATH_UPLOADS_THUMBNAILS.$filename)) {
Filesystem::rmfile(PATH_UPLOADS_THUMBNAILS.$filename);
}
exit (json_encode(array(
'status'=>0,
'message'=>'File deleted.'
)));
?>

View File

@ -1,43 +0,0 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
header('Content-Type: application/json');
/*
| Delete an image from a particular page
|
| @_POST['filename'] string Name of the file to delete
| @_POST['uuid'] string Page UUID
|
| @return array
*/
// $_POST
// ----------------------------------------------------------------------------
$filename = isset($_POST['filename']) ? $_POST['filename'] : false;
$uuid = empty($_POST['uuid']) ? false : $_POST['uuid'];
// ----------------------------------------------------------------------------
if ($filename===false) {
ajaxResponse(1, 'The filename is empty.');
}
if ($uuid && IMAGE_RESTRICT) {
$imagePath = PATH_UPLOADS_PAGES.$uuid.DS;
$thumbnailPath = PATH_UPLOADS_PAGES.$uuid.DS.'thumbnails'.DS;
} else {
$imagePath = PATH_UPLOADS;
$thumbnailPath = PATH_UPLOADS_THUMBNAILS;
}
// Delete image
if (Sanitize::pathFile($imagePath.$filename)) {
Filesystem::rmfile($imagePath.$filename);
}
// Delete thumbnail
if (Sanitize::pathFile($thumbnailPath.$filename)) {
Filesystem::rmfile($thumbnailPath.$filename);
}
ajaxResponse(0, 'Image deleted.');
?>

View File

@ -1,27 +1,15 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); <?php defined('BLUDIT') or die('Bludit CMS.');
header('Content-Type: application/json'); header('Content-Type: application/json');
/*
| Generate an slug text for the URL
|
| @_POST['text'] string The text from where is generated the slug
| @_POST['parentKey'] string The parent key if the page has one
| @_POST['currentKey'] string The current page key
|
| @return array
*/
// $_POST
// ----------------------------------------------------------------------------
$text = isset($_POST['text']) ? $_POST['text'] : ''; $text = isset($_POST['text']) ? $_POST['text'] : '';
$parent = isset($_POST['parentKey']) ? $_POST['parentKey'] : ''; $parent = isset($_POST['parentKey']) ? $_POST['parentKey'] : PARENT;
$oldKey = isset($_POST['currentKey']) ? $_POST['currentKey'] : ''; $oldKey = isset($_POST['currentKey']) ? $_POST['currentKey'] : '';
// ----------------------------------------------------------------------------
$slug = $pages->generateKey($text, $parent, $returnSlug=true, $oldKey); $slug = $dbPages->generateKey($text, $parent, $returnSlug=true, $oldKey);
ajaxResponse(0, 'Slug generated.', array( exit (json_encode(array(
'status'=>0,
'slug'=>$slug 'slug'=>$slug
)); )));
?> ?>

View File

@ -0,0 +1,27 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
header('Content-Type: application/json');
// $_GET
// ----------------------------------------------------------------------------
// (string) $_GET['query']
$query = isset($_GET['query']) ? Text::lowercase($_GET['query']) : false;
// ----------------------------------------------------------------------------
if ($query===false) {
exit (json_encode(array(
'status'=>1,
'files'=>'Invalid query.'
)));
}
$tmp = array();
$parents = buildParentPages();
foreach ($parents as $parent) {
$lowerTitle = Text::lowercase($parent->title());
if (Text::stringContains($lowerTitle, $query)) {
$tmp[$parent->title()] = $parent->key();
}
}
exit (json_encode($tmp));
?>

View File

@ -1,50 +1,27 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); <?php defined('BLUDIT') or die('Bludit CMS.');
header('Content-Type: application/json'); header('Content-Type: application/json');
/*
| Returns a list of pages and the title contains the query string
| The returned list have published, sticky and statics pages
|
| @_POST['query'] string The string to search in the title of the pages
|
| @return array
*/
// $_GET // $_GET
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// (string) $_GET['query'] // (string) $_GET['query']
$query = isset($_GET['query']) ? Text::lowercase($_GET['query']) : false; $query = isset($_GET['query']) ? Text::lowercase($_GET['query']) : false;
// (boolean) $_GET['checkIsParent']
$checkIsParent = empty($_GET['checkIsParent']) ? false : true;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
if ($query===false) { if ($query===false) {
ajaxResponse(1, 'Invalid query.'); exit (json_encode(array(
'status'=>1,
'files'=>'Invalid query.'
)));
} }
$result = array(); $tmp = array();
$pagesKey = $pages->getDB(); $parents = buildParentPages();
foreach ($pagesKey as $pageKey) { foreach ($parents as $parent) {
try { $lowerTitle = Text::lowercase($parent->title());
$page = new Page($pageKey);
if ($page->isParent() || !$checkIsParent) {
// Check page status
if ($page->published() || $page->sticky() || $page->isStatic()) {
// Check if the query contains in the title
$lowerTitle = Text::lowercase($page->title());
if (Text::stringContains($lowerTitle, $query)) { if (Text::stringContains($lowerTitle, $query)) {
$tmp = array('disabled'=>false); $tmp[$parent->title()] = $parent->key();
$tmp['id'] = $page->key();
$tmp['text'] = $page->title();
$tmp['type'] = $page->type();
array_push($result, $tmp);
}
}
}
} catch (Exception $e) {
// continue
} }
} }
exit (json_encode(array('results'=>$result))); exit (json_encode($tmp));
?> ?>

View File

@ -0,0 +1,47 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
header('Content-Type: application/json');
// $_POST
// ----------------------------------------------------------------------------
// (integer) $_POST['pageNumber'] > 0
$pageNumber = !empty($_POST['pageNumber']) ? (int)$_POST['pageNumber'] : 1;
$pageNumber = $pageNumber - 1;
// (string) $_POST['path']
$path = isset($_POST['path']) ? $_POST['path'] : false;
// ----------------------------------------------------------------------------
if ($path==false) {
exit (json_encode(array(
'status'=>1,
'files'=>'Invalid path.'
)));
}
// Get all files from the directory $path, also split the array by numberOfItems
$listOfFilesByPage = Filesystem::listFiles($path, '*', '*', $GLOBALS['BLUDIT_MEDIA_MANAGER_SORT_BY_DATE'], $GLOBALS['BLUDIT_MEDIA_MANAGER_AMOUNT_OF_FILES']);
// Check if the page number exists in the chunks
if (isset($listOfFilesByPage[$pageNumber])) {
// Get only the filename from the chunk
$tmp = array();
foreach ($listOfFilesByPage[$pageNumber] as $file) {
array_push($tmp, basename($file));
}
// Returns the amount of chunks for the paginator
// Returns the files inside the chunk
exit (json_encode(array(
'status'=>0,
'numberOfPages'=>count($listOfFilesByPage),
'files'=>$tmp
)));
}
exit (json_encode(array(
'status'=>1,
'files'=>'Out of index.'
)));
?>

View File

@ -1,62 +0,0 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
header('Content-Type: application/json');
/*
| Returns a list of images from a particular page
|
| @_POST['pageNumber'] int Page number for the paginator
| @_POST['path'] string Pre-defined name for the directory to read, its pre-defined to avoid security issues
| @_POST['uuid'] string Page UUID
|
| @return array
*/
// $_POST
// ----------------------------------------------------------------------------
// $_POST['pageNumber'] > 0
$pageNumber = empty($_POST['pageNumber']) ? 1 : (int)$_POST['pageNumber'];
$pageNumber = $pageNumber - 1;
$path = empty($_POST['path']) ? false : $_POST['path'];
$uuid = empty($_POST['uuid']) ? false : $_POST['uuid'];
// ----------------------------------------------------------------------------
// Set the path to get the file list
if ($path=='thumbnails') {
if ($uuid && IMAGE_RESTRICT) {
$path = PATH_UPLOADS_PAGES.$uuid.DS.'thumbnails'.DS;
} else {
$path = PATH_UPLOADS_THUMBNAILS;
}
} else {
ajaxResponse(1, 'Invalid path.');
}
// Get all files from the directory $path, also split the array by numberOfItems
// The function listFiles split in chunks
$listOfFilesByPage = Filesystem::listFiles($path, '*', '*', MEDIA_MANAGER_SORT_BY_DATE, MEDIA_MANAGER_NUMBER_OF_FILES);
// Check if the page number exists in the chunks
if (isset($listOfFilesByPage[$pageNumber])) {
// Get only the filename from the chunk
$files = array();
foreach ($listOfFilesByPage[$pageNumber] as $file) {
$filename = basename($file);
array_push($files, $filename);
}
// Returns the number of chunks for the paginator
// Returns the files inside the chunk
ajaxResponse(0, 'List of files and number of chunks.', array(
'numberOfPages'=>count($listOfFilesByPage),
'files'=>$files
));
}
ajaxResponse(0, 'List of files and number of chunks.', array(
'numberOfPages'=>0,
'files'=>array()
));
?>

View File

@ -1,22 +0,0 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
header('Content-Type: application/json');
/*
| Delete the site logo
| This script delete the file and set and empty string in the database
|
| @return array
*/
// Delete the file
$logoFilename = $site->logo(false);
if ($logoFilename) {
Filesystem::rmfile(PATH_UPLOADS.$logoFilename);
}
// Remove the logo from the database
$site->set(array('logo'=>''));
ajaxResponse(0, 'Logo removed.');
?>

View File

@ -1,60 +0,0 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
header('Content-Type: application/json');
/*
| Upload site logo
| The final filename is the site's name and the extension is the same as the file uploaded
|
| @_FILES['inputFile'] multipart/form-data File from form
|
| @return array
*/
if (!isset($_FILES['inputFile'])) {
ajaxResponse(1, 'Error trying to upload the site logo.');
}
// Check path traversal on $filename
if (Text::stringContains($_FILES['inputFile']['name'], DS, false)) {
$message = 'Path traversal detected.';
Log::set($message, LOG_TYPE_ERROR);
ajaxResponse(1, $message);
}
// File extension
$fileExtension = Filesystem::extension($_FILES['inputFile']['name']);
$fileExtension = Text::lowercase($fileExtension);
if (!in_array($fileExtension, $GLOBALS['ALLOWED_IMG_EXTENSION']) ) {
$message = $L->g('File type is not supported. Allowed types:').' '.implode(', ',$GLOBALS['ALLOWED_IMG_EXTENSION']);
Log::set($message, LOG_TYPE_ERROR);
ajaxResponse(1, $message);
}
// Final filename
$filename = 'logo.'.$fileExtension;
if (Text::isNotEmpty( $site->title() )) {
$filename = $site->title().'.'.$fileExtension;
}
// Delete old image
$oldFilename = $site->logo(false);
if ($oldFilename) {
Filesystem::rmfile(PATH_UPLOADS.$oldFilename);
}
// Move from temporary directory to uploads
Filesystem::mv($_FILES['inputFile']['tmp_name'], PATH_UPLOADS.$filename);
// Permissions
chmod(PATH_UPLOADS.$filename, 0644);
// Store the filename in the database
$site->set(array('logo'=>$filename));
ajaxResponse(0, 'Image uploaded.', array(
'filename'=>$filename,
'absoluteURL'=>DOMAIN_UPLOADS.$filename,
'absolutePath'=>PATH_UPLOADS.$filename
));
?>

View File

@ -1,64 +0,0 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
header('Content-Type: application/json');
// $_POST
// ----------------------------------------------------------------------------
// (string) $_POST['username']
$username = empty($_POST['username']) ? false : $_POST['username'];
// ----------------------------------------------------------------------------
if ($username===false) {
ajaxResponse(1, 'Error in username.');
}
if ( ($login->role()!='admin') && ($login->username()!=$username) ) {
ajaxResponse(1, 'Error in username.');
}
if (!isset($_FILES['profilePictureInputFile'])) {
ajaxResponse(1, 'Error trying to upload the profile picture.');
}
// Check path traversal
if (Text::stringContains($username, DS, false)) {
$message = 'Path traversal detected.';
Log::set($message, LOG_TYPE_ERROR);
ajaxResponse(1, $message);
}
// Check file extension
$fileExtension = Filesystem::extension($_FILES['profilePictureInputFile']['name']);
$fileExtension = Text::lowercase($fileExtension);
if (!in_array($fileExtension, $GLOBALS['ALLOWED_IMG_EXTENSION']) ) {
$message = $L->g('File type is not supported. Allowed types:').' '.implode(', ',$GLOBALS['ALLOWED_IMG_EXTENSION']);
Log::set($message, LOG_TYPE_ERROR);
ajaxResponse(1, $message);
}
// Tmp filename
$tmpFilename = $username.'.'.$fileExtension;
// Final filename
$filename = $username.'.png';
// Move from temporary directory to uploads folder
rename($_FILES['profilePictureInputFile']['tmp_name'], PATH_TMP.$tmpFilename);
// Resize and convert to png
$image = new Image();
$image->setImage(PATH_TMP.$tmpFilename, PROFILE_IMG_WIDTH, PROFILE_IMG_HEIGHT, 'crop');
$image->saveImage(PATH_UPLOADS_PROFILES.$filename, PROFILE_IMG_QUALITY, false, true);
// Delete temporary file
Filesystem::rmfile(PATH_TMP.$tmpFilename);
// Permissions
chmod(PATH_UPLOADS_PROFILES.$filename, 0644);
ajaxResponse(0, 'Image uploaded.', array(
'filename'=>$filename,
'absoluteURL'=>DOMAIN_UPLOADS_PROFILES.$filename,
'absolutePath'=>PATH_UPLOADS_PROFILES.$filename
));
?>

View File

@ -1,52 +1,56 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); <?php defined('BLUDIT') or die('Bludit CMS.');
header('Content-Type: application/json'); header('Content-Type: application/json');
/*
| Create/edit a page and save as draft
| If the UUID already exists the page is updated
|
| @_POST['title'] string Page title
| @_POST['content'] string Page content
| @_POST['uuid'] string Page uuid
| @_POST['uuid'] string Page type, by default is draft
|
| @return array
*/
// $_POST // $_POST
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// (string) $_POST['title']
$title = isset($_POST['title']) ? $_POST['title'] : false; $title = isset($_POST['title']) ? $_POST['title'] : false;
// (string) $_POST['content']
$content = isset($_POST['content']) ? $_POST['content'] : false; $content = isset($_POST['content']) ? $_POST['content'] : false;
// (string) $_POST['uuid']
$uuid = isset($_POST['uuid']) ? $_POST['uuid'] : false; $uuid = isset($_POST['uuid']) ? $_POST['uuid'] : false;
$type = isset($_POST['type']) ? $_POST['type'] : 'draft';
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Check UUID // Check UUID
if (empty($uuid)) { if (empty($uuid)) {
ajaxResponse(1, 'Save as draft fail. UUID not defined.'); exit (json_encode(array(
'status'=>1,
'message'=>'Autosave fail. UUID not defined.'
)));
} }
// Check content length to create the autosave page
if (Text::length($content)<100) {
exit (json_encode(array(
'status'=>1,
'message'=>'Autosave not completed. The content length is less than 100 characters.'
)));
}
$autosaveUUID = 'autosave-'.$uuid;
$page = array( $page = array(
'uuid'=>$uuid, 'uuid'=>$autosaveUUID,
'key'=>$uuid, 'key'=>$autosaveUUID,
'slug'=>$uuid, 'slug'=>$autosaveUUID,
'title'=>$title, 'title'=>$title.' [ Autosave ] ',
'content'=>$content, 'content'=>$content,
'type'=>$type 'status'=>'draft'
); );
// Get the page key by the UUID // Get the page key by the UUID
$pageKey = $pages->getByUUID($uuid); $pageKey = $dbPages->getByUUID($autosaveUUID);
// if pageKey is empty means the page doesn't exist // if pageKey is empty means the autosave page doesn't exist
if (empty($pageKey)) { if (empty($pageKey)) {
createPage($page); createPage($page);
} else { } else {
editPage($page); editPage($page);
} }
ajaxResponse(0, 'Save as draft successfully.', array( exit (json_encode(array(
'uuid'=>$uuid 'status'=>0,
)); 'message'=>'Autosave successfully.',
'uuid'=>$autosaveUUID
)));
?> ?>

View File

@ -0,0 +1,40 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
header('Content-Type: application/json');
foreach ($_FILES['bluditInputFiles']['name'] as $key=>$filename) {
// Get the next filename if already exist the file to not overwrite the original file
$nextFilename = Filesystem::nextFilename(PATH_UPLOADS, $filename);
// File extension
$fileExtension = pathinfo($nextFilename, PATHINFO_EXTENSION);
// Move from temporary directory to uploads folder
rename($_FILES['bluditInputFiles']['tmp_name'][$key], PATH_UPLOADS.$nextFilename);
chmod(PATH_UPLOADS.$nextFilename, 0644);
// Generate Thumbnail
// Exclude generate thumbnail for SVG format and generate a symlink to the svg
if ($fileExtension == 'svg') {
symlink(PATH_UPLOADS.$nextFilename, PATH_UPLOADS_THUMBNAILS.$nextFilename);
} else {
$Image = new Image();
$Image->setImage(PATH_UPLOADS.$nextFilename, $GLOBALS['THUMBNAILS_WIDTH'], $GLOBALS['THUMBNAILS_HEIGHT'], 'crop');
$Image->saveImage(PATH_UPLOADS_THUMBNAILS.$nextFilename, $GLOBALS['THUMBNAILS_QUALITY'], true);
}
}
$absoluteURL = DOMAIN_UPLOADS.$nextFilename;
$absoluteURLThumbnail = DOMAIN_UPLOADS_THUMBNAILS.$nextFilename;
$absolutePath = PATH_UPLOADS.$nextFilename;
exit (json_encode(array(
'status'=>0,
'message'=>'Image uploaded success.',
'filename'=>$nextFilename,
'absoluteURL'=>$absoluteURL,
'absoluteURLThumbnail'=>$absoluteURLThumbnail,
'absolutePath'=>$absolutePath
)));
?>

View File

@ -1,87 +0,0 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
header('Content-Type: application/json');
/*
| Upload an image to a particular page
|
| @_POST['uuid'] string Page uuid
|
| @return array
*/
// $_POST
// ----------------------------------------------------------------------------
$uuid = empty($_POST['uuid']) ? false : $_POST['uuid'];
// ----------------------------------------------------------------------------
// Check path traversal on $uuid
if ($uuid) {
if (Text::stringContains($uuid, DS, false)) {
$message = 'Path traversal detected.';
Log::set($message, LOG_TYPE_ERROR);
ajaxResponse(1, $message);
}
}
// Set upload directory
if ($uuid && IMAGE_RESTRICT) {
$imageDirectory = PATH_UPLOADS_PAGES.$uuid.DS;
$thumbnailDirectory = $imageDirectory.'thumbnails'.DS;
if (!Filesystem::directoryExists($thumbnailDirectory)) {
Filesystem::mkdir($thumbnailDirectory, true);
}
} else {
$imageDirectory = PATH_UPLOADS;
$thumbnailDirectory = PATH_UPLOADS_THUMBNAILS;
}
$images = array();
foreach ($_FILES['images']['name'] as $uuid=>$filename) {
// Check for errors
if ($_FILES['images']['error'][$uuid] != 0) {
$message = $L->g('Maximum load file size allowed:').' '.ini_get('upload_max_filesize');
Log::set($message, LOG_TYPE_ERROR);
ajaxResponse(1, $message);
}
// Convert URL characters such as spaces or quotes to characters
$filename = urldecode($filename);
// Check path traversal on $filename
if (Text::stringContains($filename, DS, false)) {
$message = 'Path traversal detected.';
Log::set($message, LOG_TYPE_ERROR);
ajaxResponse(1, $message);
}
// Check file extension
$fileExtension = Filesystem::extension($filename);
$fileExtension = Text::lowercase($fileExtension);
if (!in_array($fileExtension, $GLOBALS['ALLOWED_IMG_EXTENSION']) ) {
$message = $L->g('File type is not supported. Allowed types:').' '.implode(', ',$GLOBALS['ALLOWED_IMG_EXTENSION']);
Log::set($message, LOG_TYPE_ERROR);
ajaxResponse(1, $message);
}
// Move from PHP tmp file to Bludit tmp directory
Filesystem::mv($_FILES['images']['tmp_name'][$uuid], PATH_TMP.$filename);
// Transform the image and generate the thumbnail
$image = transformImage(PATH_TMP.$filename, $imageDirectory, $thumbnailDirectory);
if ($image) {
chmod($image, 0644);
$filename = Filesystem::filename($image);
array_push($images, $filename);
} else {
$message = 'Error after transformImage() function.';
Log::set($message, LOG_TYPE_ERROR);
ajaxResponse(1, $message);
}
}
ajaxResponse(0, 'Images uploaded.', array(
'images'=>$images
));
?>

View File

@ -0,0 +1,24 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
header('Content-Type: application/json');
/*
*
* This script check if the user is logged
*
*/
// Check UUID
if ($login->isLogged()) {
exit (json_encode(array(
'status'=>1,
'message'=>'The user is logged.'
)));
}
exit (json_encode(array(
'status'=>0,
'message'=>'The user is NOT logged.'
)));
?>

View File

@ -6,7 +6,7 @@ if (Session::started()===false) {
exit('Bludit CMS. Session initialization failure.'); exit('Bludit CMS. Session initialization failure.');
} }
$login = new Login(); $login = $Login = new Login();
$layout = array( $layout = array(
'controller'=>null, 'controller'=>null,
@ -23,6 +23,14 @@ $layout['controller'] = $layout['view'] = $layout['slug'] = empty($explodeSlug[0
unset($explodeSlug[0]); unset($explodeSlug[0]);
$layout['parameters'] = implode('/', $explodeSlug); $layout['parameters'] = implode('/', $explodeSlug);
// Disable Magic Quotes.
// Thanks, http://stackoverflow.com/questions/517008/how-to-turn-off-magic-quotes-on-shared-hosting
if ( in_array( strtolower( ini_get( 'magic_quotes_gpc' ) ), array( '1', 'on' ) ) ) {
$_POST = array_map('stripslashes', $_POST);
$_GET = array_map('stripslashes', $_GET);
$_COOKIE = array_map('stripslashes', $_COOKIE);
}
// Boot plugins rules // Boot plugins rules
include(PATH_RULES.'60.plugins.php'); include(PATH_RULES.'60.plugins.php');
@ -53,11 +61,17 @@ else
// Page not found. // Page not found.
// User not logged. // User not logged.
// Slug is login. // Slug is login.
if ($url->notFound() || !$login->isLogged() || ($url->slug()==='login') ) { // Slug is login-email.
if($url->notFound() || !$login->isLogged() || ($url->slug()==='login') || ($url->slug()==='login-email') ) {
$layout['controller'] = 'login'; $layout['controller'] = 'login';
$layout['view'] = 'login'; $layout['view'] = 'login';
$layout['template'] = 'login.php'; $layout['template'] = 'login.php';
if ($url->slug()==='login-email') {
$layout['controller'] = 'login-email';
$layout['view'] = 'login-email';
}
// Generate the tokenCSRF for the user not logged, when the user log-in the token will be change. // Generate the tokenCSRF for the user not logged, when the user log-in the token will be change.
$security->generateTokenCSRF(); $security->generateTokenCSRF();
} }
@ -70,17 +84,17 @@ else
Theme::plugins('beforeAdminLoad'); Theme::plugins('beforeAdminLoad');
// Load init.php if the theme has one. // Load init.php if the theme has one.
if (Sanitize::pathFile(PATH_ADMIN_THEMES, $site->adminTheme().DS.'init.php')) { if( Sanitize::pathFile(PATH_ADMIN_THEMES, $site->adminTheme().DS.'init.php') ) {
include(PATH_ADMIN_THEMES.$site->adminTheme().DS.'init.php'); include(PATH_ADMIN_THEMES.$site->adminTheme().DS.'init.php');
} }
// Load controller. // Load controller.
if (Sanitize::pathFile(PATH_ADMIN_CONTROLLERS, $layout['controller'].'.php')) { if( Sanitize::pathFile(PATH_ADMIN_CONTROLLERS, $layout['controller'].'.php') ) {
include(PATH_ADMIN_CONTROLLERS.$layout['controller'].'.php'); include(PATH_ADMIN_CONTROLLERS.$layout['controller'].'.php');
} }
// Load view and theme. // Load view and theme.
if (Sanitize::pathFile(PATH_ADMIN_THEMES, $site->adminTheme().DS.$layout['template'])) { if( Sanitize::pathFile(PATH_ADMIN_THEMES, $site->adminTheme().DS.$layout['template']) ) {
include(PATH_ADMIN_THEMES.$site->adminTheme().DS.$layout['template']); include(PATH_ADMIN_THEMES.$site->adminTheme().DS.$layout['template']);
} }

View File

@ -1,22 +1,21 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); <?php defined('BLUDIT') or die('Bludit CMS.');
// Bludit version // Bludit version
define('BLUDIT_VERSION', '3.12.0'); define('BLUDIT_VERSION', '3.0.0');
define('BLUDIT_CODENAME', 'Hand washing'); define('BLUDIT_CODENAME', '');
define('BLUDIT_RELEASE_DATE', '2020-03-20'); define('BLUDIT_RELEASE_DATE', '2018-04-02');
define('BLUDIT_BUILD', '20200320'); define('BLUDIT_BUILD', '20180402');
// Debug mode // Debug mode
// Change to FALSE, for prevent warning or errors on browser // Change to FALSE, for prevent warning or errors on browser
define('DEBUG_MODE', TRUE); define('DEBUG_MODE', TRUE);
define('DEBUG_TYPE', 'INFO'); // INFO, TRACE
error_reporting(0); // Turn off all error reporting error_reporting(0); // Turn off all error reporting
if (DEBUG_MODE) { if (DEBUG_MODE) {
// Turn on all error reporting // Turn on all error reporting
ini_set("display_errors", 0); ini_set("display_errors", 1);
ini_set('display_startup_errors',0); ini_set('display_startup_errors',1);
ini_set("track_errors", 1);
ini_set("html_errors", 1); ini_set("html_errors", 1);
ini_set('log_errors', 1);
error_reporting(E_ALL | E_STRICT | E_NOTICE); error_reporting(E_ALL | E_STRICT | E_NOTICE);
} }
@ -39,9 +38,7 @@ define('PATH_DATABASES', PATH_CONTENT.'databases'.DS);
define('PATH_PLUGINS_DATABASES', PATH_CONTENT.'databases'.DS.'plugins'.DS); define('PATH_PLUGINS_DATABASES', PATH_CONTENT.'databases'.DS.'plugins'.DS);
define('PATH_TMP', PATH_CONTENT.'tmp'.DS); define('PATH_TMP', PATH_CONTENT.'tmp'.DS);
define('PATH_UPLOADS', PATH_CONTENT.'uploads'.DS); define('PATH_UPLOADS', PATH_CONTENT.'uploads'.DS);
define('PATH_WORKSPACES', PATH_CONTENT.'workspaces'.DS);
define('PATH_UPLOADS_PAGES', PATH_UPLOADS.'pages'.DS);
define('PATH_UPLOADS_PROFILES', PATH_UPLOADS.'profiles'.DS); define('PATH_UPLOADS_PROFILES', PATH_UPLOADS.'profiles'.DS);
define('PATH_UPLOADS_THUMBNAILS', PATH_UPLOADS.'thumbnails'.DS); define('PATH_UPLOADS_THUMBNAILS', PATH_UPLOADS.'thumbnails'.DS);
@ -61,6 +58,11 @@ define('DB_SYSLOG', PATH_DATABASES.'syslog.php');
define('DB_USERS', PATH_DATABASES.'users.php'); define('DB_USERS', PATH_DATABASES.'users.php');
define('DB_SECURITY', PATH_DATABASES.'security.php'); define('DB_SECURITY', PATH_DATABASES.'security.php');
// JSON pretty print
if (!defined('JSON_PRETTY_PRINT')) {
define('JSON_PRETTY_PRINT', 128);
}
// User environment variables // User environment variables
include(PATH_KERNEL.'boot'.DS.'variables.php'); include(PATH_KERNEL.'boot'.DS.'variables.php');
@ -76,13 +78,14 @@ include(PATH_ABSTRACT.'dblist.class.php');
include(PATH_ABSTRACT.'plugin.class.php'); include(PATH_ABSTRACT.'plugin.class.php');
// Inclde Classes // Inclde Classes
include(PATH_KERNEL.'pages.class.php'); include(PATH_KERNEL.'dbpages.class.php');
include(PATH_KERNEL.'users.class.php'); include(PATH_KERNEL.'dbusers.class.php');
include(PATH_KERNEL.'tags.class.php'); include(PATH_KERNEL.'dbtags.class.php');
include(PATH_KERNEL.'language.class.php'); include(PATH_KERNEL.'dblanguage.class.php');
include(PATH_KERNEL.'site.class.php'); include(PATH_KERNEL.'dbsite.class.php');
include(PATH_KERNEL.'categories.class.php'); include(PATH_KERNEL.'dbcategories.class.php');
include(PATH_KERNEL.'syslog.class.php'); include(PATH_KERNEL.'dbsyslog.class.php');
include(PATH_KERNEL.'page.class.php');
include(PATH_KERNEL.'pagex.class.php'); include(PATH_KERNEL.'pagex.class.php');
include(PATH_KERNEL.'category.class.php'); include(PATH_KERNEL.'category.class.php');
include(PATH_KERNEL.'tag.class.php'); include(PATH_KERNEL.'tag.class.php');
@ -118,14 +121,14 @@ if (file_exists(PATH_KERNEL.'bludit.pro.php')) {
} }
// Objects // Objects
$pages = new Pages(); $pages = $dbPages = new dbPages(); // DEPRECATED v3.0.0 $dbPages
$users = new Users(); $dbUsers = new dbUsers();
$tags = new Tags(); $dbTags = new dbTags();
$categories = new Categories(); $dbCategories = new dbCategories();
$site = new Site(); $site = new dbSite();
$url = new Url(); $url = new Url();
$security = new Security(); $security = new Security();
$syslog = new Syslog(); $syslog = new dbSyslog();
// --- Relative paths --- // --- Relative paths ---
// This paths are relative for the user / web browsing. // This paths are relative for the user / web browsing.
@ -163,18 +166,17 @@ define('HTML_PATH_ADMIN_ROOT', HTML_PATH_ROOT.ADMIN_URI_FILTER.'/');
define('HTML_PATH_ADMIN_THEME', HTML_PATH_ROOT.'bl-kernel/admin/themes/'.$site->adminTheme().'/'); define('HTML_PATH_ADMIN_THEME', HTML_PATH_ROOT.'bl-kernel/admin/themes/'.$site->adminTheme().'/');
define('HTML_PATH_ADMIN_THEME_JS', HTML_PATH_ADMIN_THEME.'js/'); define('HTML_PATH_ADMIN_THEME_JS', HTML_PATH_ADMIN_THEME.'js/');
define('HTML_PATH_ADMIN_THEME_CSS', HTML_PATH_ADMIN_THEME.'css/'); define('HTML_PATH_ADMIN_THEME_CSS', HTML_PATH_ADMIN_THEME.'css/');
define('HTML_PATH_ADMIN_THEME_IMG', HTML_PATH_ADMIN_THEME.'img/');
define('HTML_PATH_CORE_JS', HTML_PATH_ROOT.'bl-kernel/js/'); define('HTML_PATH_CORE_JS', HTML_PATH_ROOT.'bl-kernel/js/');
define('HTML_PATH_CORE_CSS', HTML_PATH_ROOT.'bl-kernel/css/'); define('HTML_PATH_CORE_CSS', HTML_PATH_ROOT.'bl-kernel/css/');
define('HTML_PATH_CORE_IMG', HTML_PATH_ROOT.'bl-kernel/img/');
define('HTML_PATH_CONTENT', HTML_PATH_ROOT.'bl-content/'); define('HTML_PATH_CONTENT', HTML_PATH_ROOT.'bl-content/');
define('HTML_PATH_UPLOADS', HTML_PATH_ROOT.'bl-content/uploads/'); define('HTML_PATH_UPLOADS', HTML_PATH_ROOT.'bl-content/uploads/');
define('HTML_PATH_UPLOADS_PAGES', HTML_PATH_UPLOADS.'pages/');
define('HTML_PATH_UPLOADS_PROFILES', HTML_PATH_UPLOADS.'profiles/'); define('HTML_PATH_UPLOADS_PROFILES', HTML_PATH_UPLOADS.'profiles/');
define('HTML_PATH_UPLOADS_THUMBNAILS', HTML_PATH_UPLOADS.'thumbnails/'); define('HTML_PATH_UPLOADS_THUMBNAILS', HTML_PATH_UPLOADS.'thumbnails/');
define('HTML_PATH_PLUGINS', HTML_PATH_ROOT.'bl-plugins/'); define('HTML_PATH_PLUGINS', HTML_PATH_ROOT.'bl-plugins/');
// --- Objects with dependency --- // --- Objects with dependency ---
$language = new Language( $site->language() ); $language = $Language = new dbLanguage( $site->language() );
$url->checkFilters( $site->uriFilters() ); $url->checkFilters( $site->uriFilters() );
// --- CONSTANTS with dependency --- // --- CONSTANTS with dependency ---
@ -197,15 +199,6 @@ define('EXTREME_FRIENDLY_URL', $site->extremeFriendly());
// Minutes to execute the autosave function // Minutes to execute the autosave function
define('AUTOSAVE_INTERVAL', $site->autosaveInterval()); define('AUTOSAVE_INTERVAL', $site->autosaveInterval());
// TRUE for upload images restric to a pages, FALSE to upload images in common
define('IMAGE_RESTRICT', $site->imageRestrict());
// TRUE to convert relatives images to absoultes, FALSE No changes apply
define('IMAGE_RELATIVE_TO_ABSOLUTE', $site->imageRelativeToAbsolute());
// TRUE if the markdown parser is enabled
define('MARKDOWN_PARSER', $site->markdownParser());
// --- PHP paths with dependency --- // --- PHP paths with dependency ---
// This paths are absolutes for the OS // This paths are absolutes for the OS
define('THEME_DIR', PATH_ROOT.'bl-themes'.DS.$site->theme().DS); define('THEME_DIR', PATH_ROOT.'bl-themes'.DS.$site->theme().DS);
@ -229,13 +222,12 @@ define('DOMAIN_ADMIN_THEME', DOMAIN.HTML_PATH_ADMIN_THEME);
define('DOMAIN_ADMIN_THEME_CSS', DOMAIN.HTML_PATH_ADMIN_THEME_CSS); define('DOMAIN_ADMIN_THEME_CSS', DOMAIN.HTML_PATH_ADMIN_THEME_CSS);
define('DOMAIN_ADMIN_THEME_JS', DOMAIN.HTML_PATH_ADMIN_THEME_JS); define('DOMAIN_ADMIN_THEME_JS', DOMAIN.HTML_PATH_ADMIN_THEME_JS);
define('DOMAIN_UPLOADS', DOMAIN.HTML_PATH_UPLOADS); define('DOMAIN_UPLOADS', DOMAIN.HTML_PATH_UPLOADS);
define('DOMAIN_UPLOADS_PAGES', DOMAIN.HTML_PATH_UPLOADS_PAGES);
define('DOMAIN_UPLOADS_PROFILES', DOMAIN.HTML_PATH_UPLOADS_PROFILES); define('DOMAIN_UPLOADS_PROFILES', DOMAIN.HTML_PATH_UPLOADS_PROFILES);
define('DOMAIN_UPLOADS_THUMBNAILS', DOMAIN.HTML_PATH_UPLOADS_THUMBNAILS); define('DOMAIN_UPLOADS_THUMBNAILS', DOMAIN.HTML_PATH_UPLOADS_THUMBNAILS);
define('DOMAIN_PLUGINS', DOMAIN.HTML_PATH_PLUGINS); define('DOMAIN_PLUGINS', DOMAIN.HTML_PATH_PLUGINS);
define('DOMAIN_CONTENT', DOMAIN.HTML_PATH_CONTENT); define('DOMAIN_CONTENT', DOMAIN.HTML_PATH_CONTENT);
define('DOMAIN_ADMIN', DOMAIN_BASE.ADMIN_URI_FILTER.'/'); define('DOMAIN_ADMIN', DOMAIN_BASE.ADMIN_URI_FILTER);
define('DOMAIN_TAGS', Text::addSlashes(DOMAIN_BASE.TAG_URI_FILTER, false, true)); define('DOMAIN_TAGS', Text::addSlashes(DOMAIN_BASE.TAG_URI_FILTER, false, true));
define('DOMAIN_CATEGORIES', Text::addSlashes(DOMAIN_BASE.CATEGORY_URI_FILTER, false, true)); define('DOMAIN_CATEGORIES', Text::addSlashes(DOMAIN_BASE.CATEGORY_URI_FILTER, false, true));

View File

@ -24,11 +24,10 @@ $plugins = array(
'adminContentSidebar'=>array(), 'adminContentSidebar'=>array(),
'dashboard'=>array(), 'dashboard'=>array(),
'beforeRulesLoad'=>array(),
'beforeAll'=>array(), 'beforeAll'=>array(),
'afterAll'=>array(), 'afterAll'=>array(),
'paginator'=>array(),
'afterPageCreate'=>array(), 'afterPageCreate'=>array(),
'afterPageModify'=>array(), 'afterPageModify'=>array(),
'afterPageDelete'=>array(), 'afterPageDelete'=>array(),
@ -43,8 +42,6 @@ $plugins = array(
$pluginsEvents = $plugins; $pluginsEvents = $plugins;
unset($pluginsEvents['all']); unset($pluginsEvents['all']);
$pluginsInstalled = array();
// ============================================================================ // ============================================================================
// Functions // Functions
// ============================================================================ // ============================================================================
@ -53,20 +50,20 @@ function buildPlugins()
{ {
global $plugins; global $plugins;
global $pluginsEvents; global $pluginsEvents;
global $pluginsInstalled; global $Language;
global $L;
global $site; global $site;
// List plugins directories
$list = Filesystem::listDirectories(PATH_PLUGINS);
// Get declared clasess BEFORE load plugins clasess // Get declared clasess BEFORE load plugins clasess
$currentDeclaredClasess = get_declared_classes(); $currentDeclaredClasess = get_declared_classes();
// List plugins directories
$list = Filesystem::listDirectories(PATH_PLUGINS);
// Load each plugin clasess // Load each plugin clasess
foreach ($list as $pluginPath) { foreach ($list as $pluginPath) {
// Check if the directory has the plugin.php // Check if the directory has the plugin.php
if (file_exists($pluginPath.DS.'plugin.php')) { if (file_exists($pluginPath.DS.'plugin.php')) {
include_once($pluginPath.DS.'plugin.php'); include($pluginPath.DS.'plugin.php');
} }
} }
@ -78,7 +75,7 @@ function buildPlugins()
// Check if the plugin is translated // Check if the plugin is translated
$languageFilename = PATH_PLUGINS.$Plugin->directoryName().DS.'languages'.DS.$site->language().'.json'; $languageFilename = PATH_PLUGINS.$Plugin->directoryName().DS.'languages'.DS.$site->language().'.json';
if (!Sanitize::pathFile($languageFilename)) { if( !Sanitize::pathFile($languageFilename) ) {
$languageFilename = PATH_PLUGINS.$Plugin->directoryName().DS.'languages'.DS.DEFAULT_LANGUAGE_FILE; $languageFilename = PATH_PLUGINS.$Plugin->directoryName().DS.'languages'.DS.DEFAULT_LANGUAGE_FILE;
} }
@ -93,7 +90,7 @@ function buildPlugins()
// This function overwrite the key=>value // This function overwrite the key=>value
unset($database['plugin-data']); unset($database['plugin-data']);
if (!empty($database)) { if (!empty($database)) {
$L->add($database); $Language->add($database);
} }
// $plugins['all'] Array with all plugins, installed and not installed // $plugins['all'] Array with all plugins, installed and not installed
@ -101,17 +98,6 @@ function buildPlugins()
// If the plugin is installed insert on the hooks // If the plugin is installed insert on the hooks
if ($Plugin->installed()) { if ($Plugin->installed()) {
// Include custom hooks
if (!empty($Plugin->customHooks)) {
foreach ($Plugin->customHooks as $customHook) {
if (!isset($plugins[$customHook])) {
$plugins[$customHook] = array();
$pluginsEvents[$customHook] = array();
}
}
}
$pluginsInstalled[$pluginClass] = $Plugin;
foreach ($pluginsEvents as $event=>$value) { foreach ($pluginsEvents as $event=>$value) {
if (method_exists($Plugin, $event)) { if (method_exists($Plugin, $event)) {
array_push($plugins[$event], $Plugin); array_push($plugins[$event], $Plugin);
@ -119,7 +105,6 @@ function buildPlugins()
} }
} }
// Sort the plugins by the position for the site sidebar
uasort($plugins['siteSidebar'], function ($a, $b) { uasort($plugins['siteSidebar'], function ($a, $b) {
return $a->position()>$b->position(); return $a->position()>$b->position();
} }

View File

@ -1,23 +0,0 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
// Redirect admin, from /admin to /admin/
if ($url->uri()==HTML_PATH_ROOT.ADMIN_URI_FILTER) {
Redirect::url(DOMAIN_ADMIN);
}
// Redirect blog, from /blog to /blog/
// This rule only works when the user set a page as homepage
if ($url->uri()==HTML_PATH_ROOT.'blog' && $site->homepage()) {
$filter = $url->filters('blog');
$finalURL = Text::addSlashes(DOMAIN_BASE.$filter, false, true);
Redirect::url($finalURL);
}
// Redirect pages, from /my-page/ to /my-page
if ($url->whereAmI()=='page' && !$url->notFound()) {
$pageKey = $url->slug();
if (Text::endsWith($pageKey, '/')) {
$pageKey = rtrim($pageKey, '/');
Redirect::url(DOMAIN_PAGES.$pageKey);
}
}

View File

@ -5,7 +5,7 @@
// ============================================================================ // ============================================================================
// Array with pages, each page is a Page Object // Array with pages, each page is a Page Object
// Filtered by pagenumber, number of items per page and sorted by date/position // Filtered by pagenumber, amount of items per page and sorted by date/position
/* /*
array( array(
0 => Page Object, 0 => Page Object,
@ -36,10 +36,7 @@ $staticContent = $staticPages = buildStaticPages();
// ============================================================================ // ============================================================================
// Execute the scheduler // Execute the scheduler
if ($pages->scheduler()) { if ($dbPages->scheduler()) {
// Execute plugins with the hook afterPageCreate
Theme::plugins('afterPageCreate');
reindexTags(); reindexTags();
reindexCategories(); reindexCategories();
@ -50,10 +47,10 @@ if ($pages->scheduler()) {
)); ));
} }
// Set home page if the user defined one // Set home page if the user defined them
if ($site->homepage() && $url->whereAmI()==='home') { if ($site->homepage() && $url->whereAmI()==='home') {
$pageKey = $site->homepage(); $pageKey = $site->homepage();
if ($pages->exists($pageKey)) { if ($dbPages->exists($pageKey)) {
$url->setSlug($pageKey); $url->setSlug($pageKey);
$url->setWhereAmI('page'); $url->setWhereAmI('page');
} }

View File

@ -1,4 +1,3 @@
<?php defined('BLUDIT') or die('Bludit CMS.'); <?php defined('BLUDIT') or die('Bludit CMS.');
header('HTTP/1.0 '.$url->httpCode().' '.$url->httpMessage()); header('HTTP/1.0 '.$url->httpCode().' '.$url->httpMessage());
header('X-Powered-By: Bludit');

View File

@ -4,37 +4,37 @@
$currentPage = $url->pageNumber(); $currentPage = $url->pageNumber();
Paginator::set('currentPage', $currentPage); Paginator::set('currentPage', $currentPage);
if ($url->whereAmI()=='admin') { if($url->whereAmI()=='admin') {
$itemsPerPage = ITEMS_PER_PAGE_ADMIN; $itemsPerPage = ITEMS_PER_PAGE_ADMIN;
$numberOfItems = $pages->count(true); $amountOfItems = $dbPages->count(true);
} elseif ($url->whereAmI()=='tag') { }
elseif($url->whereAmI()=='tag') {
$itemsPerPage = $site->itemsPerPage(); $itemsPerPage = $site->itemsPerPage();
$tagKey = $url->slug(); $tagKey = $url->slug();
$numberOfItems = $tags->numberOfPages($tagKey); $amountOfItems = $dbTags->countPagesByTag($tagKey);
} elseif ($url->whereAmI()=='category') { }
elseif($url->whereAmI()=='category') {
$itemsPerPage = $site->itemsPerPage(); $itemsPerPage = $site->itemsPerPage();
$categoryKey = $url->slug(); $categoryKey = $url->slug();
$numberOfItems = $categories->numberOfPages($categoryKey); $amountOfItems = $dbCategories->countPagesByCategory($categoryKey);
} else { }
$itemsPerPage = $site->itemsPerPage(); else {
$numberOfItems = $pages->count(true); $itemsPerPage = $site->itemsPerPage();
$amountOfItems = $dbPages->count(true);
} }
// Execute hook from plugins
Theme::plugins('paginator');
// Items per page // Items per page
Paginator::set('itemsPerPage', $itemsPerPage); Paginator::set('itemsPerPage', $itemsPerPage);
// Amount of items // Amount of items
Paginator::set('numberOfItems', $numberOfItems); Paginator::set('amountOfItems', $amountOfItems);
// Amount of pages // Amount of pages
$numberOfPages = (int) max(ceil($numberOfItems / $itemsPerPage), 1); $amountOfPages = (int) max(ceil($amountOfItems / $itemsPerPage), 1);
Paginator::set('numberOfPages', $numberOfPages); Paginator::set('amountOfPages', $amountOfPages);
// TRUE if exists a next page to show // TRUE if exists a next page to show
$showNext = $numberOfPages > $currentPage; $showNext = $amountOfPages > $currentPage;
Paginator::set('showNext', $showNext); Paginator::set('showNext', $showNext);
// TRUE if exists a previous page to show // TRUE if exists a previous page to show
@ -50,5 +50,5 @@ $nextPage = max(0, $currentPage+1);
Paginator::set('nextPage', $nextPage); Paginator::set('nextPage', $nextPage);
// Integer with the previous page // Integer with the previous page
$prevPage = min($numberOfPages, $currentPage-1); $prevPage = min($amountOfPages, $currentPage-1);
Paginator::set('prevPage', $prevPage); Paginator::set('prevPage', $prevPage);

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