Compare commits
48 commits
3.14.0-tes
...
v3.0
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3c02c86498 | ||
![]() |
fa736d907b | ||
![]() |
16c70204dc | ||
![]() |
151c5ab482 | ||
![]() |
27f352f586 | ||
![]() |
76a3ea1c3d | ||
![]() |
e17583fb63 | ||
![]() |
593f5b3aed | ||
![]() |
4412f339cc | ||
![]() |
49fb7f03b1 | ||
![]() |
437190fcbb | ||
![]() |
4bfa4a74a9 | ||
![]() |
e770d6a972 | ||
![]() |
6248ea0a62 | ||
![]() |
16cd57029b | ||
![]() |
af7488f1b4 | ||
![]() |
957663b48b | ||
![]() |
0b381e8df7 | ||
![]() |
d586fce4f2 | ||
![]() |
4a645173f7 | ||
![]() |
1c32692b2a | ||
![]() |
1868c63b93 | ||
![]() |
7995d862bc | ||
![]() |
b05655717e | ||
![]() |
be292c15ff | ||
![]() |
2d33a325d1 | ||
![]() |
d2f1068e08 | ||
![]() |
53cc162d3a | ||
![]() |
39ff27bff6 | ||
![]() |
e8e83a3219 | ||
![]() |
90e81d7fe8 | ||
![]() |
d7b76909f7 | ||
![]() |
c1093dbef1 | ||
![]() |
e913a1a857 | ||
![]() |
6331155414 | ||
![]() |
d9963918fb | ||
![]() |
f29db1eee0 | ||
![]() |
4998bc7005 | ||
![]() |
0a9c21a1e8 | ||
![]() |
6d38311c72 | ||
![]() |
c65282334d | ||
![]() |
27415297e8 | ||
![]() |
654be18345 | ||
![]() |
2ab78beb8b | ||
![]() |
600724da2b | ||
![]() |
e5a7735360 | ||
![]() |
eed574d21f | ||
![]() |
b6c212337e |
171 changed files with 12518 additions and 4995 deletions
6
.github/issue_template.md
vendored
6
.github/issue_template.md
vendored
|
@ -1,3 +1,5 @@
|
|||
Please follow the next steps. The issue will be closed if the following steps are not completed. Thank you. (You can remove this line).
|
||||
|
||||
### Describe your problem
|
||||
Complete here.
|
||||
|
||||
|
@ -8,9 +10,9 @@ Complete here.
|
|||
Complete here.
|
||||
|
||||
### PHP version
|
||||
If you do not know delete this line.
|
||||
If you do not know remove this line.
|
||||
|
||||
### PHP logs
|
||||
If you do not know delete this line.
|
||||
If you do not know remove 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`.
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,6 +1,7 @@
|
|||
.DS_Store
|
||||
dbgenerator.php
|
||||
bl-content/*
|
||||
!bl-content/.keep
|
||||
bl-content-migrator
|
||||
bl-plugins/timemachine
|
||||
bl-plugins/timemachine-x
|
||||
|
|
|
@ -6,7 +6,7 @@ AddDefaultCharset UTF-8
|
|||
RewriteEngine on
|
||||
|
||||
# Base directory
|
||||
#RewriteBase /
|
||||
RewriteBase /
|
||||
|
||||
# Deny direct access to the next directories
|
||||
RewriteRule ^bl-content/(databases|workspaces|pages|tmp)/.*$ - [R=404,L]
|
||||
|
|
7
.prettierrc
Normal file
7
.prettierrc
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"useTabs": false,
|
||||
"tabWidth": 2,
|
||||
"printWidth": 100
|
||||
}
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2020 Diego Najar
|
||||
Copyright (c) 2015-2023 Diego Najar
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
86
README.md
86
README.md
|
@ -1,84 +1,52 @@
|
|||
[Bludit](https://www.bludit.com/)
|
||||
================================
|
||||
**Simple**, **Fast** and **Flexible** CMS.
|
||||
# [Bludit](https://www.bludit.com/)
|
||||
|
||||
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 the Simple, Fast, and Flexible CMS.
|
||||
|
||||
Bludit is a **Flat-File** CMS.
|
||||
With Bludit, you can build your own website or blog in just seconds. It’s completely free, open-source, and easy to use. Bludit stores content in JSON format, eliminating the need for database installation or configuration. All you need is a web server with PHP support.
|
||||
|
||||
Bludit supports **Markdown** and **HTML code** for the content.
|
||||
As a Flat-File CMS, Bludit offers unparalleled flexibility and speed. Plus, with support for both Markdown and HTML code, creating and managing content has never been easier.
|
||||
|
||||
## Resources
|
||||
|
||||
- [Plugins](https://plugins.bludit.com)
|
||||
- [Themes](https://themes.bludit.com)
|
||||
- [Documentation](https://docs.bludit.com)
|
||||
- [Talk & Chat on Discord](https://discord.gg/wk5yxRkN)
|
||||
- Help and Support [Forum](https://forum.bludit.org)
|
||||
- News and announcement on [Twitter](https://twitter.com/bludit), [Facebook](https://www.facebook.com/bluditcms), and [Reddit](https://www.reddit.com/r/bludit/)
|
||||
- Talk & Chat on [Discord](https://discord.gg/CFaXEdZWds)
|
||||
- Help and Support on [Forum](https://forum.bludit.org)
|
||||
- Bugs reports on [Github Issues](https://github.com/bludit/bludit/issues)
|
||||
|
||||
Bludit v4 beta
|
||||
---------------
|
||||
Download the lastest Bludit v4.0 BETA from the [releases page](https://github.com/bludit/bludit/releases).
|
||||
|
||||
Use Bludit v4.0 BETA only for new websites or blogs, DO NOT update your Bludit v3.x with this beta version.
|
||||
|
||||
Follow Bludit
|
||||
---------------
|
||||
|
||||
- [Blog](https://blog.bludit.com)
|
||||
- [Twitter](https://twitter.com/bludit)
|
||||
- [Facebook](https://www.facebook.com/bluditcms)
|
||||
- [Youtube](https://www.youtube.com/c/Bluditcms)
|
||||
- [Discord](https://discord.gg/wk5yxRkN)
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
You just need a web server with PHP support.
|
||||
## Requirements
|
||||
|
||||
- Webserver with PHP support.
|
||||
- PHP v5.6 or higher version.
|
||||
- PHP [mbstring](http://php.net/manual/en/book.mbstring.php) module for full UTF-8 support.
|
||||
- PHP [gd](http://php.net/manual/en/book.image.php) module for image processing.
|
||||
- PHP [dom](http://php.net/manual/en/book.dom.php) module for DOM manipulation.
|
||||
- PHP [json](http://php.net/manual/en/book.json.php) module for JSON manipulation.
|
||||
- Supported web servers:
|
||||
* Bludit supports almost every web server
|
||||
* PHP Built-in web server (`php -S localhost:8000`)
|
||||
|
||||
Installation Guide
|
||||
------------------
|
||||
## Installation
|
||||
|
||||
1. Download the latest version from the official page. [Bludit.com](https://www.bludit.com)
|
||||
2. Extract the zip file into a directory like `bludit`.
|
||||
3. Upload the directory `bludit` to your web server or hosting.
|
||||
4. Visit your domain https://example.com/bludit/
|
||||
5. Follow the Bludit Installer to configure the website.
|
||||
1. Download the latest version from the official page: [Bludit.com](https://www.bludit.com)
|
||||
2. Extract the zip file into a directory, such as `bludit`.
|
||||
3. Upload the `bludit` directory to your web server or hosting.
|
||||
4. Visit your domain (e.g., https://example.com/bludit/).
|
||||
5. Follow the Bludit Installer to set up your website.
|
||||
|
||||
Docker Image
|
||||
------------
|
||||
Official Docker image on Docker Hub.
|
||||
- https://hub.docker.com/r/bludit/docker/
|
||||
## Quick installation for testing
|
||||
|
||||
Also we provide Kubernetes deployments yaml files.
|
||||
- https://github.com/bludit/docker/tree/master/kubernetes
|
||||
You can use PHP Built-in web server (`php -S localhost:8000`) or [Docker image](https://hub.docker.com/r/bludit/docker/)
|
||||
|
||||
Support Bludit!
|
||||
-------
|
||||
Bludit is open source 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.
|
||||
## Support Bludit
|
||||
|
||||
[](https://pro.bludit.com/)
|
||||
Bludit is open-source and free to use, but if you find the project useful and would like to support its development, you can contribute on [Patreon](https://www.patreon.com/bePatron?c=921115&rid=2458860). As a token of our appreciation, supporters will receive Bludit PRO.
|
||||
|
||||
### Platinum sponsors in Patreon!
|
||||
If you prefer, you can also make a one-time donation to buy us a coffee or beer. Every contribution helps us continue to improve Bludit and provide the best possible experience for our users.
|
||||
|
||||
- <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=28428918" target="_blank">Curious Activity</a>
|
||||
- <a href="https://www.patreon.com/user/creators?u=27476624" target="_blank">Matěj Adámek</a>
|
||||
- <a href="https://www.patreon.com/pytesNET/creators" target="_blank">pytesNET</a>
|
||||
- [PayPal](https://www.paypal.me/bludit/10)
|
||||
- BTC (Network BTC): bc1qtets5pdj73uyysjpegfh2gar4pfywra4rglcph
|
||||
- ETH (Network ETH): 0x0d7D58D848aA5f175D75Ce4bC746bAC107f331b7
|
||||
|
||||
### Golden sponsors in Patreon!
|
||||
## License
|
||||
|
||||
- <a href="https://www.patreon.com/user/creators?u=30876037" target="_blank">Thomas Kreth</a>
|
||||
- <a href="https://www.patreon.com/user/creators?u=14629621" target="_blank">Christian</a>
|
||||
|
||||
License
|
||||
-------
|
||||
Bludit is open source software licensed under the [MIT license](https://tldrlegal.com/license/mit-license).
|
||||
|
|
0
bl-content/.keep
Normal file
0
bl-content/.keep
Normal file
|
@ -1,6 +1,7 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
class Plugin {
|
||||
class Plugin
|
||||
{
|
||||
|
||||
// (string) directory name, just the name
|
||||
// Ex: sitemap
|
||||
|
@ -55,10 +56,10 @@ class Plugin {
|
|||
// Init empty database with default values
|
||||
$this->db = $this->dbFields;
|
||||
|
||||
$this->filenameDb = PATH_PLUGINS_DATABASES.$this->directoryName.DS.'db.php';
|
||||
$this->filenameDb = PATH_PLUGINS_DATABASES . $this->directoryName . DS . 'db.php';
|
||||
|
||||
// --- Metadata ---
|
||||
$this->filenameMetadata = PATH_PLUGINS.$this->directoryName().DS.'metadata.json';
|
||||
$this->filenameMetadata = PATH_PLUGINS . $this->directoryName() . DS . 'metadata.json';
|
||||
$metadataString = file_get_contents($this->filenameMetadata);
|
||||
$this->metadata = json_decode($metadataString, true);
|
||||
|
||||
|
@ -79,44 +80,44 @@ class Plugin {
|
|||
|
||||
public function includeCSS($filename)
|
||||
{
|
||||
return '<link rel="stylesheet" type="text/css" href="'.$this->domainPath().'css/'.$filename.'?version='.BLUDIT_VERSION.'">'.PHP_EOL;
|
||||
return '<link rel="stylesheet" type="text/css" href="' . $this->domainPath() . 'css/' . $filename . '?version=' . BLUDIT_VERSION . '">' . PHP_EOL;
|
||||
}
|
||||
|
||||
public function includeJS($filename)
|
||||
{
|
||||
return '<script charset="utf-8" src="'.$this->domainPath().'js/'.$filename.'?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
|
||||
return '<script charset="utf-8" src="' . $this->domainPath() . 'js/' . $filename . '?version=' . BLUDIT_VERSION . '"></script>' . PHP_EOL;
|
||||
}
|
||||
|
||||
// Returns absolute URL and path of the plugin directory
|
||||
// This function helps to include CSS or Javascript files with absolute URL
|
||||
public function domainPath()
|
||||
{
|
||||
return DOMAIN_PLUGINS.$this->directoryName.'/';
|
||||
return DOMAIN_PLUGINS . $this->directoryName . '/';
|
||||
}
|
||||
|
||||
// Returns relative path of the plugin directory
|
||||
// This function helps to include CSS or Javascript files with relative URL
|
||||
public function htmlPath()
|
||||
{
|
||||
return HTML_PATH_PLUGINS.$this->directoryName.'/';
|
||||
return HTML_PATH_PLUGINS . $this->directoryName . '/';
|
||||
}
|
||||
|
||||
// Returns absolute path of the plugin directory
|
||||
// This function helps to include PHP libraries or some file at server level
|
||||
public function phpPath()
|
||||
{
|
||||
return PATH_PLUGINS.$this->directoryName.DS;
|
||||
return PATH_PLUGINS . $this->directoryName . DS;
|
||||
}
|
||||
|
||||
public function phpPathDB()
|
||||
{
|
||||
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
|
||||
public function getMetadata($key)
|
||||
{
|
||||
if(isset($this->metadata[$key])) {
|
||||
if (isset($this->metadata[$key])) {
|
||||
return $this->metadata[$key];
|
||||
}
|
||||
|
||||
|
@ -133,7 +134,7 @@ class Plugin {
|
|||
// Returns the value of the field from the database
|
||||
// (string) $field
|
||||
// (boolean) $html, TRUE returns the value sanitized, FALSE unsanitized
|
||||
public function getValue($field, $html=true)
|
||||
public function getValue($field, $html = true)
|
||||
{
|
||||
if (isset($this->db[$field])) {
|
||||
if ($html) {
|
||||
|
@ -204,9 +205,9 @@ class Plugin {
|
|||
{
|
||||
$bluditRoot = explode('.', BLUDIT_VERSION);
|
||||
$compatible = explode(',', $this->getMetadata('compatible'));
|
||||
foreach( $compatible as $version ) {
|
||||
foreach ($compatible as $version) {
|
||||
$root = explode('.', $version);
|
||||
if( $root[0]==$bluditRoot[0] && $root[1]==$bluditRoot[1] ) {
|
||||
if ($root[0] == $bluditRoot[0] && $root[1] == $bluditRoot[1]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +220,7 @@ class Plugin {
|
|||
}
|
||||
|
||||
// Return TRUE if the installation success, otherwise FALSE.
|
||||
public function install($position=1)
|
||||
public function install($position = 1)
|
||||
{
|
||||
if ($this->installed()) {
|
||||
return false;
|
||||
|
@ -230,11 +231,11 @@ class Plugin {
|
|||
mkdir($workspace, DIR_PERMISSIONS, true);
|
||||
|
||||
// Create plugin directory for the database
|
||||
mkdir(PATH_PLUGINS_DATABASES.$this->directoryName, DIR_PERMISSIONS, true);
|
||||
mkdir(PATH_PLUGINS_DATABASES . $this->directoryName, DIR_PERMISSIONS, true);
|
||||
|
||||
$this->dbFields['position'] = $position;
|
||||
// Sanitize default values to store in the file
|
||||
foreach ($this->dbFields as $key=>$value) {
|
||||
foreach ($this->dbFields as $key => $value) {
|
||||
$value = Sanitize::html($value);
|
||||
settype($value, gettype($this->dbFields[$key]));
|
||||
$this->db[$key] = $value;
|
||||
|
@ -247,7 +248,7 @@ class Plugin {
|
|||
public function uninstall()
|
||||
{
|
||||
// Delete database
|
||||
$path = PATH_PLUGINS_DATABASES.$this->directoryName;
|
||||
$path = PATH_PLUGINS_DATABASES . $this->directoryName;
|
||||
Filesystem::deleteRecursive($path);
|
||||
|
||||
// Delete workspace
|
||||
|
@ -266,7 +267,7 @@ class Plugin {
|
|||
|
||||
public function workspace()
|
||||
{
|
||||
return PATH_WORKSPACES.$this->directoryName.DS;
|
||||
return PATH_WORKSPACES . $this->directoryName . DS;
|
||||
}
|
||||
|
||||
public function init()
|
||||
|
@ -284,11 +285,14 @@ class Plugin {
|
|||
public function post()
|
||||
{
|
||||
$args = $_POST;
|
||||
foreach ($this->dbFields as $field=>$value) {
|
||||
foreach ($this->dbFields as $field => $value) {
|
||||
if (isset($args[$field])) {
|
||||
$finalValue = Sanitize::html( $args[$field] );
|
||||
if ($finalValue==='false') { $finalValue = false; }
|
||||
elseif ($finalValue==='true') { $finalValue = true; }
|
||||
$finalValue = Sanitize::html($args[$field]);
|
||||
if ($finalValue === 'false') {
|
||||
$finalValue = false;
|
||||
} elseif ($finalValue === 'true') {
|
||||
$finalValue = true;
|
||||
}
|
||||
settype($finalValue, gettype($value));
|
||||
$this->db[$field] = $finalValue;
|
||||
}
|
||||
|
@ -296,6 +300,11 @@ class Plugin {
|
|||
return $this->save();
|
||||
}
|
||||
|
||||
public function type()
|
||||
{
|
||||
return $this->getMetadata('type');
|
||||
}
|
||||
|
||||
public function setField($field, $value)
|
||||
{
|
||||
$this->db[$field] = Sanitize::html($value);
|
||||
|
@ -309,7 +318,7 @@ class Plugin {
|
|||
|
||||
// Returns the parameters after the URI, FALSE if the URI doesn't match with the webhook
|
||||
// Example: https://www.mybludit.com/api/foo/bar
|
||||
public function webhook($URI=false, $returnsAfterURI=false, $fixed=true)
|
||||
public function webhook($URI = false, $returnsAfterURI = false, $fixed = true)
|
||||
{
|
||||
global $url;
|
||||
|
||||
|
@ -318,10 +327,10 @@ class Plugin {
|
|||
}
|
||||
|
||||
// Check URI start with the webhook
|
||||
$startString = HTML_PATH_ROOT.$URI;
|
||||
$startString = HTML_PATH_ROOT . $URI;
|
||||
$URI = $url->uri();
|
||||
$length = mb_strlen($startString, CHARSET);
|
||||
if (mb_substr($URI, 0, $length)!=$startString) {
|
||||
if (mb_substr($URI, 0, $length) != $startString) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -330,7 +339,7 @@ class Plugin {
|
|||
if ($fixed) {
|
||||
return false;
|
||||
}
|
||||
if ($afterURI[0]!='/') {
|
||||
if ($afterURI[0] != '/') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -339,8 +348,7 @@ class Plugin {
|
|||
return $afterURI;
|
||||
}
|
||||
|
||||
Log::set(__METHOD__.LOG_SEP.'Webhook requested.');
|
||||
Log::set(__METHOD__ . LOG_SEP . 'Webhook requested.');
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,4 +55,4 @@ a.text-danger:hover {
|
|||
.table thead th {
|
||||
font-size: 0.8em;
|
||||
text-transform: uppercase!important;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
html {
|
||||
height: 100%;
|
||||
font-size: 0.9rem;
|
||||
|
@ -18,7 +17,7 @@ body {
|
|||
ICONS
|
||||
*/
|
||||
.fa {
|
||||
padding-right: 2px;
|
||||
margin-right: .5rem !important;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
|
@ -27,8 +26,8 @@ body {
|
|||
*/
|
||||
|
||||
div.sidebar .nav-item a {
|
||||
padding-left:0;
|
||||
padding-right:0;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
color: #555;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
|
@ -69,6 +68,7 @@ div.sidebar .nav-item h4 {
|
|||
|
||||
/* for small devices */
|
||||
@media (max-width: 575.98px) {
|
||||
|
||||
#jsmediaManagerButton,
|
||||
#jscategoryButton,
|
||||
#jsdescriptionButton {
|
||||
|
@ -104,7 +104,7 @@ code {
|
|||
padding: 3px 5px 2px;
|
||||
margin: 0 1px;
|
||||
background: #eaeaea;
|
||||
background: rgba(0,0,0,.07);
|
||||
background: rgba(0, 0, 0, .07);
|
||||
color: #444;
|
||||
}
|
||||
|
||||
|
@ -129,8 +129,8 @@ code {
|
|||
*/
|
||||
|
||||
body.login {
|
||||
background: rgb(255,255,255);
|
||||
background: linear-gradient(0deg, rgba(255,255,255,1) 0%, rgba(250,250,250,1) 53%);
|
||||
background: rgb(255, 255, 255);
|
||||
background: linear-gradient(0deg, rgba(255, 255, 255, 1) 0%, rgba(250, 250, 250, 1) 53%);
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,6 @@ body.login {
|
|||
|
||||
#hello-message {
|
||||
padding: 10px 0;
|
||||
color: #777;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
|
@ -243,7 +242,7 @@ body.login {
|
|||
background-clip: padding-box;
|
||||
border: 1px solid #ced4da;
|
||||
border-radius: .25rem;
|
||||
transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
|
||||
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
|
||||
}
|
||||
|
||||
.plugin-form textarea {
|
||||
|
@ -301,16 +300,20 @@ td.child {
|
|||
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;
|
||||
}
|
||||
|
@ -340,7 +343,7 @@ td.child {
|
|||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: rgba(72,72,72,0.7);
|
||||
background-color: rgba(72, 72, 72, 0.7);
|
||||
z-index: 10;
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<?php
|
||||
|
||||
class Bootstrap {
|
||||
class Bootstrap
|
||||
{
|
||||
|
||||
public static function modal($args) {
|
||||
public static function modal($args)
|
||||
{
|
||||
|
||||
$buttonSecondary = $args['buttonSecondary'];
|
||||
$buttonSecondaryClass = $args['buttonSecondaryClass'];
|
||||
|
@ -15,7 +17,7 @@ class Bootstrap {
|
|||
$modalId = $args['modalId'];
|
||||
|
||||
|
||||
return <<<EOF
|
||||
return <<<EOF
|
||||
<div id="$modalId" class="modal fade" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
|
@ -35,26 +37,26 @@ EOF;
|
|||
|
||||
public static function link($args)
|
||||
{
|
||||
$options = 'href="'.$args['href'].'"';
|
||||
$options = 'href="' . $args['href'] . '"';
|
||||
if (isset($args['class'])) {
|
||||
$options .= ' class="'.$args['class'].'"';
|
||||
$options .= ' class="' . $args['class'] . '"';
|
||||
}
|
||||
if (isset($args['target'])) {
|
||||
$options .= ' target="'.$args['target'].'"';
|
||||
$options .= ' target="' . $args['target'] . '"';
|
||||
}
|
||||
|
||||
if (isset($args['icon'])) {
|
||||
return '<a '.$options.'><span class="fa fa-'.$args['icon'].'"></span>'.$args['title'].'</a>';
|
||||
return '<a ' . $options . '><span class="fa fa-' . $args['icon'] . '"></span>' . $args['title'] . '</a>';
|
||||
}
|
||||
|
||||
return '<a '.$options.'>'.$args['title'].'</a>';
|
||||
return '<a ' . $options . '>' . $args['title'] . '</a>';
|
||||
}
|
||||
|
||||
public static function pageTitle($args)
|
||||
{
|
||||
$icon = $args['icon'];
|
||||
$title = $args['title'];
|
||||
return <<<EOF
|
||||
return <<<EOF
|
||||
<h2 class="mt-0 mb-3">
|
||||
<span class="fa fa-$icon" style="font-size: 0.9em;"></span><span>$title</span>
|
||||
</h2>
|
||||
|
@ -63,21 +65,21 @@ EOF;
|
|||
|
||||
public static function formOpen($args)
|
||||
{
|
||||
$class = empty($args['class'])?'':'class="'.$args['class'].'"';
|
||||
$id = empty($args['id'])?'':'id="'.$args['id'].'"';
|
||||
$enctype = empty($args['enctype'])?'':'enctype="'.$args['enctype'].'"';
|
||||
$action = empty($args['action'])?'action=""':'action="'.$args['action'].'"';
|
||||
$method = empty($args['method'])?'method="post"':'method="'.$args['method'].'"';
|
||||
$style = empty($args['style'])?'':'style="'.$args['style'].'"';
|
||||
$class = empty($args['class']) ? '' : 'class="' . $args['class'] . '"';
|
||||
$id = empty($args['id']) ? '' : 'id="' . $args['id'] . '"';
|
||||
$enctype = empty($args['enctype']) ? '' : 'enctype="' . $args['enctype'] . '"';
|
||||
$action = empty($args['action']) ? 'action=""' : 'action="' . $args['action'] . '"';
|
||||
$method = empty($args['method']) ? 'method="post"' : 'method="' . $args['method'] . '"';
|
||||
$style = empty($args['style']) ? '' : 'style="' . $args['style'] . '"';
|
||||
|
||||
return <<<EOF
|
||||
return <<<EOF
|
||||
<form $class $enctype $id $method $action $style autocomplete="off">
|
||||
EOF;
|
||||
}
|
||||
|
||||
public static function formClose()
|
||||
{
|
||||
return <<<EOF
|
||||
return <<<EOF
|
||||
</form>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
@ -95,7 +97,7 @@ EOF;
|
|||
public static function formTitle($args)
|
||||
{
|
||||
$title = $args['title'];
|
||||
return <<<EOF
|
||||
return <<<EOF
|
||||
<h6 class="mt-4 mb-2 pb-2 border-bottom text-uppercase">$title</h6>
|
||||
EOF;
|
||||
}
|
||||
|
@ -103,18 +105,18 @@ EOF;
|
|||
public static function formInputTextBlock($args)
|
||||
{
|
||||
$name = $args['name'];
|
||||
$disabled = empty($args['disabled'])?'':'disabled';
|
||||
$placeholder = isset($args['placeholder'])?$args['placeholder']:'';
|
||||
$value = isset($args['value'])?$args['value']:'';
|
||||
$disabled = empty($args['disabled']) ? '' : 'disabled';
|
||||
$placeholder = isset($args['placeholder']) ? $args['placeholder'] : '';
|
||||
$value = isset($args['value']) ? $args['value'] : '';
|
||||
|
||||
$id = 'js'.$name;
|
||||
$id = 'js' . $name;
|
||||
if (isset($args['id'])) {
|
||||
$id = $args['id'];
|
||||
}
|
||||
|
||||
$tip = '';
|
||||
if (!empty($args['tip'])) {
|
||||
$tip = '<small class="form-text text-muted">'.$args['tip'].'</small>';
|
||||
$tip = '<small class="form-text text-muted">' . $args['tip'] . '</small>';
|
||||
}
|
||||
|
||||
$class = 'form-group m-0';
|
||||
|
@ -129,7 +131,7 @@ EOF;
|
|||
|
||||
$label = '';
|
||||
if (!empty($args['label'])) {
|
||||
$label = '<label class="'.$labelClass.'" for="'.$id.'">'.$args['label'].'</label>';
|
||||
$label = '<label class="' . $labelClass . '" for="' . $id . '">' . $args['label'] . '</label>';
|
||||
}
|
||||
|
||||
$type = 'text';
|
||||
|
@ -137,10 +139,10 @@ EOF;
|
|||
$type = $args['type'];
|
||||
}
|
||||
|
||||
return <<<EOF
|
||||
return <<<EOF
|
||||
<div class="$class">
|
||||
$label
|
||||
<input type="text" value="$value" class="form-control" id="$id" name="$name" placeholder="$placeholder" $disabled>
|
||||
<input type="text" dir="auto" value="$value" class="form-control" id="$id" name="$name" placeholder="$placeholder" $disabled>
|
||||
$tip
|
||||
</div>
|
||||
EOF;
|
||||
|
@ -148,19 +150,19 @@ EOF;
|
|||
|
||||
public static function formInputFile($args)
|
||||
{
|
||||
$id = 'js'.$args['name'];
|
||||
$id = 'js' . $args['name'];
|
||||
if (isset($args['id'])) {
|
||||
$id = $args['id'];
|
||||
}
|
||||
|
||||
$class = 'custom-file';
|
||||
if (isset($args['class'])) {
|
||||
$class = $class.' '.$args['class'];
|
||||
$class = $class . ' ' . $args['class'];
|
||||
}
|
||||
|
||||
$html = '<div class="'.$class.'">';
|
||||
$html .= '<input type="file" class="custom-file-input" id="'.$id.'">';
|
||||
$html .= '<label class="custom-file-label" for="'.$id.'">'.$args['label'].'</label>';
|
||||
$html = '<div class="' . $class . '">';
|
||||
$html .= '<input type="file" class="custom-file-input" id="' . $id . '">';
|
||||
$html .= '<label class="custom-file-label" for="' . $id . '">' . $args['label'] . '</label>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
|
@ -168,26 +170,26 @@ EOF;
|
|||
|
||||
public static function formTextarea($args)
|
||||
{
|
||||
$id = 'js'.$args['name'];
|
||||
$id = 'js' . $args['name'];
|
||||
if (isset($args['id'])) {
|
||||
$id = $args['id'];
|
||||
}
|
||||
|
||||
$class = 'form-control';
|
||||
if (isset($args['class'])) {
|
||||
$class = $class.' '.$args['class'];
|
||||
$class = $class . ' ' . $args['class'];
|
||||
}
|
||||
|
||||
$html = '<div class="form-group row">';
|
||||
|
||||
if (!empty($args['label'])) {
|
||||
$html .= '<label for="'.$id.'" class="col-sm-2 col-form-label">'.$args['label'].'</label>';
|
||||
$html .= '<label for="' . $id . '" class="col-sm-2 col-form-label">' . $args['label'] . '</label>';
|
||||
}
|
||||
|
||||
$html .= '<div class="col-sm-10">';
|
||||
$html .= '<textarea class="'.$class.'" id="'.$id.'" name="'.$args['name'].'" rows="'.$args['rows'].'" placeholder="'.$args['placeholder'].'">'.$args['value'].'</textarea>';
|
||||
$html .= '<textarea class="' . $class . '" id="' . $id . '" name="' . $args['name'] . '" rows="' . $args['rows'] . '" placeholder="' . $args['placeholder'] . '">' . $args['value'] . '</textarea>';
|
||||
if (isset($args['tip'])) {
|
||||
$html .= '<small class="form-text text-muted">'.$args['tip'].'</small>';
|
||||
$html .= '<small class="form-text text-muted">' . $args['tip'] . '</small>';
|
||||
}
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
|
@ -197,24 +199,24 @@ EOF;
|
|||
|
||||
public static function formTextareaBlock($args)
|
||||
{
|
||||
$id = 'js'.$args['name'];
|
||||
$id = 'js' . $args['name'];
|
||||
if (isset($args['id'])) {
|
||||
$id = $args['id'];
|
||||
}
|
||||
|
||||
$class = 'form-control';
|
||||
if (!empty($args['class'])) {
|
||||
$class = $class.' '.$args['class'];
|
||||
$class = $class . ' ' . $args['class'];
|
||||
}
|
||||
|
||||
$html = '<div class="form-group m-0">';
|
||||
if (!empty($args['label'])) {
|
||||
$html .= '<label class="mt-4 mb-2 pb-2 border-bottom text-uppercase w-100" for="'.$id.'">'.$args['label'].'</label>';
|
||||
$html .= '<label class="mt-4 mb-2 pb-2 border-bottom text-uppercase w-100" for="' . $id . '">' . $args['label'] . '</label>';
|
||||
}
|
||||
|
||||
$html .= '<textarea class="'.$class.'" id="'.$id.'" name="'.$args['name'].'" rows="'.$args['rows'].'" placeholder="'.$args['placeholder'].'">'.$args['value'].'</textarea>';
|
||||
$html .= '<textarea class="' . $class . '" id="' . $id . '" name="' . $args['name'] . '" rows="' . $args['rows'] . '" placeholder="' . $args['placeholder'] . '">' . $args['value'] . '</textarea>';
|
||||
if (!empty($args['tip'])) {
|
||||
$html .= '<small class="form-text text-muted">'.$args['tip'].'</small>';
|
||||
$html .= '<small class="form-text text-muted">' . $args['tip'] . '</small>';
|
||||
}
|
||||
$html .= '</div>';
|
||||
|
||||
|
@ -224,29 +226,29 @@ EOF;
|
|||
public static function formInputText($args)
|
||||
{
|
||||
$name = $args['name'];
|
||||
$disabled = empty($args['disabled'])?'':'disabled';
|
||||
$readonly = empty($args['readonly'])?'':'readonly';
|
||||
$placeholder = isset($args['placeholder'])?$args['placeholder']:'';
|
||||
$value = isset($args['value'])?$args['value']:'';
|
||||
$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'])) {
|
||||
$id = $args['id'];
|
||||
}
|
||||
|
||||
$tip = '';
|
||||
if (isset($args['tip'])) {
|
||||
$tip = '<small class="form-text text-muted">'.$args['tip'].'</small>';
|
||||
$tip = '<small class="form-text text-muted">' . $args['tip'] . '</small>';
|
||||
}
|
||||
|
||||
$label = '';
|
||||
if (isset($args['label'])) {
|
||||
$label = '<label for="'.$id.'" class="col-sm-2 col-form-label">'.$args['label'].'</label>';
|
||||
$label = '<label for="' . $id . '" class="col-sm-2 col-form-label">' . $args['label'] . '</label>';
|
||||
}
|
||||
|
||||
$class = 'form-control';
|
||||
if (isset($args['class'])) {
|
||||
$class = $class.' '.$args['class'];
|
||||
$class = $class . ' ' . $args['class'];
|
||||
}
|
||||
|
||||
$type = 'text';
|
||||
|
@ -254,11 +256,11 @@ EOF;
|
|||
$type = $args['type'];
|
||||
}
|
||||
|
||||
return <<<EOF
|
||||
return <<<EOF
|
||||
<div class="form-group row">
|
||||
$label
|
||||
<div class="col-sm-10">
|
||||
<input class="$class" id="$id" name="$name" value="$value" placeholder="$placeholder" type="$type" $disabled $readonly>
|
||||
<input class="$class" id="$id" name="$name" value="$value" placeholder="$placeholder" type="$type" dir="auto" $disabled $readonly>
|
||||
$tip
|
||||
</div>
|
||||
</div>
|
||||
|
@ -267,16 +269,16 @@ EOF;
|
|||
|
||||
public static function formCheckbox($args)
|
||||
{
|
||||
$labelForCheckbox = isset($args['labelForCheckbox'])?$args['labelForCheckbox']:'';
|
||||
$placeholder = isset($args['placeholder'])?$args['placeholder']:'';
|
||||
$tip = isset($args['tip'])?'<small class="form-text text-muted">'.$args['tip'].'</small>':'';
|
||||
$value = isset($args['value'])?$args['value']:'';
|
||||
$labelForCheckbox = isset($args['labelForCheckbox']) ? $args['labelForCheckbox'] : '';
|
||||
$placeholder = isset($args['placeholder']) ? $args['placeholder'] : '';
|
||||
$tip = isset($args['tip']) ? '<small class="form-text text-muted">' . $args['tip'] . '</small>' : '';
|
||||
$value = isset($args['value']) ? $args['value'] : '';
|
||||
$name = $args['name'];
|
||||
$id = 'js'.$name;
|
||||
$id = 'js' . $name;
|
||||
if (isset($args['id'])) {
|
||||
$id = $args['id'];
|
||||
}
|
||||
$disabled = isset($args['disabled'])?'disabled':'';
|
||||
$disabled = isset($args['disabled']) ? 'disabled' : '';
|
||||
|
||||
$class = 'form-group m-0';
|
||||
if (isset($args['class'])) {
|
||||
|
@ -295,13 +297,13 @@ EOF;
|
|||
|
||||
$label = '';
|
||||
if (!empty($args['label'])) {
|
||||
$label = '<label class="'.$labelClass.'">'.$args['label'].'</label>';
|
||||
$label = '<label class="' . $labelClass . '">' . $args['label'] . '</label>';
|
||||
}
|
||||
|
||||
$checked = $args['checked']?'checked':'';
|
||||
$value = $checked?'1':'0';
|
||||
$checked = $args['checked'] ? 'checked' : '';
|
||||
$value = $checked ? '1' : '0';
|
||||
|
||||
return <<<EOF
|
||||
return <<<EOF
|
||||
<div class="$class">
|
||||
$label
|
||||
<div class="form-check">
|
||||
|
@ -315,30 +317,30 @@ EOF;
|
|||
|
||||
public static function formSelect($args)
|
||||
{
|
||||
$id = 'js'.$args['name'];
|
||||
$id = 'js' . $args['name'];
|
||||
if (isset($args['id'])) {
|
||||
$id = $args['id'];
|
||||
}
|
||||
|
||||
$class = 'custom-select';
|
||||
if (isset($args['class'])) {
|
||||
$class = $class.' '.$args['class'];
|
||||
$class = $class . ' ' . $args['class'];
|
||||
}
|
||||
|
||||
$html = '<div class="form-group row">';
|
||||
|
||||
if (isset($args['label'])) {
|
||||
$html .= '<label for="'.$id.'" class="col-sm-2 col-form-label">'.$args['label'].'</label>';
|
||||
$html .= '<label for="' . $id . '" class="col-sm-2 col-form-label">' . $args['label'] . '</label>';
|
||||
}
|
||||
|
||||
$html .= '<div class="col-sm-10">';
|
||||
$html .= '<select id="'.$id.'" name="'.$args['name'].'" class="'.$class.'">';
|
||||
foreach ($args['options'] as $key=>$value) {
|
||||
$html .= '<option '.(($key==$args['selected'])?'selected':'').' value="'.$key.'">'.$value.'</option>';
|
||||
$html .= '<select id="' . $id . '" name="' . $args['name'] . '" class="' . $class . '">';
|
||||
foreach ($args['options'] as $key => $value) {
|
||||
$html .= '<option ' . (($key == $args['selected']) ? 'selected' : '') . ' value="' . $key . '">' . $value . '</option>';
|
||||
}
|
||||
$html .= '</select>';
|
||||
if (isset($args['tip'])) {
|
||||
$html .= '<small class="form-text text-muted">'.$args['tip'].'</small>';
|
||||
$html .= '<small class="form-text text-muted">' . $args['tip'] . '</small>';
|
||||
}
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
|
@ -348,32 +350,32 @@ EOF;
|
|||
|
||||
public static function formSelectBlock($args)
|
||||
{
|
||||
$id = 'js'.$args['name'];
|
||||
$id = 'js' . $args['name'];
|
||||
if (isset($args['id'])) {
|
||||
$id = $args['id'];
|
||||
}
|
||||
|
||||
$class = 'custom-select';
|
||||
if (!empty($args['class'])) {
|
||||
$class = $class.' '.$args['class'];
|
||||
$class = $class . ' ' . $args['class'];
|
||||
}
|
||||
|
||||
$html = '<div class="form-group m-0">';
|
||||
|
||||
if (!empty($args['label'])) {
|
||||
$html .= '<label class="mt-4 mb-2 pb-2 border-bottom text-uppercase w-100" for="'.$id.'">'.$args['label'].'</label>';
|
||||
$html .= '<label class="mt-4 mb-2 pb-2 border-bottom text-uppercase w-100" for="' . $id . '">' . $args['label'] . '</label>';
|
||||
}
|
||||
|
||||
$html .= '<select id="'.$id.'" name="'.$args['name'].'" class="'.$class.'">';
|
||||
$html .= '<select id="' . $id . '" name="' . $args['name'] . '" class="' . $class . '">';
|
||||
if (!empty($args['emptyOption'])) {
|
||||
$html .= '<option value="">'.$args['emptyOption'].'</option>';
|
||||
$html .= '<option value="">' . $args['emptyOption'] . '</option>';
|
||||
}
|
||||
foreach ($args['options'] as $key=>$value) {
|
||||
$html .= '<option '.(($key==$args['selected'])?'selected':'').' value="'.$key.'">'.$value.'</option>';
|
||||
foreach ($args['options'] as $key => $value) {
|
||||
$html .= '<option ' . (($key == $args['selected']) ? 'selected' : '') . ' value="' . $key . '">' . $value . '</option>';
|
||||
}
|
||||
$html .= '</select>';
|
||||
if (!empty($args['tip'])) {
|
||||
$html .= '<small class="form-text text-muted">'.$args['tip'].'</small>';
|
||||
$html .= '<small class="form-text text-muted">' . $args['tip'] . '</small>';
|
||||
}
|
||||
$html .= '</div>';
|
||||
|
||||
|
@ -382,19 +384,19 @@ EOF;
|
|||
|
||||
public static function formInputHidden($args)
|
||||
{
|
||||
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'];
|
||||
$class = $class . ' ' . $args['class'];
|
||||
}
|
||||
|
||||
$text = $args['text'];
|
||||
|
||||
return <<<EOF
|
||||
return <<<EOF
|
||||
<div class="$class" role="alert">$text</div>
|
||||
EOF;
|
||||
}
|
||||
|
|
|
@ -1,54 +1,57 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Bludit</title>
|
||||
<meta charset="<?php echo CHARSET ?>">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="robots" content="noindex,nofollow">
|
||||
<title>Bludit</title>
|
||||
<meta charset="<?php echo CHARSET ?>">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="robots" content="noindex,nofollow">
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="shortcut icon" type="image/x-icon" href="<?php echo HTML_PATH_CORE_IMG.'favicon.png?version='.BLUDIT_VERSION ?>">
|
||||
<!-- Favicon -->
|
||||
<link rel="shortcut icon" type="image/x-icon" href="<?php echo HTML_PATH_CORE_IMG . 'favicon.png?version=' . BLUDIT_VERSION ?>">
|
||||
|
||||
<!-- CSS -->
|
||||
<?php
|
||||
echo Theme::cssBootstrap();
|
||||
echo Theme::css(array(
|
||||
'bludit.css',
|
||||
'bludit.bootstrap.css'
|
||||
), DOMAIN_ADMIN_THEME_CSS);
|
||||
?>
|
||||
<!-- CSS -->
|
||||
<?php
|
||||
echo Theme::cssBootstrap();
|
||||
echo Theme::css(array(
|
||||
'bludit.css',
|
||||
'bludit.bootstrap.css'
|
||||
), DOMAIN_ADMIN_THEME_CSS);
|
||||
?>
|
||||
|
||||
<!-- Javascript -->
|
||||
<?php
|
||||
echo Theme::jquery();
|
||||
echo Theme::jsBootstrap();
|
||||
?>
|
||||
<!-- Javascript -->
|
||||
<?php
|
||||
echo Theme::jquery();
|
||||
echo Theme::jsBootstrap();
|
||||
?>
|
||||
|
||||
<!-- Plugins -->
|
||||
<?php Theme::plugins('loginHead') ?>
|
||||
<!-- Plugins -->
|
||||
<?php Theme::plugins('loginHead') ?>
|
||||
</head>
|
||||
|
||||
<body class="login">
|
||||
|
||||
<!-- Plugins -->
|
||||
<?php Theme::plugins('loginBodyBegin') ?>
|
||||
<!-- Plugins -->
|
||||
<?php Theme::plugins('loginBodyBegin') ?>
|
||||
|
||||
<!-- Alert -->
|
||||
<?php include('html/alert.php'); ?>
|
||||
<!-- Alert -->
|
||||
<?php include('html/alert.php'); ?>
|
||||
|
||||
<div class="container">
|
||||
<div class="row justify-content-md-center pt-5">
|
||||
<div class="col-md-4 pt-5">
|
||||
<?php
|
||||
if (Sanitize::pathFile(PATH_ADMIN_VIEWS, $layout['view'].'.php')) {
|
||||
include(PATH_ADMIN_VIEWS.$layout['view'].'.php');
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="row justify-content-md-center pt-5">
|
||||
<div class="col-md-4 mt-5 p-5 shadow-sm bg-white rounded border">
|
||||
<?php
|
||||
if (Sanitize::pathFile(PATH_ADMIN_VIEWS, $layout['view'] . '.php')) {
|
||||
include(PATH_ADMIN_VIEWS . $layout['view'] . '.php');
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Plugins -->
|
||||
<?php Theme::plugins('loginBodyEnd') ?>
|
||||
<!-- Plugins -->
|
||||
<?php Theme::plugins('loginBodyEnd') ?>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 09138280134ec8014982f260c1ebb6a5b0091fdc
|
|
@ -1,176 +1,140 @@
|
|||
<div id="dashboard" class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
|
||||
<!-- Good message -->
|
||||
<div>
|
||||
<h2 id="hello-message" class="pt-0">
|
||||
<?php
|
||||
$username = $login->username();
|
||||
$user = new User($username);
|
||||
$name = '';
|
||||
if ($user->nickname()) {
|
||||
$name = $user->nickname();
|
||||
} elseif ($user->firstName()) {
|
||||
$name = $user->firstName();
|
||||
}
|
||||
?>
|
||||
<span class="fa fa-hand-spock-o"></span><span><?php echo $L->g('hello').' '.$name ?></span>
|
||||
</h2>
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
$("#hello-message").fadeOut(2400, 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>
|
||||
<!-- Good message -->
|
||||
<div>
|
||||
<h2 id="hello-message" class="pt-0">
|
||||
<?php
|
||||
$username = $login->username();
|
||||
$user = new User($username);
|
||||
$name = '';
|
||||
if ($user->nickname()) {
|
||||
$name = $user->nickname();
|
||||
} elseif ($user->firstName()) {
|
||||
$name = $user->firstName();
|
||||
}
|
||||
?>
|
||||
<span class="fa fa-hand-spock-o"></span><span><?php echo $L->g('welcome') ?></span>
|
||||
</h2>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("#hello-message").fadeOut(2400, 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') . ', ' . $name ?>');
|
||||
} else if (hours >= 12 && hours < 18) {
|
||||
$(this).html('<span class="fa fa-sun-o"></span><?php echo $L->g('good-afternoon') . ', ' . $name ?>');
|
||||
} else if (hours >= 18 && hours < 22) {
|
||||
$(this).html('<span class="fa fa-moon-o"></span><?php echo $L->g('good-evening') . ', ' . $name ?>');
|
||||
} else {
|
||||
$(this).html('<span class="fa fa-moon-o"></span><span><?php echo $L->g('good-night') . ', ' . $name ?></span>');
|
||||
}
|
||||
}).fadeIn(1000);
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<!-- Quick Links -->
|
||||
<div class="container pb-5" id="jsclippyContainer">
|
||||
<!-- Quick Links -->
|
||||
<div class="container pb-5" id="jsclippyContainer">
|
||||
|
||||
<div class="row">
|
||||
<div class="col p-0">
|
||||
<div class="form-group">
|
||||
<select id="jsclippy" class="clippy" name="state"></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-0">
|
||||
<div class="form-group">
|
||||
<select id="jsclippy" class="clippy" name="state"></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
<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>';
|
||||
}
|
||||
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");
|
||||
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 border-top pt-4 mt-4">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<a class="quick-links text-center" target="_blank" href="https://docs.bludit.com">
|
||||
<div class="fa fa-compass quick-links-icons"></div>
|
||||
<div><?php $L->p('Documentation') ?></div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col border-left border-right">
|
||||
<a class="quick-links text-center" target="_blank" href="https://forum.bludit.org">
|
||||
<div class="fa fa-support quick-links-icons"></div>
|
||||
<div><?php $L->p('Forum support') ?></div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col">
|
||||
<a class="quick-links text-center" target="_blank" href="https://discord.gg/CFaXEdZWds">
|
||||
<div class="fa fa-comments quick-links-icons"></div>
|
||||
<div><?php $L->p('Chat support') ?></div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<a class="quick-links text-center" target="_blank" href="https://themes.bludit.com">
|
||||
<div class="fa fa-desktop quick-links-icons"></div>
|
||||
<div><?php $L->p('Themes') ?></div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col border-left border-right">
|
||||
<a class="quick-links text-center" target="_blank" href="https://plugins.bludit.com">
|
||||
<div class="fa fa-puzzle-piece quick-links-icons"></div>
|
||||
<div><?php $L->p('Plugins') ?></div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col">
|
||||
<a class="quick-links text-center" target="_blank" href="https://github.com/bludit/bludit">
|
||||
<div class="fa fa-github quick-links-icons"></div>
|
||||
<div><?php $L->p('GitHub') ?></div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<?php Theme::plugins('dashboard') ?>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<?php Theme::plugins('dashboard') ?>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
|
||||
<!-- Notifications -->
|
||||
<ul class="list-group list-group-striped b-0">
|
||||
<li class="list-group-item pt-0"><h4 class="m-0"><?php $L->p('Notifications') ?></h4></li>
|
||||
<?php
|
||||
$logs = array_slice($syslog->db, 0, NOTIFICATIONS_AMOUNT);
|
||||
foreach ($logs as $log) {
|
||||
$phrase = $L->g($log['dictionaryKey']);
|
||||
echo '<li class="list-group-item">';
|
||||
echo $phrase;
|
||||
if (!empty($log['notes'])) {
|
||||
echo ' « <b>'.$log['notes'].'</b> »';
|
||||
}
|
||||
echo '<br><span class="notification-date"><small>';
|
||||
echo Date::format($log['date'], DB_DATE_FORMAT, NOTIFICATIONS_DATE_FORMAT);
|
||||
echo ' [ '.$log['username'] .' ]';
|
||||
echo '</small></span>';
|
||||
echo '</li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<!-- Notifications -->
|
||||
<ul class="list-group list-group-striped b-0">
|
||||
<li class="list-group-item pt-0">
|
||||
<h4 class="m-0"><?php $L->p('Notifications') ?></h4>
|
||||
</li>
|
||||
<?php
|
||||
$logs = array_slice($syslog->db, 0, NOTIFICATIONS_AMOUNT);
|
||||
foreach ($logs as $log) {
|
||||
$phrase = $L->g($log['dictionaryKey']);
|
||||
echo '<li class="list-group-item">';
|
||||
echo $phrase;
|
||||
if (!empty($log['notes'])) {
|
||||
echo ' « <b>' . $log['notes'] . '</b> »';
|
||||
}
|
||||
echo '<br><span class="notification-date"><small>';
|
||||
echo Date::format($log['date'], DB_DATE_FORMAT, NOTIFICATIONS_DATE_FORMAT);
|
||||
echo ' [ ' . $log['username'] . ' ]';
|
||||
echo '</small></span>';
|
||||
echo '</li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -4,46 +4,46 @@
|
|||
|
||||
// FORM START
|
||||
echo Bootstrap::formOpen(array(
|
||||
'id'=>'jsform',
|
||||
'class'=>'d-flex flex-column h-100'
|
||||
'id' => 'jsform',
|
||||
'class' => 'd-flex flex-column h-100'
|
||||
));
|
||||
|
||||
// Token CSRF
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name'=>'tokenCSRF',
|
||||
'value'=>$security->getTokenCSRF()
|
||||
));
|
||||
// Token CSRF
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name' => 'tokenCSRF',
|
||||
'value' => $security->getTokenCSRF()
|
||||
));
|
||||
|
||||
// UUID
|
||||
// The UUID is generated in the controller
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name'=>'uuid',
|
||||
'value'=>$page->uuid()
|
||||
));
|
||||
// UUID
|
||||
// The UUID is generated in the controller
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name' => 'uuid',
|
||||
'value' => $page->uuid()
|
||||
));
|
||||
|
||||
// Type = published, draft, sticky, static
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name'=>'type',
|
||||
'value'=>$page->type()
|
||||
));
|
||||
// Type = published, draft, sticky, static
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name' => 'type',
|
||||
'value' => $page->type()
|
||||
));
|
||||
|
||||
// Cover image
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name'=>'coverImage',
|
||||
'value'=>$page->coverImage(false)
|
||||
));
|
||||
// Cover image
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name' => 'coverImage',
|
||||
'value' => $page->coverImage(false)
|
||||
));
|
||||
|
||||
// Content
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name'=>'content',
|
||||
'value'=>''
|
||||
));
|
||||
// Content
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name' => 'content',
|
||||
'value' => ''
|
||||
));
|
||||
|
||||
// Current page key
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name'=>'key',
|
||||
'value'=>$page->key()
|
||||
));
|
||||
// Current page key
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name' => 'key',
|
||||
'value' => $page->key()
|
||||
));
|
||||
?>
|
||||
|
||||
<!-- TOOLBAR -->
|
||||
|
@ -56,11 +56,11 @@ echo Bootstrap::formOpen(array(
|
|||
<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>
|
||||
<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 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>
|
||||
|
@ -81,10 +81,10 @@ echo Bootstrap::formOpen(array(
|
|||
<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 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 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>
|
||||
|
@ -93,40 +93,40 @@ echo Bootstrap::formOpen(array(
|
|||
<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()
|
||||
));
|
||||
// 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')
|
||||
));
|
||||
// Description
|
||||
echo Bootstrap::formTextareaBlock(array(
|
||||
'name' => 'description',
|
||||
'label' => $L->g('Description'),
|
||||
'selected' => '',
|
||||
'class' => '',
|
||||
'value' => $page->description(),
|
||||
'rows' => 5,
|
||||
'placeholder' => $L->get('this-field-can-help-describe-the-content')
|
||||
));
|
||||
?>
|
||||
|
||||
<!-- Cover Image -->
|
||||
<?php
|
||||
$coverImage = $page->coverImage(false);
|
||||
$externalCoverImage = '';
|
||||
if (filter_var($coverImage, FILTER_VALIDATE_URL)) {
|
||||
$coverImage = '';
|
||||
$externalCoverImage = $page->coverImage(false);
|
||||
}
|
||||
$coverImage = $page->coverImage(false);
|
||||
$externalCoverImage = '';
|
||||
if (filter_var($coverImage, FILTER_VALIDATE_URL)) {
|
||||
$coverImage = '';
|
||||
$externalCoverImage = $page->coverImage(false);
|
||||
}
|
||||
?>
|
||||
<label class="mt-4 mb-2 pb-2 border-bottom text-uppercase w-100"><?php $L->p('Cover Image') ?></label>
|
||||
<div>
|
||||
<img id="jscoverImagePreview" class="mx-auto d-block w-100" alt="Cover image preview" src="<?php echo (empty($coverImage) ? HTML_PATH_CORE_IMG.'default.svg' : $page->coverImage() ) ?>" />
|
||||
<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>
|
||||
|
@ -144,220 +144,222 @@ echo Bootstrap::formOpen(array(
|
|||
|
||||
$("#jsbuttonRemoveCoverImage").on("click", function() {
|
||||
$("#jscoverImage").val('');
|
||||
$("#jscoverImagePreview").attr('src', HTML_PATH_CORE_IMG+'default.svg');
|
||||
$("#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')
|
||||
));
|
||||
// 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'=>''
|
||||
));
|
||||
// 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()
|
||||
));
|
||||
// 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()
|
||||
));
|
||||
// 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
|
||||
// Parent
|
||||
try {
|
||||
$options = array();
|
||||
$parentKey = $page->parent();
|
||||
if (!empty($parentKey)) {
|
||||
$parent = new Page($parentKey);
|
||||
$options = array($parentKey => $parent->title());
|
||||
}
|
||||
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.'),
|
||||
));
|
||||
} 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
|
||||
$(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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
},
|
||||
escapeMarkup: function(markup) {
|
||||
return markup;
|
||||
},
|
||||
templateResult: function(data) {
|
||||
var html = data.text
|
||||
if (data.type=="static") {
|
||||
html += '<span class="badge badge-pill badge-light">'+data.type+'</span>';
|
||||
}
|
||||
return html;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
// Template
|
||||
echo Bootstrap::formInputTextBlock(array(
|
||||
'name'=>'template',
|
||||
'label'=>$L->g('Template'),
|
||||
'placeholder'=>'',
|
||||
'value'=>$page->template(),
|
||||
'tip'=>$L->g('Write a template name to filter the page in the theme and change the style of the page.')
|
||||
));
|
||||
// Template
|
||||
echo Bootstrap::formInputTextBlock(array(
|
||||
'name' => 'template',
|
||||
'label' => $L->g('Template'),
|
||||
'placeholder' => '',
|
||||
'value' => $page->template(),
|
||||
'tip' => $L->g('Write a template name to filter the page in the theme and change the style of the page.')
|
||||
));
|
||||
|
||||
echo Bootstrap::formInputTextBlock(array(
|
||||
'name'=>'externalCoverImage',
|
||||
'label'=>$L->g('External cover image'),
|
||||
'placeholder'=>"https://",
|
||||
'value'=>$externalCoverImage,
|
||||
'tip'=>$L->g('Set a cover image from external URL, such as a CDN or some server dedicated for images.')
|
||||
));
|
||||
echo Bootstrap::formInputTextBlock(array(
|
||||
'name' => 'externalCoverImage',
|
||||
'label' => $L->g('External cover image'),
|
||||
'placeholder' => "https://",
|
||||
'value' => $externalCoverImage,
|
||||
'tip' => $L->g('Set a cover image from external URL, such as a CDN or some server dedicated for images.')
|
||||
));
|
||||
|
||||
// Username
|
||||
echo Bootstrap::formInputTextBlock(array(
|
||||
'name'=>'',
|
||||
'label'=>$L->g('Author'),
|
||||
'placeholder'=>'',
|
||||
'value'=>$page->username(),
|
||||
'tip'=>'',
|
||||
'disabled'=>true
|
||||
));
|
||||
// Username
|
||||
echo Bootstrap::formInputTextBlock(array(
|
||||
'name' => '',
|
||||
'label' => $L->g('Author'),
|
||||
'placeholder' => '',
|
||||
'value' => $page->username(),
|
||||
'tip' => '',
|
||||
'disabled' => true
|
||||
));
|
||||
?>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Changes in External cover image input
|
||||
$("#jsexternalCoverImage").change(function() {
|
||||
$("#jscoverImage").val( $(this).val() );
|
||||
});
|
||||
$(document).ready(function() {
|
||||
// Changes in External cover image input
|
||||
$("#jsexternalCoverImage").change(function() {
|
||||
$("#jscoverImage").val($(this).val());
|
||||
});
|
||||
|
||||
// Datepicker
|
||||
$("#jsdate").datetimepicker({format:DB_DATE_FORMAT});
|
||||
});
|
||||
// Datepicker
|
||||
$("#jsdate").datetimepicker({
|
||||
format: DB_DATE_FORMAT
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($site->customFields())): ?>
|
||||
<div id="nav-custom" class="tab-pane fade" role="tabpanel" aria-labelledby="custom-tab">
|
||||
<?php
|
||||
$customFields = $site->customFields();
|
||||
foreach ($customFields as $field=>$options) {
|
||||
if ( !isset($options['position']) ) {
|
||||
if ($options['type']=="string") {
|
||||
echo Bootstrap::formInputTextBlock(array(
|
||||
'name'=>'custom['.$field.']',
|
||||
'value'=>(isset($options['default'])?$options['default']:''),
|
||||
'tip'=>(isset($options['tip'])?$options['tip']:''),
|
||||
'label'=>(isset($options['label'])?$options['label']:''),
|
||||
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
|
||||
'value'=>$page->custom($field)
|
||||
));
|
||||
} elseif ($options['type']=="bool") {
|
||||
echo Bootstrap::formCheckbox(array(
|
||||
'name'=>'custom['.$field.']',
|
||||
'label'=>(isset($options['label'])?$options['label']:''),
|
||||
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
|
||||
'checked'=>$page->custom($field),
|
||||
'labelForCheckbox'=>(isset($options['tip'])?$options['tip']:'')
|
||||
));
|
||||
<?php if (!empty($site->customFields())) : ?>
|
||||
<div id="nav-custom" class="tab-pane fade" role="tabpanel" aria-labelledby="custom-tab">
|
||||
<?php
|
||||
$customFields = $site->customFields();
|
||||
foreach ($customFields as $field => $options) {
|
||||
if (!isset($options['position'])) {
|
||||
if ($options['type'] == "string") {
|
||||
echo Bootstrap::formInputTextBlock(array(
|
||||
'name' => 'custom[' . $field . ']',
|
||||
'value' => (isset($options['default']) ? $options['default'] : ''),
|
||||
'tip' => (isset($options['tip']) ? $options['tip'] : ''),
|
||||
'label' => (isset($options['label']) ? $options['label'] : ''),
|
||||
'placeholder' => (isset($options['placeholder']) ? $options['placeholder'] : ''),
|
||||
'value' => $page->custom($field)
|
||||
));
|
||||
} elseif ($options['type'] == "bool") {
|
||||
echo Bootstrap::formCheckbox(array(
|
||||
'name' => 'custom[' . $field . ']',
|
||||
'label' => (isset($options['label']) ? $options['label'] : ''),
|
||||
'placeholder' => (isset($options['placeholder']) ? $options['placeholder'] : ''),
|
||||
'checked' => $page->custom($field),
|
||||
'labelForCheckbox' => (isset($options['tip']) ? $options['tip'] : '')
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<div id="nav-seo" class="tab-pane fade" role="tabpanel" aria-labelledby="seo-tab">
|
||||
<?php
|
||||
// Friendly URL
|
||||
echo Bootstrap::formInputTextBlock(array(
|
||||
'name'=>'slug',
|
||||
'tip'=>$L->g('URL associated with the content'),
|
||||
'label'=>$L->g('Friendly URL'),
|
||||
'placeholder'=>$L->g('Leave empty for autocomplete by Bludit.'),
|
||||
'value'=>$page->slug()
|
||||
));
|
||||
// Friendly URL
|
||||
echo Bootstrap::formInputTextBlock(array(
|
||||
'name' => 'slug',
|
||||
'tip' => $L->g('URL associated with the content'),
|
||||
'label' => $L->g('Friendly URL'),
|
||||
'placeholder' => $L->g('Leave empty for autocomplete by Bludit.'),
|
||||
'value' => $page->slug()
|
||||
));
|
||||
|
||||
// Robots
|
||||
echo Bootstrap::formCheckbox(array(
|
||||
'name'=>'noindex',
|
||||
'label'=>'Robots',
|
||||
'labelForCheckbox'=>$L->g('apply-code-noindex-code-to-this-page'),
|
||||
'placeholder'=>'',
|
||||
'checked'=>$page->noindex(),
|
||||
'tip'=>$L->g('This tells search engines not to show this page in their search results.')
|
||||
));
|
||||
// Robots
|
||||
echo Bootstrap::formCheckbox(array(
|
||||
'name' => 'noindex',
|
||||
'label' => 'Robots',
|
||||
'labelForCheckbox' => $L->g('apply-code-noindex-code-to-this-page'),
|
||||
'placeholder' => '',
|
||||
'checked' => $page->noindex(),
|
||||
'tip' => $L->g('This tells search engines not to show this page in their search results.')
|
||||
));
|
||||
|
||||
// Robots
|
||||
echo Bootstrap::formCheckbox(array(
|
||||
'name'=>'nofollow',
|
||||
'label'=>'',
|
||||
'labelForCheckbox'=>$L->g('apply-code-nofollow-code-to-this-page'),
|
||||
'placeholder'=>'',
|
||||
'checked'=>$page->nofollow(),
|
||||
'tip'=>$L->g('This tells search engines not to follow links on this page.')
|
||||
));
|
||||
// Robots
|
||||
echo Bootstrap::formCheckbox(array(
|
||||
'name' => 'nofollow',
|
||||
'label' => '',
|
||||
'labelForCheckbox' => $L->g('apply-code-nofollow-code-to-this-page'),
|
||||
'placeholder' => '',
|
||||
'checked' => $page->nofollow(),
|
||||
'tip' => $L->g('This tells search engines not to follow links on this page.')
|
||||
));
|
||||
|
||||
// Robots
|
||||
echo Bootstrap::formCheckbox(array(
|
||||
'name'=>'noarchive',
|
||||
'label'=>'',
|
||||
'labelForCheckbox'=>$L->g('apply-code-noarchive-code-to-this-page'),
|
||||
'placeholder'=>'',
|
||||
'checked'=>$page->noarchive(),
|
||||
'tip'=>$L->g('This tells search engines not to save a cached copy of this page.')
|
||||
));
|
||||
// Robots
|
||||
echo Bootstrap::formCheckbox(array(
|
||||
'name' => 'noarchive',
|
||||
'label' => '',
|
||||
'labelForCheckbox' => $L->g('apply-code-noarchive-code-to-this-page'),
|
||||
'placeholder' => '',
|
||||
'checked' => $page->noarchive(),
|
||||
'tip' => $L->g('This tells search engines not to save a cached copy of this page.')
|
||||
));
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -365,38 +367,38 @@ echo Bootstrap::formOpen(array(
|
|||
|
||||
<!-- 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'
|
||||
$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'
|
||||
));
|
||||
}
|
||||
));
|
||||
} 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') ?>">
|
||||
<input id="jstitle" name="title" type="text" dir="auto" class="form-control form-control-lg rounded-0" value="<?php echo $page->title() ?>" placeholder="<?php $L->p('Enter title') ?>">
|
||||
</div>
|
||||
|
||||
<!-- Editor -->
|
||||
|
@ -404,33 +406,33 @@ echo Bootstrap::formOpen(array(
|
|||
|
||||
<!-- 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'
|
||||
$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'
|
||||
));
|
||||
}
|
||||
));
|
||||
} 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>
|
||||
|
@ -450,112 +452,112 @@ echo Bootstrap::formOpen(array(
|
|||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("#jsbuttonDeleteAccept").on("click", function() {
|
||||
$("#jstype").val("delete");
|
||||
$("#jscontent").val("");
|
||||
$("#jsform").submit();
|
||||
$(document).ready(function() {
|
||||
$("#jsbuttonDeleteAccept").on("click", function() {
|
||||
$("#jstype").val("delete");
|
||||
$("#jscontent").val("");
|
||||
$("#jsform").submit();
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<!-- Modal for Media Manager -->
|
||||
<?php include(PATH_ADMIN_THEMES.'booty/html/media.php'); ?>
|
||||
<?php include(PATH_ADMIN_THEMES . 'booty/html/media.php'); ?>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(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="">');
|
||||
};
|
||||
}
|
||||
if (typeof editorInsertLinkedMedia != "function") {
|
||||
window.editorInsertLinkedMedia = function(filename, link){
|
||||
$("#jseditor").val($('#jseditor').val()+'<a href="'+link+'"><img src="'+filename+'" alt=""></a>');
|
||||
};
|
||||
}
|
||||
|
||||
// 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");
|
||||
// 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="">');
|
||||
};
|
||||
}
|
||||
if (typeof editorInsertLinkedMedia != "function") {
|
||||
window.editorInsertLinkedMedia = function(filename, link) {
|
||||
$("#jseditor").val($('#jseditor').val() + '<a href="' + link + '"><img src="' + filename + '" alt=""></a>');
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// 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 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 Save
|
||||
$("#jsbuttonSave").on("click", function() {
|
||||
// If the switch is setted to "published", get the value from the selector
|
||||
if ($("#jsswitchButton").data("switch")=="publish") {
|
||||
var value = $("#jstypeSelector option:selected").val();
|
||||
$("#jstype").val(value);
|
||||
} else {
|
||||
// Button preview
|
||||
$("#jsbuttonPreview").on("click", function() {
|
||||
var uuid = $("#jsuuid").val();
|
||||
var title = $("#jstitle").val();
|
||||
var content = editorGetContent();
|
||||
var ajax = new bluditAjax();
|
||||
bluditAjax.saveAsDraft(uuid, title, content).then(function(data) {
|
||||
var preview = window.open("<?php echo DOMAIN_PAGES . 'autosave-' . $page->uuid() . '?preview=' . md5('autosave-' . $page->uuid()) ?>", "bludit-preview");
|
||||
preview.focus();
|
||||
});
|
||||
});
|
||||
|
||||
// Button Save
|
||||
$("#jsbuttonSave").on("click", function() {
|
||||
// If the switch is setted to "published", get the value from the selector
|
||||
if ($("#jsswitchButton").data("switch") == "publish") {
|
||||
var value = $("#jstypeSelector option:selected").val();
|
||||
$("#jstype").val(value);
|
||||
} else {
|
||||
$("#jstype").val("draft");
|
||||
}
|
||||
|
||||
// Get the content
|
||||
$("#jscontent").val(editorGetContent());
|
||||
|
||||
// Submit the form
|
||||
$("#jsform").submit();
|
||||
});
|
||||
|
||||
// Button Save as draft
|
||||
$("#jsbuttonDraft").on("click", function() {
|
||||
// Set the type as draft
|
||||
$("#jstype").val("draft");
|
||||
}
|
||||
|
||||
// Get the content
|
||||
$("#jscontent").val( editorGetContent() );
|
||||
// Get the content
|
||||
$("#jscontent").val(editorGetContent());
|
||||
|
||||
// Submit the form
|
||||
$("#jsform").submit();
|
||||
});
|
||||
// Submit the form
|
||||
$("#jsform").submit();
|
||||
});
|
||||
|
||||
// Button Save as draft
|
||||
$("#jsbuttonDraft").on("click", function() {
|
||||
// Set the type as draft
|
||||
$("#jstype").val("draft");
|
||||
|
||||
// Get the content
|
||||
$("#jscontent").val( editorGetContent() );
|
||||
|
||||
// Submit the form
|
||||
$("#jsform").submit();
|
||||
});
|
||||
|
||||
// Autosave
|
||||
var currentContent = editorGetContent();
|
||||
setInterval(function() {
|
||||
// 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) {
|
||||
if (content.length < 100) {
|
||||
return false;
|
||||
}
|
||||
// Autosave only when the user change the content
|
||||
if (currentContent!=content) {
|
||||
if (currentContent != content) {
|
||||
currentContent = content;
|
||||
bluditAjax.saveAsDraft(uuid, title, content).then(function(data) {
|
||||
if (data.status==0) {
|
||||
if (data.status == 0) {
|
||||
showAlert("<?php $L->p('Autosave') ?>");
|
||||
}
|
||||
});
|
||||
}
|
||||
},1000*60*AUTOSAVE_INTERVAL);
|
||||
}, 1000 * 60 * AUTOSAVE_INTERVAL);
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||
|
||||
<?php echo Bootstrap::formOpen(array('id'=>'jsform', 'class'=>'tab-content')); ?>
|
||||
<?php echo Bootstrap::formOpen(array('id' => 'jsform', 'class' => 'tab-content')); ?>
|
||||
|
||||
<div class="align-middle">
|
||||
<div class="float-right mt-1">
|
||||
<button type="submit" class="btn btn-primary btn-sm" name="save"><?php $L->p('Save') ?></button>
|
||||
<a class="btn btn-secondary btn-sm" href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>" role="button"><?php $L->p('Cancel') ?></a>
|
||||
<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')); ?>
|
||||
<?php echo Bootstrap::pageTitle(array('title' => $L->g('Edit user'), 'icon' => 'user')); ?>
|
||||
</div>
|
||||
|
||||
<!-- TABS -->
|
||||
|
@ -21,81 +21,81 @@
|
|||
</nav>
|
||||
|
||||
<?php
|
||||
// Token CSRF
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name'=>'tokenCSRF',
|
||||
'value'=>$security->getTokenCSRF()
|
||||
));
|
||||
// Token CSRF
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name' => 'tokenCSRF',
|
||||
'value' => $security->getTokenCSRF()
|
||||
));
|
||||
|
||||
// Username
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name'=>'username',
|
||||
'value'=>$user->username()
|
||||
));
|
||||
// Username
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name' => '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
|
||||
<?php
|
||||
// Display username but disable the field
|
||||
echo Bootstrap::formInputText(array(
|
||||
'name'=>'usernameDisabled',
|
||||
'label'=>$L->g('Username'),
|
||||
'value'=>$user->username(),
|
||||
'class'=>'',
|
||||
'placeholder'=>'',
|
||||
'disabled'=>true,
|
||||
'tip'=>''
|
||||
'name' => 'usernameDisabled',
|
||||
'label' => $L->g('Username'),
|
||||
'value' => $user->username(),
|
||||
'class' => '',
|
||||
'placeholder' => '',
|
||||
'disabled' => true,
|
||||
'tip' => ''
|
||||
));
|
||||
|
||||
if ($login->role()==='admin') {
|
||||
if ($login->role() === 'admin') {
|
||||
echo Bootstrap::formSelect(array(
|
||||
'name'=>'role',
|
||||
'label'=>$L->g('Role'),
|
||||
'options'=>array('author'=>$L->g('Author'), 'editor'=>$L->g('Editor'), 'admin'=>$L->g('Administrator')),
|
||||
'selected'=>$user->role(),
|
||||
'class'=>'',
|
||||
'tip'=>$L->g('author-can-write-and-edit-their-own-content')
|
||||
'name' => 'role',
|
||||
'label' => $L->g('Role'),
|
||||
'options' => array('author' => $L->g('Author'), 'editor' => $L->g('Editor'), 'admin' => $L->g('Administrator')),
|
||||
'selected' => $user->role(),
|
||||
'class' => '',
|
||||
'tip' => $L->g('author-can-write-and-edit-their-own-content')
|
||||
));
|
||||
}
|
||||
|
||||
echo Bootstrap::formInputText(array(
|
||||
'name'=>'email',
|
||||
'label'=>$L->g('Email'),
|
||||
'value'=>$user->email(),
|
||||
'class'=>'',
|
||||
'placeholder'=>'',
|
||||
'tip'=>''
|
||||
'name' => 'email',
|
||||
'label' => $L->g('Email'),
|
||||
'value' => $user->email(),
|
||||
'class' => '',
|
||||
'placeholder' => '',
|
||||
'tip' => ''
|
||||
));
|
||||
|
||||
echo Bootstrap::formInputText(array(
|
||||
'name'=>'nickname',
|
||||
'label'=>$L->g('Nickname'),
|
||||
'value'=>$user->nickname(),
|
||||
'class'=>'',
|
||||
'placeholder'=>'',
|
||||
'tip'=>$L->g('The nickname is almost used in the themes to display the author of the content')
|
||||
'name' => 'nickname',
|
||||
'label' => $L->g('Nickname'),
|
||||
'value' => $user->nickname(),
|
||||
'class' => '',
|
||||
'placeholder' => '',
|
||||
'tip' => $L->g('The nickname is almost used in the themes to display the author of the content')
|
||||
));
|
||||
|
||||
echo Bootstrap::formInputText(array(
|
||||
'name'=>'firstName',
|
||||
'label'=>$L->g('First Name'),
|
||||
'value'=>$user->firstName(),
|
||||
'class'=>'',
|
||||
'placeholder'=>'',
|
||||
'tip'=>''
|
||||
'name' => 'firstName',
|
||||
'label' => $L->g('First Name'),
|
||||
'value' => $user->firstName(),
|
||||
'class' => '',
|
||||
'placeholder' => '',
|
||||
'tip' => ''
|
||||
));
|
||||
|
||||
echo Bootstrap::formInputText(array(
|
||||
'name'=>'lastName',
|
||||
'label'=>$L->g('Last Name'),
|
||||
'value'=>$user->lastName(),
|
||||
'class'=>'',
|
||||
'placeholder'=>'',
|
||||
'tip'=>''
|
||||
'name' => 'lastName',
|
||||
'label' => $L->g('Last Name'),
|
||||
'value' => $user->lastName(),
|
||||
'class' => '',
|
||||
'placeholder' => '',
|
||||
'tip' => ''
|
||||
));
|
||||
?>
|
||||
?>
|
||||
</div>
|
||||
|
||||
<!-- Profile picture tab -->
|
||||
|
@ -110,71 +110,71 @@
|
|||
<!-- <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') ?>" />
|
||||
<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' ?>");
|
||||
// });
|
||||
// $("#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);
|
||||
}
|
||||
$("#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')));
|
||||
<?php
|
||||
echo Bootstrap::formTitle(array('title' => $L->g('Password')));
|
||||
|
||||
echo '
|
||||
<div class="form-group">
|
||||
<a href="'.HTML_PATH_ADMIN_ROOT.'user-password/'.$user->username().'" class="btn btn-primary mr-2">'.$L->g('Change password').'</a>
|
||||
<a href="' . HTML_PATH_ADMIN_ROOT . 'user-password/' . $user->username() . '" class="btn btn-primary mr-2">' . $L->g('Change password') . '</a>
|
||||
</div>
|
||||
';
|
||||
|
||||
echo Bootstrap::formTitle(array('title'=>$L->g('Authentication Token')));
|
||||
echo Bootstrap::formTitle(array('title' => $L->g('Authentication Token')));
|
||||
|
||||
echo Bootstrap::formInputText(array(
|
||||
'name'=>'tokenAuth',
|
||||
'label'=>$L->g('Token'),
|
||||
'value'=>$user->tokenAuth(),
|
||||
'class'=>'',
|
||||
'tip'=>$L->g('this-token-is-similar-to-a-password-it-should-not-be-shared')
|
||||
'name' => 'tokenAuth',
|
||||
'label' => $L->g('Token'),
|
||||
'value' => $user->tokenAuth(),
|
||||
'class' => '',
|
||||
'tip' => $L->g('this-token-is-similar-to-a-password-it-should-not-be-shared')
|
||||
));
|
||||
|
||||
if (checkRole(array('admin'),false)) {
|
||||
echo Bootstrap::formTitle(array('title'=>$L->g('Status')));
|
||||
if (checkRole(array('admin'), false)) {
|
||||
echo Bootstrap::formTitle(array('title' => $L->g('Status')));
|
||||
|
||||
echo Bootstrap::formInputText(array(
|
||||
'name'=>'status',
|
||||
'label'=>$L->g('Current status'),
|
||||
'value'=>$user->enabled()?$L->g('Enabled'):$L->g('Disabled'),
|
||||
'class'=>'',
|
||||
'disabled'=>true,
|
||||
'tip'=>$user->enabled()?'':$L->g('To enable the user you must set a new password')
|
||||
'name' => 'status',
|
||||
'label' => $L->g('Current status'),
|
||||
'value' => $user->enabled() ? $L->g('Enabled') : $L->g('Disabled'),
|
||||
'class' => '',
|
||||
'disabled' => true,
|
||||
'tip' => $user->enabled() ? '' : $L->g('To enable the user you must set a new password')
|
||||
));
|
||||
|
||||
if ($user->enabled()) {
|
||||
|
@ -182,110 +182,119 @@
|
|||
<div class="form-group row">
|
||||
<div class="col-sm-2"></div>
|
||||
<div class="col-sm-10">
|
||||
<button type="submit" class="btn btn-warning mr-2" id="jsdisableUser" name="disableUser">'.$L->g('Disable user').'</button>
|
||||
<button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndKeepContent" name="deleteUserAndKeepContent">'.$L->g('Delete user and keep content').'</button>
|
||||
<button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndDeleteContent" name="deleteUserAndDeleteContent">'.$L->g('Delete user and delete content').'</button>
|
||||
<button type="submit" class="btn btn-warning mr-2" id="jsdisableUser" name="disableUser">' . $L->g('Disable user') . '</button>
|
||||
<button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndKeepContent" name="deleteUserAndKeepContent">' . $L->g('Delete user and keep content') . '</button>
|
||||
<button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndDeleteContent" name="deleteUserAndDeleteContent">' . $L->g('Delete user and delete content') . '</button>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
</div>
|
||||
|
||||
<!-- Social Networks tab -->
|
||||
<div class="tab-pane fade" id="social" role="tabpanel" aria-labelledby="nav-social-tab">
|
||||
<?php
|
||||
<?php
|
||||
echo Bootstrap::formInputText(array(
|
||||
'name'=>'twitter',
|
||||
'label'=>'Twitter',
|
||||
'value'=>$user->twitter(),
|
||||
'class'=>'',
|
||||
'placeholder'=>'',
|
||||
'tip'=>''
|
||||
'name' => 'twitter',
|
||||
'label' => 'Twitter',
|
||||
'value' => $user->twitter(),
|
||||
'class' => '',
|
||||
'placeholder' => '',
|
||||
'tip' => ''
|
||||
));
|
||||
|
||||
echo Bootstrap::formInputText(array(
|
||||
'name'=>'facebook',
|
||||
'label'=>'Facebook',
|
||||
'value'=>$user->facebook(),
|
||||
'class'=>'',
|
||||
'placeholder'=>'',
|
||||
'tip'=>''
|
||||
'name' => 'facebook',
|
||||
'label' => 'Facebook',
|
||||
'value' => $user->facebook(),
|
||||
'class' => '',
|
||||
'placeholder' => '',
|
||||
'tip' => ''
|
||||
));
|
||||
|
||||
echo Bootstrap::formInputText(array(
|
||||
'name'=>'codepen',
|
||||
'label'=>'CodePen',
|
||||
'value'=>$user->codepen(),
|
||||
'class'=>'',
|
||||
'placeholder'=>'',
|
||||
'tip'=>''
|
||||
'name' => 'codepen',
|
||||
'label' => 'CodePen',
|
||||
'value' => $user->codepen(),
|
||||
'class' => '',
|
||||
'placeholder' => '',
|
||||
'tip' => ''
|
||||
));
|
||||
|
||||
echo Bootstrap::formInputText(array(
|
||||
'name'=>'instagram',
|
||||
'label'=>'Instagram',
|
||||
'value'=>$user->instagram(),
|
||||
'class'=>'',
|
||||
'placeholder'=>'',
|
||||
'tip'=>''
|
||||
'name' => 'instagram',
|
||||
'label' => 'Instagram',
|
||||
'value' => $user->instagram(),
|
||||
'class' => '',
|
||||
'placeholder' => '',
|
||||
'tip' => ''
|
||||
));
|
||||
|
||||
echo Bootstrap::formInputText(array(
|
||||
'name'=>'gitlab',
|
||||
'label'=>'GitLab',
|
||||
'value'=>$user->gitlab(),
|
||||
'class'=>'',
|
||||
'placeholder'=>'',
|
||||
'tip'=>''
|
||||
'name' => 'gitlab',
|
||||
'label' => 'GitLab',
|
||||
'value' => $user->gitlab(),
|
||||
'class' => '',
|
||||
'placeholder' => '',
|
||||
'tip' => ''
|
||||
));
|
||||
|
||||
echo Bootstrap::formInputText(array(
|
||||
'name'=>'github',
|
||||
'label'=>'GitHub',
|
||||
'value'=>$user->github(),
|
||||
'class'=>'',
|
||||
'placeholder'=>'',
|
||||
'tip'=>''
|
||||
'name' => 'github',
|
||||
'label' => 'GitHub',
|
||||
'value' => $user->github(),
|
||||
'class' => '',
|
||||
'placeholder' => '',
|
||||
'tip' => ''
|
||||
));
|
||||
|
||||
echo Bootstrap::formInputText(array(
|
||||
'name'=>'linkedin',
|
||||
'label'=>'LinkedIn',
|
||||
'value'=>$user->linkedin(),
|
||||
'class'=>'',
|
||||
'placeholder'=>'',
|
||||
'tip'=>''
|
||||
'name' => 'linkedin',
|
||||
'label' => 'LinkedIn',
|
||||
'value' => $user->linkedin(),
|
||||
'class' => '',
|
||||
'placeholder' => '',
|
||||
'tip' => ''
|
||||
));
|
||||
|
||||
echo Bootstrap::formInputText(array(
|
||||
'name'=>'xing',
|
||||
'label'=>'Xing',
|
||||
'value'=>$user->xing(),
|
||||
'class'=>'',
|
||||
'placeholder'=>'',
|
||||
'tip'=>''
|
||||
'name' => 'xing',
|
||||
'label' => 'Xing',
|
||||
'value' => $user->xing(),
|
||||
'class' => '',
|
||||
'placeholder' => '',
|
||||
'tip' => ''
|
||||
));
|
||||
|
||||
echo Bootstrap::formInputText(array(
|
||||
'name'=>'mastodon',
|
||||
'label'=>'Mastodon',
|
||||
'value'=>$user->mastodon(),
|
||||
'class'=>'',
|
||||
'placeholder'=>'',
|
||||
'tip'=>''
|
||||
'name' => 'telegram',
|
||||
'label' => 'Telegram',
|
||||
'value' => $user->telegram(),
|
||||
'class' => '',
|
||||
'placeholder' => '',
|
||||
'tip' => ''
|
||||
));
|
||||
|
||||
echo Bootstrap::formInputText(array(
|
||||
'name'=>'vk',
|
||||
'label'=>'VK',
|
||||
'value'=>$user->vk(),
|
||||
'class'=>'',
|
||||
'placeholder'=>'',
|
||||
'tip'=>''
|
||||
'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>
|
||||
|
||||
|
@ -304,4 +313,4 @@
|
|||
//window.localStorage.removeItem("activeTab");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
@ -1,39 +1,37 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
echo '<h1 class="text-center mb-5 mt-5 font-weight-normal" style="color: #555;">'.$site->title().'</h1>';
|
||||
echo '<h1 class="text-center mb-3 mt-3 font-weight-normal" style="color: #555;">' . $site->title() . '</h1>';
|
||||
|
||||
echo Bootstrap::formOpen(array());
|
||||
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name'=>'tokenCSRF',
|
||||
'value'=>$security->getTokenCSRF()
|
||||
));
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name' => 'tokenCSRF',
|
||||
'value' => $security->getTokenCSRF()
|
||||
));
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<div class="form-group">
|
||||
<input type="text" value="'.(isset($_POST['username'])?htmlspecialchars($_POST['username']):'').'" class="form-control form-control-lg" id="jsusername" name="username" placeholder="'.$L->g('Username').'" autofocus>
|
||||
<input type="text" dir="auto" value="' . (isset($_POST['username']) ? Sanitize::html($_POST['username']) : '') . '" class="form-control form-control-lg" id="jsusername" name="username" placeholder="' . $L->g('Username') . '" autofocus>
|
||||
</div>
|
||||
';
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<div class="form-group">
|
||||
<input type="password" class="form-control form-control-lg" id="jspassword" name="password" placeholder="'.$L->g('Password').'">
|
||||
<input type="password" class="form-control form-control-lg" id="jspassword" name="password" placeholder="' . $L->g('Password') . '">
|
||||
</div>
|
||||
';
|
||||
|
||||
echo '
|
||||
echo '
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" value="true" id="jsremember" name="remember">
|
||||
<label class="form-check-label" for="jsremember">'.$L->g('Remember me').'</label>
|
||||
<label class="form-check-label" for="jsremember">' . $L->g('Remember me') . '</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group mt-3">
|
||||
<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 btn-lg mr-2 w-100" name="save">' . $L->g('Login') . '</button>
|
||||
</div>
|
||||
';
|
||||
|
||||
echo '</form>';
|
||||
|
||||
echo '<p class="mt-5 text-right">'.$L->g('Powered by Bludit').'</p>'
|
||||
|
||||
?>
|
||||
echo '<p class="mt-3 text-right">' . $L->g('Powered by Bludit') . ((defined('BLUDIT_PRO')) ? ' PRO' : '') . '</p>';
|
||||
|
|
|
@ -4,40 +4,40 @@
|
|||
|
||||
// Start form
|
||||
echo Bootstrap::formOpen(array(
|
||||
'id'=>'jsform',
|
||||
'class'=>'d-flex flex-column h-100'
|
||||
'id' => 'jsform',
|
||||
'class' => 'd-flex flex-column h-100'
|
||||
));
|
||||
|
||||
// Token CSRF
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name'=>'tokenCSRF',
|
||||
'value'=>$security->getTokenCSRF()
|
||||
));
|
||||
// Token CSRF
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name' => 'tokenCSRF',
|
||||
'value' => $security->getTokenCSRF()
|
||||
));
|
||||
|
||||
// UUID
|
||||
// The UUID is generated in the controller
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name'=>'uuid',
|
||||
'value'=>$uuid
|
||||
));
|
||||
// UUID
|
||||
// The UUID is generated in the controller
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name' => 'uuid',
|
||||
'value' => $uuid
|
||||
));
|
||||
|
||||
// Type = published, draft, sticky, static
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name'=>'type',
|
||||
'value'=>'published'
|
||||
));
|
||||
// Type = published, draft, sticky, static
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name' => 'type',
|
||||
'value' => 'published'
|
||||
));
|
||||
|
||||
// Cover image
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name'=>'coverImage',
|
||||
'value'=>''
|
||||
));
|
||||
// Cover image
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name' => 'coverImage',
|
||||
'value' => ''
|
||||
));
|
||||
|
||||
// Content
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name'=>'content',
|
||||
'value'=>''
|
||||
));
|
||||
// Content
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name' => 'content',
|
||||
'value' => ''
|
||||
));
|
||||
?>
|
||||
|
||||
<!-- TOOLBAR -->
|
||||
|
@ -48,7 +48,7 @@ echo Bootstrap::formOpen(array(
|
|||
</div>
|
||||
|
||||
<div id="jseditorToolbarLeft">
|
||||
<button id="jsbuttonSave" type="button" class="btn btn-sm btn-primary" ><?php $L->p('Save') ?></button>
|
||||
<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>
|
||||
|
@ -71,10 +71,10 @@ echo Bootstrap::formOpen(array(
|
|||
<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 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 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>
|
||||
|
@ -83,26 +83,26 @@ echo Bootstrap::formOpen(array(
|
|||
<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()
|
||||
));
|
||||
// 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')
|
||||
));
|
||||
// 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 -->
|
||||
|
@ -126,218 +126,220 @@ echo Bootstrap::formOpen(array(
|
|||
|
||||
$("#jsbuttonRemoveCoverImage").on("click", function() {
|
||||
$("#jscoverImage").val('');
|
||||
$("#jscoverImagePreview").attr('src', HTML_PATH_CORE_IMG+'default.svg');
|
||||
$("#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')
|
||||
));
|
||||
// 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'=>''
|
||||
));
|
||||
// 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()
|
||||
));
|
||||
// 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')
|
||||
));
|
||||
// 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.'),
|
||||
));
|
||||
// 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
|
||||
$(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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
},
|
||||
escapeMarkup: function(markup) {
|
||||
return markup;
|
||||
},
|
||||
templateResult: function(data) {
|
||||
var html = data.text;
|
||||
if (data.type=="static") {
|
||||
html += '<span class="badge badge-pill badge-light">'+data.type+'</span>';
|
||||
}
|
||||
return html;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
// Template
|
||||
echo Bootstrap::formInputTextBlock(array(
|
||||
'name'=>'template',
|
||||
'label'=>$L->g('Template'),
|
||||
'placeholder'=>'',
|
||||
'value'=>'',
|
||||
'tip'=>$L->g('Write a template name to filter the page in the theme and change the style of the page.')
|
||||
));
|
||||
// Template
|
||||
echo Bootstrap::formInputTextBlock(array(
|
||||
'name' => 'template',
|
||||
'label' => $L->g('Template'),
|
||||
'placeholder' => '',
|
||||
'value' => '',
|
||||
'tip' => $L->g('Write a template name to filter the page in the theme and change the style of the page.')
|
||||
));
|
||||
|
||||
echo Bootstrap::formInputTextBlock(array(
|
||||
'name'=>'externalCoverImage',
|
||||
'label'=>$L->g('External cover image'),
|
||||
'placeholder'=>"https://",
|
||||
'value'=>'',
|
||||
'tip'=>$L->g('Set a cover image from external URL, such as a CDN or some server dedicated for images.')
|
||||
));
|
||||
echo Bootstrap::formInputTextBlock(array(
|
||||
'name' => 'externalCoverImage',
|
||||
'label' => $L->g('External cover image'),
|
||||
'placeholder' => "https://",
|
||||
'value' => '',
|
||||
'tip' => $L->g('Set a cover image from external URL, such as a CDN or some server dedicated for images.')
|
||||
));
|
||||
|
||||
// Username
|
||||
echo Bootstrap::formInputTextBlock(array(
|
||||
'name'=>'',
|
||||
'label'=>$L->g('Author'),
|
||||
'placeholder'=>'',
|
||||
'value'=>$login->username(),
|
||||
'tip'=>'',
|
||||
'disabled'=>true
|
||||
));
|
||||
// Username
|
||||
echo Bootstrap::formInputTextBlock(array(
|
||||
'name' => '',
|
||||
'label' => $L->g('Author'),
|
||||
'placeholder' => '',
|
||||
'value' => $login->username(),
|
||||
'tip' => '',
|
||||
'disabled' => true
|
||||
));
|
||||
?>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function() {
|
||||
|
||||
// Changes in External cover image input
|
||||
$("#jsexternalCoverImage").change(function() {
|
||||
$("#jscoverImage").val($(this).val());
|
||||
});
|
||||
|
||||
// Generate slug when the user type the title
|
||||
$("#jstitle").keyup(function() {
|
||||
var text = $(this).val();
|
||||
var parent = $("#jsparent").val();
|
||||
var currentKey = "";
|
||||
var ajax = new bluditAjax();
|
||||
var callBack = $("#jsslug");
|
||||
ajax.generateSlug(text, parent, currentKey, callBack);
|
||||
});
|
||||
|
||||
// Datepicker
|
||||
$("#jsdate").datetimepicker({
|
||||
format: DB_DATE_FORMAT
|
||||
});
|
||||
|
||||
|
||||
// Changes in External cover image input
|
||||
$("#jsexternalCoverImage").change(function() {
|
||||
$("#jscoverImage").val( $(this).val() );
|
||||
});
|
||||
|
||||
// Generate slug when the user type the title
|
||||
$("#jstitle").keyup(function() {
|
||||
var text = $(this).val();
|
||||
var parent = $("#jsparent").val();
|
||||
var currentKey = "";
|
||||
var ajax = new bluditAjax();
|
||||
var callBack = $("#jsslug");
|
||||
ajax.generateSlug(text, parent, currentKey, callBack);
|
||||
});
|
||||
|
||||
// Datepicker
|
||||
$("#jsdate").datetimepicker({format:DB_DATE_FORMAT});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<?php if (!empty($site->customFields())): ?>
|
||||
<div id="nav-custom" class="tab-pane fade" role="tabpanel" aria-labelledby="custom-tab">
|
||||
<?php
|
||||
$customFields = $site->customFields();
|
||||
foreach ($customFields as $field=>$options) {
|
||||
if ( !isset($options['position']) ) {
|
||||
if ($options['type']=="string") {
|
||||
echo Bootstrap::formInputTextBlock(array(
|
||||
'name'=>'custom['.$field.']',
|
||||
'label'=>(isset($options['label'])?$options['label']:''),
|
||||
'value'=>(isset($options['default'])?$options['default']:''),
|
||||
'tip'=>(isset($options['tip'])?$options['tip']:''),
|
||||
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:'')
|
||||
));
|
||||
} elseif ($options['type']=="bool") {
|
||||
echo Bootstrap::formCheckbox(array(
|
||||
'name'=>'custom['.$field.']',
|
||||
'label'=>(isset($options['label'])?$options['label']:''),
|
||||
'placeholder'=>(isset($options['placeholder'])?$options['placeholder']:''),
|
||||
'checked'=>(isset($options['checked'])?true:false),
|
||||
'labelForCheckbox'=>(isset($options['tip'])?$options['tip']:'')
|
||||
));
|
||||
<?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>
|
||||
?>
|
||||
</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.')
|
||||
));
|
||||
// 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' => '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' => '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.')
|
||||
));
|
||||
// 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>
|
||||
|
@ -345,39 +347,39 @@ echo Bootstrap::formOpen(array(
|
|||
|
||||
<!-- 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'
|
||||
$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'
|
||||
));
|
||||
}
|
||||
));
|
||||
} 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') ?>">
|
||||
<input id="jstitle" name="title" type="text" dir="auto" class="form-control form-control-lg rounded-0" value="" placeholder="<?php $L->p('Enter title') ?>">
|
||||
</div>
|
||||
|
||||
<!-- Editor -->
|
||||
|
@ -385,120 +387,125 @@ echo Bootstrap::formOpen(array(
|
|||
|
||||
<!-- 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'
|
||||
$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'
|
||||
));
|
||||
}
|
||||
));
|
||||
} 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'); ?>
|
||||
<?php include(PATH_ADMIN_THEMES . 'booty/html/media.php'); ?>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(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="">');
|
||||
};
|
||||
}
|
||||
if (typeof editorInsertLinkedMedia != "function") {
|
||||
window.editorInsertLinkedMedia = function(filename, link){
|
||||
$("#jseditor").val($('#jseditor').val()+'<a href="'+link+'"><img src="'+filename+'" alt=""></a>');
|
||||
};
|
||||
}
|
||||
|
||||
// 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");
|
||||
// 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="">');
|
||||
};
|
||||
}
|
||||
if (typeof editorInsertLinkedMedia != "function") {
|
||||
window.editorInsertLinkedMedia = function(filename, link) {
|
||||
$("#jseditor").val($('#jseditor').val() + '<a href="' + link + '"><img src="' + filename + '" alt=""></a>');
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Button preview
|
||||
$("#jsbuttonPreview").on("click", function() {
|
||||
var uuid = $("#jsuuid").val();
|
||||
var title = $("#jstitle").val();
|
||||
var content = editorGetContent();
|
||||
bluditAjax.saveAsDraft(uuid, title, content).then(function(data) {
|
||||
var preview = window.open("<?php echo DOMAIN_PAGES.'autosave-'.$uuid.'?preview='.md5('autosave-'.$uuid) ?>", "bludit-preview");
|
||||
preview.focus();
|
||||
// Button 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 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");
|
||||
}
|
||||
// Button preview
|
||||
$("#jsbuttonPreview").on("click", function() {
|
||||
var uuid = $("#jsuuid").val();
|
||||
var title = $("#jstitle").val();
|
||||
var content = editorGetContent();
|
||||
bluditAjax.saveAsDraft(uuid, title, content).then(function(data) {
|
||||
var preview = window.open("<?php echo DOMAIN_PAGES . 'autosave-' . $uuid . '?preview=' . md5('autosave-' . $uuid) ?>", "bludit-preview");
|
||||
preview.focus();
|
||||
});
|
||||
});
|
||||
|
||||
// Get the content
|
||||
$("#jscontent").val( editorGetContent() );
|
||||
// Button Save
|
||||
$("#jsbuttonSave").on("click", function() {
|
||||
let actionParameters = '';
|
||||
|
||||
// Submit the form
|
||||
$("#jsform").submit();
|
||||
});
|
||||
// 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);
|
||||
actionParameters = '#' + value;
|
||||
} else {
|
||||
$("#jstype").val("draft");
|
||||
actionParameters = '#draft';
|
||||
}
|
||||
|
||||
// Autosave
|
||||
var currentContent = editorGetContent();
|
||||
setInterval(function() {
|
||||
// Get the content
|
||||
$("#jscontent").val(editorGetContent());
|
||||
|
||||
// Submit the form
|
||||
$("#jsform").attr('action', actionParameters);
|
||||
$("#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) {
|
||||
if (content.length < 100) {
|
||||
return false;
|
||||
}
|
||||
// Autosave only when the user change the content
|
||||
if (currentContent!=content) {
|
||||
if (currentContent != content) {
|
||||
currentContent = content;
|
||||
bluditAjax.saveAsDraft(uuid, title, content).then(function(data) {
|
||||
if (data.status==0) {
|
||||
if (data.status == 0) {
|
||||
showAlert("<?php $L->p('Autosave') ?>");
|
||||
}
|
||||
});
|
||||
}
|
||||
},1000*60*AUTOSAVE_INTERVAL);
|
||||
}, 1000 * 60 * AUTOSAVE_INTERVAL);
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -1,39 +1,39 @@
|
|||
<?php
|
||||
|
||||
echo Bootstrap::pageTitle(array('title'=>$L->g('Plugins'), 'icon'=>'puzzle-piece'));
|
||||
echo Bootstrap::pageTitle(array('title' => $L->g('Plugins'), 'icon' => 'puzzle-piece'));
|
||||
|
||||
echo Bootstrap::link(array(
|
||||
'title'=>$L->g('Change the position of the plugins'),
|
||||
'href'=>HTML_PATH_ADMIN_ROOT.'plugins-position',
|
||||
'icon'=>'arrows'
|
||||
'title' => $L->g('Change the position of the plugins'),
|
||||
'href' => HTML_PATH_ADMIN_ROOT . 'plugins-position',
|
||||
'icon' => 'arrows'
|
||||
));
|
||||
|
||||
echo Bootstrap::formTitle(array('title'=>$L->g('Search plugins')));
|
||||
echo Bootstrap::formTitle(array('title' => $L->g('Search plugins')));
|
||||
|
||||
?>
|
||||
|
||||
<input type="text" class="form-control" id="search" placeholder="<?php $L->p('Search') ?>">
|
||||
<input type="text" dir="auto" 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();
|
||||
}
|
||||
$(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 Bootstrap::formTitle(array('title' => $L->g('Enabled plugins')));
|
||||
|
||||
echo '
|
||||
<table class="table">
|
||||
|
@ -42,28 +42,34 @@ echo '
|
|||
|
||||
// Show installed plugins
|
||||
foreach ($pluginsInstalled as $plugin) {
|
||||
echo '<tr id="'.$plugin->className().'" class="bg-light searchItem">';
|
||||
|
||||
if ($plugin->type() == 'theme') {
|
||||
// Do not display theme's plugins
|
||||
continue;
|
||||
}
|
||||
|
||||
echo '<tr id="' . $plugin->className() . '" class="bg-light searchItem">';
|
||||
|
||||
echo '<td class="align-middle pt-3 pb-3 w-25">
|
||||
<div class="searchText">'.$plugin->name().'</div>
|
||||
<div class="searchText">' . $plugin->name() . '</div>
|
||||
<div class="mt-1">';
|
||||
if (method_exists($plugin, 'form')) {
|
||||
echo '<a class="mr-3" href="'.HTML_PATH_ADMIN_ROOT.'configure-plugin/'.$plugin->className().'">'.$L->g('Settings').'</a>';
|
||||
}
|
||||
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'uninstall-plugin/'.$plugin->className().'">'.$L->g('Deactivate').'</a>';
|
||||
echo '</div>';
|
||||
if (method_exists($plugin, 'form')) {
|
||||
echo '<a class="mr-3" href="' . HTML_PATH_ADMIN_ROOT . 'configure-plugin/' . $plugin->className() . '">' . $L->g('Settings') . '</a>';
|
||||
}
|
||||
echo '<a href="' . HTML_PATH_ADMIN_ROOT . 'uninstall-plugin/' . $plugin->className() . '">' . $L->g('Deactivate') . '</a>';
|
||||
echo '</div>';
|
||||
echo '</td>';
|
||||
|
||||
echo '<td class="searchText align-middle d-none d-sm-table-cell">';
|
||||
echo $plugin->description();
|
||||
echo $plugin->description();
|
||||
echo '</td>';
|
||||
|
||||
echo '<td class="text-center align-middle d-none d-lg-table-cell">';
|
||||
echo '<span>'.$plugin->version().'</span>';
|
||||
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>
|
||||
<a target="_blank" href="' . $plugin->website() . '">' . $plugin->author() . '</a>
|
||||
</td>';
|
||||
|
||||
echo '</tr>';
|
||||
|
@ -74,7 +80,7 @@ echo '
|
|||
</table>
|
||||
';
|
||||
|
||||
echo Bootstrap::formTitle(array('title'=>$L->g('Disabled plugins')));
|
||||
echo Bootstrap::formTitle(array('title' => $L->g('Disabled plugins')));
|
||||
|
||||
echo '
|
||||
<table class="table">
|
||||
|
@ -84,25 +90,30 @@ echo '
|
|||
// Plugins not installed
|
||||
$pluginsNotInstalled = array_diff_key($plugins['all'], $pluginsInstalled);
|
||||
foreach ($pluginsNotInstalled as $plugin) {
|
||||
echo '<tr id="'.$plugin->className().'" class="searchItem">';
|
||||
|
||||
if ($plugin->type() == 'theme') {
|
||||
// Do not display theme's plugins
|
||||
continue;
|
||||
}
|
||||
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="searchText">' . $plugin->name() . '</div>
|
||||
<div class="mt-1">
|
||||
<a href="'.HTML_PATH_ADMIN_ROOT.'install-plugin/'.$plugin->className().'">'.$L->g('Activate').'</a>
|
||||
<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 class="text-center align-middle d-none d-lg-table-cell">';
|
||||
echo '<span>'.$plugin->version().'</span>';
|
||||
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>
|
||||
<a target="_blank" href="' . $plugin->website() . '">' . $plugin->author() . '</a>
|
||||
</td>';
|
||||
|
||||
echo '</tr>';
|
||||
|
@ -111,4 +122,4 @@ foreach ($pluginsNotInstalled as $plugin) {
|
|||
echo '
|
||||
</tbody>
|
||||
</table>
|
||||
';
|
||||
';
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,53 +1,57 @@
|
|||
<?php
|
||||
|
||||
echo Bootstrap::pageTitle(array('title'=>$L->g('Themes'), 'icon'=>'desktop'));
|
||||
echo Bootstrap::pageTitle(array('title' => $L->g('Themes'), 'icon' => 'desktop'));
|
||||
|
||||
echo '
|
||||
<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>
|
||||
<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>
|
||||
';
|
||||
|
||||
foreach ($themes as $theme) {
|
||||
echo '
|
||||
<tr '.($theme['dirname']==$site->theme()?'class="bg-light"':'').'>
|
||||
echo '
|
||||
<tr ' . ($theme['dirname'] == $site->theme() ? 'class="bg-light"' : '') . '>
|
||||
<td class="align-middle pt-3 pb-3">
|
||||
<div>'.$theme['name'].'</div>
|
||||
<div>'.$theme['name'].($theme['dirname']==$site->theme()?'<span class="badge badge-primary ml-2">'.$L->g('Active').'</span>':'').'</div>
|
||||
<div class="mt-1">
|
||||
';
|
||||
|
||||
if ($theme['dirname']!=$site->theme()) {
|
||||
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'install-theme/'.$theme['dirname'].'">'.$L->g('Activate').'</a>';
|
||||
}
|
||||
if ($theme['dirname'] != $site->theme()) {
|
||||
echo '<a href="' . HTML_PATH_ADMIN_ROOT . 'install-theme/' . $theme['dirname'] . '">' . $L->g('Activate') . '</a>';
|
||||
} else {
|
||||
if (isset($theme['plugin'])) {
|
||||
echo '<a href="' . HTML_PATH_ADMIN_ROOT . 'configure-plugin/' . $theme['plugin'] . '">' . $L->g('Settings') . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
echo '
|
||||
echo '
|
||||
</div>
|
||||
</td>
|
||||
';
|
||||
|
||||
echo '<td class="align-middle d-none d-sm-table-cell">';
|
||||
echo $theme['description'];
|
||||
echo '</td>';
|
||||
echo '<td class="align-middle d-none d-sm-table-cell">';
|
||||
echo $theme['description'];
|
||||
echo '</td>';
|
||||
|
||||
echo '<td class="text-center align-middle d-none d-lg-table-cell">';
|
||||
echo '<span>'.$theme['version'].'</span>';
|
||||
echo '</td>';
|
||||
echo '<td class="text-center align-middle d-none d-lg-table-cell">';
|
||||
echo '<span>' . $theme['version'] . '</span>';
|
||||
echo '</td>';
|
||||
|
||||
echo '<td class="text-center align-middle d-none d-lg-table-cell">
|
||||
<a target="_blank" href="'.$theme['website'].'">'.$theme['author'].'</a>
|
||||
echo '<td class="text-center align-middle d-none d-lg-table-cell">
|
||||
<a target="_blank" href="' . $theme['website'] . '">' . $theme['author'] . '</a>
|
||||
</td>';
|
||||
|
||||
echo '</tr>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</tbody>
|
||||
</table>
|
||||
';
|
||||
';
|
||||
|
|
|
@ -25,8 +25,8 @@ if ($uuid) {
|
|||
|
||||
// Set upload directory
|
||||
if ($uuid && IMAGE_RESTRICT) {
|
||||
$imageDirectory = PATH_UPLOADS_PAGES.$uuid.DS;
|
||||
$thumbnailDirectory = $imageDirectory.'thumbnails'.DS;
|
||||
$imageDirectory = PATH_UPLOADS_PAGES . $uuid . DS;
|
||||
$thumbnailDirectory = $imageDirectory . 'thumbnails' . DS;
|
||||
if (!Filesystem::directoryExists($thumbnailDirectory)) {
|
||||
Filesystem::mkdir($thumbnailDirectory, true);
|
||||
}
|
||||
|
@ -36,10 +36,10 @@ if ($uuid && IMAGE_RESTRICT) {
|
|||
}
|
||||
|
||||
$images = array();
|
||||
foreach ($_FILES['images']['name'] as $uuid=>$filename) {
|
||||
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');
|
||||
$message = $L->g('Maximum load file size allowed:') . ' ' . ini_get('upload_max_filesize');
|
||||
Log::set($message, LOG_TYPE_ERROR);
|
||||
ajaxResponse(1, $message);
|
||||
}
|
||||
|
@ -57,27 +57,27 @@ foreach ($_FILES['images']['name'] as $uuid=>$filename) {
|
|||
// 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']);
|
||||
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);
|
||||
}
|
||||
|
||||
// Check file MIME Type
|
||||
$fileMimeType = Filesystem::mimeType($_FILES['images']['tmp_name'][$uuid]);
|
||||
if ($fileMimeType!==false) {
|
||||
if ($fileMimeType !== false) {
|
||||
if (!in_array($fileMimeType, $GLOBALS['ALLOWED_IMG_MIMETYPES'])) {
|
||||
$message = $L->g('File mime type is not supported. Allowed types:').' '.implode(', ',$GLOBALS['ALLOWED_IMG_MIMETYPES']);
|
||||
$message = $L->g('File mime type is not supported. Allowed types:') . ' ' . implode(', ', $GLOBALS['ALLOWED_IMG_MIMETYPES']);
|
||||
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);
|
||||
Filesystem::mv($_FILES['images']['tmp_name'][$uuid], PATH_TMP . $filename);
|
||||
|
||||
// Transform the image and generate the thumbnail
|
||||
$image = transformImage(PATH_TMP.$filename, $imageDirectory, $thumbnailDirectory);
|
||||
$image = transformImage(PATH_TMP . $filename, $imageDirectory, $thumbnailDirectory);
|
||||
|
||||
if ($image) {
|
||||
chmod($image, 0644);
|
||||
|
@ -91,7 +91,5 @@ foreach ($_FILES['images']['name'] as $uuid=>$filename) {
|
|||
}
|
||||
|
||||
ajaxResponse(0, 'Images uploaded.', array(
|
||||
'images'=>$images
|
||||
'images' => $images
|
||||
));
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,68 +1,77 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// Bludit version
|
||||
define('BLUDIT_VERSION', '3.14.0');
|
||||
define('BLUDIT_CODENAME', 'Out Of Time');
|
||||
define('BLUDIT_RELEASE_DATE', '2022-08-05');
|
||||
define('BLUDIT_BUILD', '20220805');
|
||||
define('BLUDIT_VERSION', '3.16.2');
|
||||
define('BLUDIT_CODENAME', 'Valencia');
|
||||
define('BLUDIT_RELEASE_DATE', '2024-08-23');
|
||||
define('BLUDIT_BUILD', '20240806');
|
||||
|
||||
// Debug mode
|
||||
// Change to FALSE, for prevent warning or errors on browser
|
||||
// Change to TRUE for debugging
|
||||
define('DEBUG_MODE', TRUE);
|
||||
define('DEBUG_TYPE', 'INFO'); // INFO, TRACE
|
||||
error_reporting(0); // Turn off all error reporting
|
||||
|
||||
// This determines whether errors should be printed to the screen as part of the output or if they should be hidden from the user.
|
||||
ini_set("display_errors", 0);
|
||||
|
||||
// Even when display_errors is on, errors that occur during PHP's startup sequence are not displayed.
|
||||
// It's strongly recommended to keep display_startup_errors off, except for debugging.
|
||||
ini_set('display_startup_errors', 0);
|
||||
|
||||
// If disabled, error message will be solely plain text instead HTML code.
|
||||
ini_set("html_errors", 0);
|
||||
|
||||
// Tells whether script error messages should be logged to the server's error log or error_log.
|
||||
ini_set('log_errors', 1);
|
||||
|
||||
if (DEBUG_MODE) {
|
||||
// Turn on all error reporting
|
||||
ini_set("display_errors", 1);
|
||||
ini_set('display_startup_errors',1);
|
||||
ini_set("html_errors", 1);
|
||||
ini_set('log_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
|
||||
} else {
|
||||
error_reporting(E_ERROR);
|
||||
}
|
||||
|
||||
// PHP paths
|
||||
// PATH_ROOT and PATH_BOOT are defined in index.php
|
||||
define('PATH_LANGUAGES', PATH_ROOT.'bl-languages'.DS);
|
||||
define('PATH_THEMES', PATH_ROOT.'bl-themes'.DS);
|
||||
define('PATH_PLUGINS', PATH_ROOT.'bl-plugins'.DS);
|
||||
define('PATH_KERNEL', PATH_ROOT.'bl-kernel'.DS);
|
||||
define('PATH_CONTENT', PATH_ROOT.'bl-content'.DS);
|
||||
define('PATH_LANGUAGES', PATH_ROOT . 'bl-languages' . DS);
|
||||
define('PATH_THEMES', PATH_ROOT . 'bl-themes' . DS);
|
||||
define('PATH_PLUGINS', PATH_ROOT . 'bl-plugins' . DS);
|
||||
define('PATH_KERNEL', PATH_ROOT . 'bl-kernel' . DS);
|
||||
define('PATH_CONTENT', PATH_ROOT . 'bl-content' . DS);
|
||||
|
||||
define('PATH_ABSTRACT', PATH_KERNEL.'abstract'.DS);
|
||||
define('PATH_RULES', PATH_KERNEL.'boot'.DS.'rules'.DS);
|
||||
define('PATH_HELPERS', PATH_KERNEL.'helpers'.DS);
|
||||
define('PATH_AJAX', PATH_KERNEL.'ajax'.DS);
|
||||
define('PATH_CORE_JS', PATH_KERNEL.'js'.DS);
|
||||
define('PATH_ABSTRACT', PATH_KERNEL . 'abstract' . DS);
|
||||
define('PATH_RULES', PATH_KERNEL . 'boot' . DS . 'rules' . DS);
|
||||
define('PATH_HELPERS', PATH_KERNEL . 'helpers' . DS);
|
||||
define('PATH_AJAX', PATH_KERNEL . 'ajax' . DS);
|
||||
define('PATH_CORE_JS', PATH_KERNEL . 'js' . DS);
|
||||
|
||||
define('PATH_PAGES', PATH_CONTENT.'pages'.DS);
|
||||
define('PATH_DATABASES', PATH_CONTENT.'databases'.DS);
|
||||
define('PATH_PLUGINS_DATABASES', PATH_CONTENT.'databases'.DS.'plugins'.DS);
|
||||
define('PATH_TMP', PATH_CONTENT.'tmp'.DS);
|
||||
define('PATH_UPLOADS', PATH_CONTENT.'uploads'.DS);
|
||||
define('PATH_WORKSPACES', PATH_CONTENT.'workspaces'.DS);
|
||||
define('PATH_PAGES', PATH_CONTENT . 'pages' . DS);
|
||||
define('PATH_DATABASES', PATH_CONTENT . 'databases' . DS);
|
||||
define('PATH_PLUGINS_DATABASES', PATH_CONTENT . 'databases' . DS . 'plugins' . DS);
|
||||
define('PATH_TMP', PATH_CONTENT . 'tmp' . 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_THUMBNAILS', PATH_UPLOADS.'thumbnails'.DS);
|
||||
define('PATH_UPLOADS_PAGES', PATH_UPLOADS . 'pages' . DS);
|
||||
define('PATH_UPLOADS_PROFILES', PATH_UPLOADS . 'profiles' . DS);
|
||||
define('PATH_UPLOADS_THUMBNAILS', PATH_UPLOADS . 'thumbnails' . DS);
|
||||
|
||||
define('PATH_ADMIN', PATH_KERNEL.'admin'.DS);
|
||||
define('PATH_ADMIN_THEMES', PATH_ADMIN.'themes'.DS);
|
||||
define('PATH_ADMIN_CONTROLLERS', PATH_ADMIN.'controllers'.DS);
|
||||
define('PATH_ADMIN_VIEWS', PATH_ADMIN.'views'.DS);
|
||||
define('PATH_ADMIN', PATH_KERNEL . 'admin' . DS);
|
||||
define('PATH_ADMIN_THEMES', PATH_ADMIN . 'themes' . DS);
|
||||
define('PATH_ADMIN_CONTROLLERS', PATH_ADMIN . 'controllers' . DS);
|
||||
define('PATH_ADMIN_VIEWS', PATH_ADMIN . 'views' . DS);
|
||||
|
||||
define('DEBUG_FILE', PATH_CONTENT.'debug.txt');
|
||||
define('DEBUG_FILE', PATH_CONTENT . 'debug.txt');
|
||||
|
||||
// PAGES DATABASE
|
||||
define('DB_PAGES', PATH_DATABASES.'pages.php');
|
||||
define('DB_SITE', PATH_DATABASES.'site.php');
|
||||
define('DB_CATEGORIES', PATH_DATABASES.'categories.php');
|
||||
define('DB_TAGS', PATH_DATABASES.'tags.php');
|
||||
define('DB_SYSLOG', PATH_DATABASES.'syslog.php');
|
||||
define('DB_USERS', PATH_DATABASES.'users.php');
|
||||
define('DB_SECURITY', PATH_DATABASES.'security.php');
|
||||
define('DB_PAGES', PATH_DATABASES . 'pages.php');
|
||||
define('DB_SITE', PATH_DATABASES . 'site.php');
|
||||
define('DB_CATEGORIES', PATH_DATABASES . 'categories.php');
|
||||
define('DB_TAGS', PATH_DATABASES . 'tags.php');
|
||||
define('DB_SYSLOG', PATH_DATABASES . 'syslog.php');
|
||||
define('DB_USERS', PATH_DATABASES . 'users.php');
|
||||
define('DB_SECURITY', PATH_DATABASES . 'security.php');
|
||||
|
||||
// User environment variables
|
||||
include(PATH_KERNEL.'boot'.DS.'variables.php');
|
||||
include(PATH_KERNEL . 'boot' . DS . 'variables.php');
|
||||
|
||||
// Set internal character encoding
|
||||
mb_internal_encoding(CHARSET);
|
||||
|
@ -71,50 +80,50 @@ mb_internal_encoding(CHARSET);
|
|||
mb_http_output(CHARSET);
|
||||
|
||||
// Inclde Abstract Classes
|
||||
include(PATH_ABSTRACT.'dbjson.class.php');
|
||||
include(PATH_ABSTRACT.'dblist.class.php');
|
||||
include(PATH_ABSTRACT.'plugin.class.php');
|
||||
include(PATH_ABSTRACT . 'dbjson.class.php');
|
||||
include(PATH_ABSTRACT . 'dblist.class.php');
|
||||
include(PATH_ABSTRACT . 'plugin.class.php');
|
||||
|
||||
// Inclde Classes
|
||||
include(PATH_KERNEL.'pages.class.php');
|
||||
include(PATH_KERNEL.'users.class.php');
|
||||
include(PATH_KERNEL.'tags.class.php');
|
||||
include(PATH_KERNEL.'language.class.php');
|
||||
include(PATH_KERNEL.'site.class.php');
|
||||
include(PATH_KERNEL.'categories.class.php');
|
||||
include(PATH_KERNEL.'syslog.class.php');
|
||||
include(PATH_KERNEL.'pagex.class.php');
|
||||
include(PATH_KERNEL.'category.class.php');
|
||||
include(PATH_KERNEL.'tag.class.php');
|
||||
include(PATH_KERNEL.'user.class.php');
|
||||
include(PATH_KERNEL.'url.class.php');
|
||||
include(PATH_KERNEL.'login.class.php');
|
||||
include(PATH_KERNEL.'parsedown.class.php');
|
||||
include(PATH_KERNEL.'security.class.php');
|
||||
include(PATH_KERNEL . 'pages.class.php');
|
||||
include(PATH_KERNEL . 'users.class.php');
|
||||
include(PATH_KERNEL . 'tags.class.php');
|
||||
include(PATH_KERNEL . 'language.class.php');
|
||||
include(PATH_KERNEL . 'site.class.php');
|
||||
include(PATH_KERNEL . 'categories.class.php');
|
||||
include(PATH_KERNEL . 'syslog.class.php');
|
||||
include(PATH_KERNEL . 'pagex.class.php');
|
||||
include(PATH_KERNEL . 'category.class.php');
|
||||
include(PATH_KERNEL . 'tag.class.php');
|
||||
include(PATH_KERNEL . 'user.class.php');
|
||||
include(PATH_KERNEL . 'url.class.php');
|
||||
include(PATH_KERNEL . 'login.class.php');
|
||||
include(PATH_KERNEL . 'parsedown.class.php');
|
||||
include(PATH_KERNEL . 'security.class.php');
|
||||
|
||||
// Include functions
|
||||
include(PATH_KERNEL.'functions.php');
|
||||
include(PATH_KERNEL . 'functions.php');
|
||||
|
||||
// Include Helpers Classes
|
||||
include(PATH_HELPERS.'text.class.php');
|
||||
include(PATH_HELPERS.'log.class.php');
|
||||
include(PATH_HELPERS.'date.class.php');
|
||||
include(PATH_HELPERS.'theme.class.php');
|
||||
include(PATH_HELPERS.'session.class.php');
|
||||
include(PATH_HELPERS.'redirect.class.php');
|
||||
include(PATH_HELPERS.'sanitize.class.php');
|
||||
include(PATH_HELPERS.'valid.class.php');
|
||||
include(PATH_HELPERS.'email.class.php');
|
||||
include(PATH_HELPERS.'filesystem.class.php');
|
||||
include(PATH_HELPERS.'alert.class.php');
|
||||
include(PATH_HELPERS.'paginator.class.php');
|
||||
include(PATH_HELPERS.'image.class.php');
|
||||
include(PATH_HELPERS.'tcp.class.php');
|
||||
include(PATH_HELPERS.'dom.class.php');
|
||||
include(PATH_HELPERS.'cookie.class.php');
|
||||
include(PATH_HELPERS . 'text.class.php');
|
||||
include(PATH_HELPERS . 'log.class.php');
|
||||
include(PATH_HELPERS . 'date.class.php');
|
||||
include(PATH_HELPERS . 'theme.class.php');
|
||||
include(PATH_HELPERS . 'session.class.php');
|
||||
include(PATH_HELPERS . 'redirect.class.php');
|
||||
include(PATH_HELPERS . 'sanitize.class.php');
|
||||
include(PATH_HELPERS . 'valid.class.php');
|
||||
include(PATH_HELPERS . 'email.class.php');
|
||||
include(PATH_HELPERS . 'filesystem.class.php');
|
||||
include(PATH_HELPERS . 'alert.class.php');
|
||||
include(PATH_HELPERS . 'paginator.class.php');
|
||||
include(PATH_HELPERS . 'image.class.php');
|
||||
include(PATH_HELPERS . 'tcp.class.php');
|
||||
include(PATH_HELPERS . 'dom.class.php');
|
||||
include(PATH_HELPERS . 'cookie.class.php');
|
||||
|
||||
if (file_exists(PATH_KERNEL.'bludit.pro.php')) {
|
||||
include(PATH_KERNEL.'bludit.pro.php');
|
||||
if (file_exists(PATH_KERNEL . 'bludit.pro.php')) {
|
||||
include(PATH_KERNEL . 'bludit.pro.php');
|
||||
}
|
||||
|
||||
// Objects
|
||||
|
@ -139,43 +148,43 @@ if (!empty($_SERVER['DOCUMENT_ROOT']) && !empty($_SERVER['SCRIPT_NAME']) && empt
|
|||
$base = str_replace($_SERVER['DOCUMENT_ROOT'], '', $_SERVER['SCRIPT_NAME']);
|
||||
$base = dirname($base);
|
||||
} elseif (empty($base)) {
|
||||
$base = empty( $_SERVER['SCRIPT_NAME'] ) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
|
||||
$base = empty($_SERVER['SCRIPT_NAME']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
|
||||
$base = dirname($base);
|
||||
}
|
||||
|
||||
if (strpos($_SERVER['REQUEST_URI'], $base)!==0) {
|
||||
if (strpos($_SERVER['REQUEST_URI'], $base) !== 0) {
|
||||
$base = '/';
|
||||
} elseif ($base!=DS) {
|
||||
} elseif ($base != DS) {
|
||||
$base = trim($base, '/');
|
||||
$base = '/'.$base.'/';
|
||||
$base = '/' . $base . '/';
|
||||
} else {
|
||||
// Workaround for Windows Web Servers
|
||||
$base = '/';
|
||||
}
|
||||
|
||||
define('HTML_PATH_ROOT', $base);
|
||||
define('HTML_PATH_THEMES', HTML_PATH_ROOT.'bl-themes/');
|
||||
define('HTML_PATH_THEME', HTML_PATH_THEMES.$site->theme().'/');
|
||||
define('HTML_PATH_THEME_CSS', HTML_PATH_THEME.'css/');
|
||||
define('HTML_PATH_THEME_JS', HTML_PATH_THEME.'js/');
|
||||
define('HTML_PATH_THEME_IMG', HTML_PATH_THEME.'img/');
|
||||
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_JS', HTML_PATH_ADMIN_THEME.'js/');
|
||||
define('HTML_PATH_ADMIN_THEME_CSS', HTML_PATH_ADMIN_THEME.'css/');
|
||||
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_IMG', HTML_PATH_ROOT.'bl-kernel/img/');
|
||||
define('HTML_PATH_CONTENT', HTML_PATH_ROOT.'bl-content/');
|
||||
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_THUMBNAILS', HTML_PATH_UPLOADS.'thumbnails/');
|
||||
define('HTML_PATH_PLUGINS', HTML_PATH_ROOT.'bl-plugins/');
|
||||
define('HTML_PATH_THEMES', HTML_PATH_ROOT . 'bl-themes/');
|
||||
define('HTML_PATH_THEME', HTML_PATH_THEMES . $site->theme() . '/');
|
||||
define('HTML_PATH_THEME_CSS', HTML_PATH_THEME . 'css/');
|
||||
define('HTML_PATH_THEME_JS', HTML_PATH_THEME . 'js/');
|
||||
define('HTML_PATH_THEME_IMG', HTML_PATH_THEME . 'img/');
|
||||
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_JS', HTML_PATH_ADMIN_THEME . 'js/');
|
||||
define('HTML_PATH_ADMIN_THEME_CSS', HTML_PATH_ADMIN_THEME . 'css/');
|
||||
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_IMG', HTML_PATH_ROOT . 'bl-kernel/img/');
|
||||
define('HTML_PATH_CONTENT', HTML_PATH_ROOT . 'bl-content/');
|
||||
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_THUMBNAILS', HTML_PATH_UPLOADS . 'thumbnails/');
|
||||
define('HTML_PATH_PLUGINS', HTML_PATH_ROOT . 'bl-plugins/');
|
||||
|
||||
// --- Objects with dependency ---
|
||||
$language = new Language( $site->language() );
|
||||
$url->checkFilters( $site->uriFilters() );
|
||||
$language = new Language($site->language());
|
||||
$url->checkFilters($site->uriFilters());
|
||||
|
||||
// --- CONSTANTS with dependency ---
|
||||
|
||||
|
@ -208,38 +217,38 @@ define('MARKDOWN_PARSER', $site->markdownParser());
|
|||
|
||||
// --- PHP paths with dependency ---
|
||||
// This paths are absolutes for the OS
|
||||
define('THEME_DIR', PATH_ROOT.'bl-themes'.DS.$site->theme().DS);
|
||||
define('THEME_DIR_PHP', THEME_DIR.'php'.DS);
|
||||
define('THEME_DIR_CSS', THEME_DIR.'css'.DS);
|
||||
define('THEME_DIR_JS', THEME_DIR.'js'.DS);
|
||||
define('THEME_DIR_IMG', THEME_DIR.'img'.DS);
|
||||
define('THEME_DIR_LANG', THEME_DIR.'languages'.DS);
|
||||
define('THEME_DIR', PATH_ROOT . 'bl-themes' . DS . $site->theme() . DS);
|
||||
define('THEME_DIR_PHP', THEME_DIR . 'php' . DS);
|
||||
define('THEME_DIR_CSS', THEME_DIR . 'css' . DS);
|
||||
define('THEME_DIR_JS', THEME_DIR . 'js' . DS);
|
||||
define('THEME_DIR_IMG', THEME_DIR . 'img' . DS);
|
||||
define('THEME_DIR_LANG', THEME_DIR . 'languages' . DS);
|
||||
|
||||
// --- Absolute paths with domain ---
|
||||
// This paths are absolutes for the user / web browsing.
|
||||
define('DOMAIN', $site->domain());
|
||||
define('DOMAIN_BASE', DOMAIN.HTML_PATH_ROOT);
|
||||
define('DOMAIN_CORE_JS', DOMAIN.HTML_PATH_CORE_JS);
|
||||
define('DOMAIN_CORE_CSS', DOMAIN.HTML_PATH_CORE_CSS);
|
||||
define('DOMAIN_THEME', DOMAIN.HTML_PATH_THEME);
|
||||
define('DOMAIN_THEME_CSS', DOMAIN.HTML_PATH_THEME_CSS);
|
||||
define('DOMAIN_THEME_JS', DOMAIN.HTML_PATH_THEME_JS);
|
||||
define('DOMAIN_THEME_IMG', DOMAIN.HTML_PATH_THEME_IMG);
|
||||
define('DOMAIN_ADMIN_THEME', DOMAIN.HTML_PATH_ADMIN_THEME);
|
||||
define('DOMAIN_ADMIN_THEME_CSS', DOMAIN.HTML_PATH_ADMIN_THEME_CSS);
|
||||
define('DOMAIN_ADMIN_THEME_JS', DOMAIN.HTML_PATH_ADMIN_THEME_JS);
|
||||
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_THUMBNAILS', DOMAIN.HTML_PATH_UPLOADS_THUMBNAILS);
|
||||
define('DOMAIN_PLUGINS', DOMAIN.HTML_PATH_PLUGINS);
|
||||
define('DOMAIN_CONTENT', DOMAIN.HTML_PATH_CONTENT);
|
||||
define('DOMAIN_BASE', DOMAIN . HTML_PATH_ROOT);
|
||||
define('DOMAIN_CORE_JS', DOMAIN . HTML_PATH_CORE_JS);
|
||||
define('DOMAIN_CORE_CSS', DOMAIN . HTML_PATH_CORE_CSS);
|
||||
define('DOMAIN_THEME', DOMAIN . HTML_PATH_THEME);
|
||||
define('DOMAIN_THEME_CSS', DOMAIN . HTML_PATH_THEME_CSS);
|
||||
define('DOMAIN_THEME_JS', DOMAIN . HTML_PATH_THEME_JS);
|
||||
define('DOMAIN_THEME_IMG', DOMAIN . HTML_PATH_THEME_IMG);
|
||||
define('DOMAIN_ADMIN_THEME', DOMAIN . HTML_PATH_ADMIN_THEME);
|
||||
define('DOMAIN_ADMIN_THEME_CSS', DOMAIN . HTML_PATH_ADMIN_THEME_CSS);
|
||||
define('DOMAIN_ADMIN_THEME_JS', DOMAIN . HTML_PATH_ADMIN_THEME_JS);
|
||||
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_THUMBNAILS', DOMAIN . HTML_PATH_UPLOADS_THUMBNAILS);
|
||||
define('DOMAIN_PLUGINS', DOMAIN . HTML_PATH_PLUGINS);
|
||||
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_CATEGORIES', Text::addSlashes(DOMAIN_BASE.CATEGORY_URI_FILTER, false, true));
|
||||
define('DOMAIN_PAGES', Text::addSlashes(DOMAIN_BASE.PAGE_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_PAGES', Text::addSlashes(DOMAIN_BASE . PAGE_URI_FILTER, false, true));
|
||||
|
||||
$ADMIN_CONTROLLER = '';
|
||||
$ADMIN_VIEW = '';
|
||||
|
|
|
@ -121,7 +121,7 @@ function buildPlugins()
|
|||
|
||||
// Sort the plugins by the position for the site sidebar
|
||||
uasort($plugins['siteSidebar'], function ($a, $b) {
|
||||
return $a->position() <=> $b->position();
|
||||
return $a->position()>$b->position();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// ============================================================================
|
||||
// Variables
|
||||
// ============================================================================
|
||||
$themePlugin = getPlugin($site->theme()); // Returns plugin object or False
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
|
@ -15,20 +16,18 @@ function buildThemes()
|
|||
$themes = array();
|
||||
$themesPaths = Filesystem::listDirectories(PATH_THEMES);
|
||||
|
||||
foreach($themesPaths as $themePath)
|
||||
{
|
||||
foreach ($themesPaths as $themePath) {
|
||||
// Check if the theme is translated.
|
||||
$languageFilename = $themePath.DS.'languages'.DS.$site->language().'.json';
|
||||
if( !Sanitize::pathFile($languageFilename) ) {
|
||||
$languageFilename = $themePath.DS.'languages'.DS.DEFAULT_LANGUAGE_FILE;
|
||||
$languageFilename = $themePath . DS . 'languages' . DS . $site->language() . '.json';
|
||||
if (!Sanitize::pathFile($languageFilename)) {
|
||||
$languageFilename = $themePath . DS . 'languages' . DS . DEFAULT_LANGUAGE_FILE;
|
||||
}
|
||||
|
||||
if( Sanitize::pathFile($languageFilename) )
|
||||
{
|
||||
if (Sanitize::pathFile($languageFilename)) {
|
||||
$database = file_get_contents($languageFilename);
|
||||
$database = json_decode($database, true);
|
||||
if(empty($database)) {
|
||||
Log::set('99.themes.php'.LOG_SEP.'Language file error on theme '.$themePath);
|
||||
if (empty($database)) {
|
||||
Log::set('99.themes.php' . LOG_SEP . 'Language file error on theme ' . $themePath);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -37,20 +36,19 @@ function buildThemes()
|
|||
$database['dirname'] = basename($themePath);
|
||||
|
||||
// --- Metadata ---
|
||||
$filenameMetadata = $themePath.DS.'metadata.json';
|
||||
$filenameMetadata = $themePath . DS . 'metadata.json';
|
||||
|
||||
if( Sanitize::pathFile($filenameMetadata) )
|
||||
{
|
||||
if (Sanitize::pathFile($filenameMetadata)) {
|
||||
$metadataString = file_get_contents($filenameMetadata);
|
||||
$metadata = json_decode($metadataString, true);
|
||||
|
||||
$database['compatible'] = false;
|
||||
if( !empty($metadata['compatible']) ) {
|
||||
if (!empty($metadata['compatible'])) {
|
||||
$bluditRoot = explode('.', BLUDIT_VERSION);
|
||||
$compatible = explode(',', $metadata['compatible']);
|
||||
foreach( $compatible as $version ) {
|
||||
foreach ($compatible as $version) {
|
||||
$root = explode('.', $version);
|
||||
if( $root[0]==$bluditRoot[0] && $root[1]==$bluditRoot[1] ) {
|
||||
if ($root[0] == $bluditRoot[0] && $root[1] == $bluditRoot[1]) {
|
||||
$database['compatible'] = true;
|
||||
}
|
||||
}
|
||||
|
@ -70,13 +68,12 @@ function buildThemes()
|
|||
// ============================================================================
|
||||
|
||||
// Load the language file
|
||||
$languageFilename = THEME_DIR.'languages'.DS.$site->language().'.json';
|
||||
if( !Sanitize::pathFile($languageFilename) ) {
|
||||
$languageFilename = THEME_DIR.'languages'.DS.DEFAULT_LANGUAGE_FILE;
|
||||
$languageFilename = THEME_DIR . 'languages' . DS . $site->language() . '.json';
|
||||
if (!Sanitize::pathFile($languageFilename)) {
|
||||
$languageFilename = THEME_DIR . 'languages' . DS . DEFAULT_LANGUAGE_FILE;
|
||||
}
|
||||
|
||||
if( Sanitize::pathFile($languageFilename) )
|
||||
{
|
||||
if (Sanitize::pathFile($languageFilename)) {
|
||||
$database = file_get_contents($languageFilename);
|
||||
$database = json_decode($database, true);
|
||||
|
||||
|
@ -84,7 +81,7 @@ if( Sanitize::pathFile($languageFilename) )
|
|||
unset($database['theme-data']);
|
||||
|
||||
// Load words from the theme language
|
||||
if(!empty($database)) {
|
||||
if (!empty($database)) {
|
||||
$L->add($database);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
1345
bl-kernel/css/bootstrap-icons/bootstrap-icons.css
vendored
Normal file
1345
bl-kernel/css/bootstrap-icons/bootstrap-icons.css
vendored
Normal file
File diff suppressed because it is too large
Load diff
1327
bl-kernel/css/bootstrap-icons/bootstrap-icons.json
Normal file
1327
bl-kernel/css/bootstrap-icons/bootstrap-icons.json
Normal file
File diff suppressed because it is too large
Load diff
BIN
bl-kernel/css/bootstrap-icons/fonts/bootstrap-icons.woff
Normal file
BIN
bl-kernel/css/bootstrap-icons/fonts/bootstrap-icons.woff
Normal file
Binary file not shown.
BIN
bl-kernel/css/bootstrap-icons/fonts/bootstrap-icons.woff2
Normal file
BIN
bl-kernel/css/bootstrap-icons/fonts/bootstrap-icons.woff2
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load diff
|
@ -1,21 +1,23 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
class Filesystem {
|
||||
class Filesystem
|
||||
{
|
||||
|
||||
// Returns an array with the absolutes directories.
|
||||
public static function listDirectories($path, $regex='*', $sortByDate=false)
|
||||
public static function listDirectories($path, $regex = '*', $sortByDate = false)
|
||||
{
|
||||
$directories = glob($path.$regex, GLOB_ONLYDIR);
|
||||
$directories = glob($path . $regex, GLOB_ONLYDIR);
|
||||
|
||||
if(empty($directories)) {
|
||||
if (empty($directories)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
if($sortByDate) {
|
||||
usort($directories,
|
||||
function($a, $b) {
|
||||
return filemtime($b) - filemtime($a);
|
||||
}
|
||||
if ($sortByDate) {
|
||||
usort(
|
||||
$directories,
|
||||
function ($a, $b) {
|
||||
return filemtime($b) - filemtime($a);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -25,18 +27,19 @@ class Filesystem {
|
|||
// Returns an array with the list of files with the absolute path
|
||||
// $sortByDate = TRUE, the first file is the newer file
|
||||
// $chunk = amount of chunks, FALSE if you don't want to chunk
|
||||
public static function listFiles($path, $regex='*', $extension='*', $sortByDate=false, $chunk=false)
|
||||
public static function listFiles($path, $regex = '*', $extension = '*', $sortByDate = false, $chunk = false)
|
||||
{
|
||||
error_log($path.$regex.'.'.$extension);
|
||||
$files = glob($path.$regex.'.'.$extension);
|
||||
error_log($path . $regex . '.' . $extension);
|
||||
$files = glob($path . $regex . '.' . $extension);
|
||||
|
||||
if (empty($files)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
if ($sortByDate) {
|
||||
usort($files,
|
||||
function($a, $b) {
|
||||
usort(
|
||||
$files,
|
||||
function ($a, $b) {
|
||||
return filemtime($b) - filemtime($a);
|
||||
}
|
||||
);
|
||||
|
@ -51,26 +54,27 @@ class Filesystem {
|
|||
return $files;
|
||||
}
|
||||
|
||||
public static function mkdir($pathname, $recursive=false)
|
||||
public static function mkdir($pathname, $recursive = false)
|
||||
{
|
||||
Log::set('mkdir ' . $pathname . ' recursive = ' . $recursive, LOG_TYPE_INFO);
|
||||
return mkdir($pathname, DIR_PERMISSIONS, $recursive);
|
||||
}
|
||||
|
||||
public static function rmdir($pathname)
|
||||
{
|
||||
Log::set('rmdir = '.$pathname, LOG_TYPE_INFO);
|
||||
Log::set('rmdir = ' . $pathname, LOG_TYPE_INFO);
|
||||
return rmdir($pathname);
|
||||
}
|
||||
|
||||
public static function mv($oldname, $newname)
|
||||
{
|
||||
Log::set('mv '.$oldname.' '.$newname, LOG_TYPE_INFO);
|
||||
Log::set('mv ' . $oldname . ' ' . $newname, LOG_TYPE_INFO);
|
||||
return rename($oldname, $newname);
|
||||
}
|
||||
|
||||
public static function rmfile($filename)
|
||||
{
|
||||
Log::set('rmfile = '.$filename, LOG_TYPE_INFO);
|
||||
Log::set('rmfile = ' . $filename, LOG_TYPE_INFO);
|
||||
return unlink($filename);
|
||||
}
|
||||
|
||||
|
@ -88,7 +92,7 @@ class Filesystem {
|
|||
// If the destination directory not exists is created
|
||||
// $source = /home/diego/example or /home/diego/example/
|
||||
// $destination = /home/diego/newplace or /home/diego/newplace/
|
||||
public static function copyRecursive($source, $destination, $skipDirectory=false)
|
||||
public static function copyRecursive($source, $destination, $skipDirectory = false)
|
||||
{
|
||||
$source = rtrim($source, DS);
|
||||
$destination = rtrim($destination, DS);
|
||||
|
@ -107,15 +111,16 @@ class Filesystem {
|
|||
}
|
||||
|
||||
foreach ($iterator = new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS),
|
||||
RecursiveIteratorIterator::SELF_FIRST) as $item) {
|
||||
new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS),
|
||||
RecursiveIteratorIterator::SELF_FIRST
|
||||
) as $item) {
|
||||
|
||||
$currentDirectory = dirname($item->getPathName());
|
||||
if ($skipDirectory !== $currentDirectory) {
|
||||
if ($item->isDir()) {
|
||||
@mkdir($destination.DS.$iterator->getSubPathName());
|
||||
@mkdir($destination . DS . $iterator->getSubPathName());
|
||||
} else {
|
||||
copy($item, $destination.DS.$iterator->getSubPathName());
|
||||
copy($item, $destination . DS . $iterator->getSubPathName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -125,9 +130,9 @@ class Filesystem {
|
|||
|
||||
// Delete a file or directory recursive
|
||||
// The directory is delete
|
||||
public static function deleteRecursive($source, $deleteDirectory=true)
|
||||
public static function deleteRecursive($source, $deleteDirectory = true)
|
||||
{
|
||||
Log::set('deleteRecursive = '.$source, LOG_TYPE_INFO);
|
||||
Log::set('deleteRecursive = ' . $source, LOG_TYPE_INFO);
|
||||
|
||||
if (!self::directoryExists($source)) {
|
||||
return false;
|
||||
|
@ -135,12 +140,13 @@ class Filesystem {
|
|||
|
||||
foreach (new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator($source, FilesystemIterator::SKIP_DOTS),
|
||||
RecursiveIteratorIterator::CHILD_FIRST) as $item) {
|
||||
if ($item->isFile() || $item->isLink()) {
|
||||
unlink($item);
|
||||
} else {
|
||||
rmdir($item);
|
||||
}
|
||||
RecursiveIteratorIterator::CHILD_FIRST
|
||||
) as $item) {
|
||||
if ($item->isFile() || $item->isLink()) {
|
||||
unlink($item);
|
||||
} else {
|
||||
rmdir($item);
|
||||
}
|
||||
}
|
||||
|
||||
if ($deleteDirectory) {
|
||||
|
@ -210,14 +216,15 @@ class Filesystem {
|
|||
}
|
||||
|
||||
/*
|
||||
| Returns the next filename if the filename already exist otherwise returns the original filename
|
||||
|
|
||||
| @path string Path
|
||||
| @filename string Filename
|
||||
|
|
||||
| @return string
|
||||
*/
|
||||
public static function nextFilename($filename, $path=PATH_UPLOADS) {
|
||||
| Returns the next filename if the filename already exist otherwise returns the original filename
|
||||
|
|
||||
| @path string Path
|
||||
| @filename string Filename
|
||||
|
|
||||
| @return string
|
||||
*/
|
||||
public static function nextFilename($filename, $path = PATH_UPLOADS)
|
||||
{
|
||||
// Clean filename and get extension
|
||||
$fileExtension = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
$fileExtension = Text::lowercase($fileExtension);
|
||||
|
@ -226,43 +233,45 @@ class Filesystem {
|
|||
$filename = Text::removeQuotes($filename);
|
||||
|
||||
// Search for the next filename
|
||||
$tmpName = $filename.'.'.$fileExtension;
|
||||
if (Sanitize::pathFile($path.$tmpName)) {
|
||||
$tmpName = $filename . '.' . $fileExtension;
|
||||
if (Sanitize::pathFile($path . $tmpName)) {
|
||||
$number = 0;
|
||||
$tmpName = $filename.'_'.$number.'.'.$fileExtension;
|
||||
while (Sanitize::pathFile($path.$tmpName)) {
|
||||
$tmpName = $filename . '_' . $number . '.' . $fileExtension;
|
||||
while (Sanitize::pathFile($path . $tmpName)) {
|
||||
$number = $number + 1;
|
||||
$tmpName = $filename.'_'.$number.'.'.$fileExtension;
|
||||
$tmpName = $filename . '_' . $number . '.' . $fileExtension;
|
||||
}
|
||||
}
|
||||
return $tmpName;
|
||||
}
|
||||
|
||||
/*
|
||||
| Returns the filename
|
||||
| Example:
|
||||
| @file /home/diego/dog.jpg
|
||||
| @return dog.jpg
|
||||
|
|
||||
| @file string Full path of the file
|
||||
|
|
||||
| @return string
|
||||
*/
|
||||
public static function filename($file) {
|
||||
| Returns the filename
|
||||
| Example:
|
||||
| @file /home/diego/dog.jpg
|
||||
| @return dog.jpg
|
||||
|
|
||||
| @file string Full path of the file
|
||||
|
|
||||
| @return string
|
||||
*/
|
||||
public static function filename($file)
|
||||
{
|
||||
return basename($file);
|
||||
}
|
||||
|
||||
/*
|
||||
| Returns the file extension
|
||||
| Example:
|
||||
| @file /home/diego/dog.jpg
|
||||
| @return jpg
|
||||
|
|
||||
| @file string Full path of the file
|
||||
|
|
||||
| @return string
|
||||
*/
|
||||
public static function extension($file) {
|
||||
| Returns the file extension
|
||||
| Example:
|
||||
| @file /home/diego/dog.jpg
|
||||
| @return jpg
|
||||
|
|
||||
| @file string Full path of the file
|
||||
|
|
||||
| @return string
|
||||
*/
|
||||
public static function extension($file)
|
||||
{
|
||||
return pathinfo($file, PATHINFO_EXTENSION);
|
||||
}
|
||||
|
||||
|
@ -271,43 +280,46 @@ class Filesystem {
|
|||
* @param [string] $fileOrDirectory
|
||||
* @return [int|bool] [bytes or false on error]
|
||||
*/
|
||||
public static function getSize($fileOrDirectory) {
|
||||
public static function getSize($fileOrDirectory)
|
||||
{
|
||||
// Files
|
||||
if (is_file($fileOrDirectory)) {
|
||||
return filesize($fileOrDirectory);
|
||||
}
|
||||
// Directories
|
||||
if (file_exists($fileOrDirectory)) {
|
||||
$size = 0;
|
||||
foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($fileOrDirectory, FilesystemIterator::SKIP_DOTS)) as $file){
|
||||
$size = 0;
|
||||
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($fileOrDirectory, FilesystemIterator::SKIP_DOTS)) as $file) {
|
||||
try {
|
||||
$size += $file->getSize();
|
||||
} catch (Exception $e) {
|
||||
// SplFileInfo::getSize RuntimeException will be thrown on broken symlinks/errors
|
||||
}
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function bytesToHumanFileSize($bytes, $decimals = 2) {
|
||||
$size = array('B','kB','MB','GB','TB','PB','EB','ZB','YB');
|
||||
$factor = floor((strlen($bytes) - 1) / 3);
|
||||
return sprintf("%.{$decimals}f ", $bytes / pow(1024, $factor)) . @$size[$factor];
|
||||
public static function bytesToHumanFileSize($bytes, $decimals = 2)
|
||||
{
|
||||
$size = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
|
||||
$factor = floor((strlen($bytes) - 1) / 3);
|
||||
return sprintf("%.{$decimals}f ", $bytes / pow(1024, $factor)) . @$size[$factor];
|
||||
}
|
||||
|
||||
/*
|
||||
| Returns the mime type of the file
|
||||
| Example:
|
||||
| @file /home/diego/dog.jpg
|
||||
| @return image/jpeg
|
||||
|
|
||||
| @file [string] Full path of the file
|
||||
|
|
||||
| @return [string|bool] Mime type as string or FALSE if not possible to get the mime type
|
||||
*/
|
||||
public static function mimeType($file) {
|
||||
| Returns the mime type of the file
|
||||
| Example:
|
||||
| @file /home/diego/dog.jpg
|
||||
| @return image/jpeg
|
||||
|
|
||||
| @file [string] Full path of the file
|
||||
|
|
||||
| @return [string|bool] Mime type as string or FALSE if not possible to get the mime type
|
||||
*/
|
||||
public static function mimeType($file)
|
||||
{
|
||||
if (function_exists('mime_content_type')) {
|
||||
return mime_content_type($file);
|
||||
}
|
||||
|
@ -322,4 +334,13 @@ class Filesystem {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static function symlink($from, $to)
|
||||
{
|
||||
if (function_exists('symlink')) {
|
||||
Log::set('symlink from = ' . $from . ' to = ' . $to, LOG_TYPE_INFO);
|
||||
return symlink($from, $to);
|
||||
} else {
|
||||
return copy($from, $to);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,236 +2,245 @@
|
|||
|
||||
class Image {
|
||||
|
||||
private $image;
|
||||
private $width;
|
||||
private $height;
|
||||
private $imageResized;
|
||||
private $image;
|
||||
private $width;
|
||||
private $height;
|
||||
private $imageResized;
|
||||
|
||||
public function setImage($fileName, $newWidth, $newHeight, $option="auto")
|
||||
{
|
||||
// *** Open up the file
|
||||
$this->image = $this->openImage($fileName);
|
||||
public function setImage($fileName, $newWidth, $newHeight, $option="auto")
|
||||
{
|
||||
// *** Open up the file
|
||||
$this->image = $this->openImage($fileName);
|
||||
|
||||
// *** Get width and height
|
||||
$this->width = imagesx($this->image);
|
||||
$this->height = imagesy($this->image);
|
||||
// *** Get width and height
|
||||
$this->width = imagesx($this->image);
|
||||
$this->height = imagesy($this->image);
|
||||
|
||||
$this->resizeImage($newWidth, $newHeight, $option);
|
||||
}
|
||||
$this->resizeImage($newWidth, $newHeight, $option);
|
||||
}
|
||||
|
||||
public function saveImage($savePath, $imageQuality="100", $forceJPG=false, $forcePNG=false)
|
||||
{
|
||||
$extension = strtolower(pathinfo($savePath, PATHINFO_EXTENSION));
|
||||
public function saveImage($savePath, $imageQuality="100", $forceJPG=false, $forcePNG=false)
|
||||
{
|
||||
$extension = strtolower(pathinfo($savePath, PATHINFO_EXTENSION));
|
||||
|
||||
// Remove the extension
|
||||
$filename = substr($savePath, 0,strrpos($savePath,'.'));
|
||||
// Remove the extension
|
||||
$filename = substr($savePath, 0,strrpos($savePath,'.'));
|
||||
|
||||
$path_complete = $filename.'.'.$extension;
|
||||
$path_complete = $filename.'.'.$extension;
|
||||
|
||||
if ($forcePNG) {
|
||||
$extension = 'png';
|
||||
} elseif ($forceJPG) {
|
||||
$extension = 'jpg';
|
||||
}
|
||||
if ($forcePNG) {
|
||||
$extension = 'png';
|
||||
} elseif ($forceJPG) {
|
||||
$extension = 'jpg';
|
||||
}
|
||||
|
||||
switch ($extension) {
|
||||
case 'jpg':
|
||||
case 'jpeg':
|
||||
// Checking for JPG support
|
||||
if (imagetypes() & IMG_JPG) {
|
||||
imagejpeg($this->imageResized, $path_complete, $imageQuality);
|
||||
}
|
||||
break;
|
||||
switch ($extension) {
|
||||
case 'jpg':
|
||||
case 'jpeg':
|
||||
// Checking for JPG support
|
||||
if (imagetypes() & IMG_JPG) {
|
||||
imagejpeg($this->imageResized, $path_complete, $imageQuality);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'gif':
|
||||
// Checking for GIF support
|
||||
if (imagetypes() & IMG_GIF) {
|
||||
imagegif($this->imageResized, $path_complete);
|
||||
}
|
||||
break;
|
||||
case 'gif':
|
||||
// Checking for GIF support
|
||||
if (imagetypes() & IMG_GIF) {
|
||||
imagegif($this->imageResized, $path_complete);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'png':
|
||||
// *** Scale quality from 0-100 to 0-9
|
||||
$scaleQuality = round(($imageQuality/100) * 9);
|
||||
case 'png':
|
||||
// *** Scale quality from 0-100 to 0-9
|
||||
$scaleQuality = round(($imageQuality/100) * 9);
|
||||
|
||||
// *** Invert quality setting as 0 is best, not 9
|
||||
$invertScaleQuality = 9 - $scaleQuality;
|
||||
// *** Invert quality setting as 0 is best, not 9
|
||||
$invertScaleQuality = 9 - $scaleQuality;
|
||||
|
||||
// Checking for PNG support
|
||||
if (imagetypes() & IMG_PNG) {
|
||||
imagepng($this->imageResized, $path_complete, $invertScaleQuality);
|
||||
}
|
||||
break;
|
||||
// Checking for PNG support
|
||||
if (imagetypes() & IMG_PNG) {
|
||||
imagepng($this->imageResized, $path_complete, $invertScaleQuality);
|
||||
}
|
||||
break;
|
||||
case 'webp':
|
||||
// Checking for JPG support
|
||||
if (imagetypes() & IMG_WEBP) {
|
||||
imagewebp($this->imageResized, $path_complete, $imageQuality);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Fail extension detection
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// Fail extension detection
|
||||
break;
|
||||
}
|
||||
|
||||
imagedestroy($this->imageResized);
|
||||
}
|
||||
imagedestroy($this->imageResized);
|
||||
}
|
||||
|
||||
private function openImage($file)
|
||||
{
|
||||
// *** Get extension
|
||||
$extension = strtolower(strrchr($file, '.'));
|
||||
private function openImage($file)
|
||||
{
|
||||
// *** Get extension
|
||||
$extension = strtolower(strrchr($file, '.'));
|
||||
|
||||
switch($extension)
|
||||
{
|
||||
case '.jpg':
|
||||
case '.jpeg':
|
||||
$img = imagecreatefromjpeg($file);
|
||||
break;
|
||||
case '.gif':
|
||||
$img = imagecreatefromgif($file);
|
||||
break;
|
||||
case '.png':
|
||||
$img = imagecreatefrompng($file);
|
||||
break;
|
||||
default:
|
||||
$img = false;
|
||||
break;
|
||||
}
|
||||
return $img;
|
||||
}
|
||||
switch($extension)
|
||||
{
|
||||
case '.jpg':
|
||||
case '.jpeg':
|
||||
$img = imagecreatefromjpeg($file);
|
||||
break;
|
||||
case '.gif':
|
||||
$img = imagecreatefromgif($file);
|
||||
break;
|
||||
case '.png':
|
||||
$img = imagecreatefrompng($file);
|
||||
break;
|
||||
case '.webp':
|
||||
$img = imagecreatefromwebp($file);
|
||||
break;
|
||||
default:
|
||||
$img = false;
|
||||
break;
|
||||
}
|
||||
return $img;
|
||||
}
|
||||
|
||||
private function resizeImage($newWidth, $newHeight, $option)
|
||||
{
|
||||
// *** Get optimal width and height - based on $option
|
||||
$optionArray = $this->getDimensions($newWidth, $newHeight, $option);
|
||||
private function resizeImage($newWidth, $newHeight, $option)
|
||||
{
|
||||
// *** Get optimal width and height - based on $option
|
||||
$optionArray = $this->getDimensions($newWidth, $newHeight, $option);
|
||||
|
||||
$optimalWidth = $optionArray['optimalWidth'];
|
||||
$optimalHeight = $optionArray['optimalHeight'];
|
||||
$optimalWidth = $optionArray['optimalWidth'];
|
||||
$optimalHeight = $optionArray['optimalHeight'];
|
||||
|
||||
|
||||
// *** Resample - create image canvas of x, y size
|
||||
$this->imageResized = imagecreatetruecolor($optimalWidth, $optimalHeight);
|
||||
imagealphablending($this->imageResized, false);
|
||||
imagesavealpha($this->imageResized, true);
|
||||
imagecopyresampled($this->imageResized, $this->image, 0, 0, 0, 0, $optimalWidth, $optimalHeight, $this->width, $this->height);
|
||||
// *** Resample - create image canvas of x, y size
|
||||
$this->imageResized = imagecreatetruecolor($optimalWidth, $optimalHeight);
|
||||
imagealphablending($this->imageResized, false);
|
||||
imagesavealpha($this->imageResized, true);
|
||||
imagecopyresampled($this->imageResized, $this->image, 0, 0, 0, 0, $optimalWidth, $optimalHeight, $this->width, $this->height);
|
||||
|
||||
|
||||
// *** if option is 'crop', then crop too
|
||||
if ($option == 'crop') {
|
||||
$this->crop($optimalWidth, $optimalHeight, $newWidth, $newHeight);
|
||||
}
|
||||
}
|
||||
// *** if option is 'crop', then crop too
|
||||
if ($option == 'crop') {
|
||||
$this->crop($optimalWidth, $optimalHeight, $newWidth, $newHeight);
|
||||
}
|
||||
}
|
||||
|
||||
private function getDimensions($newWidth, $newHeight, $option)
|
||||
{
|
||||
private function getDimensions($newWidth, $newHeight, $option)
|
||||
{
|
||||
|
||||
if( ($this->width < $newWidth) and ($this->height < $newHeight) )
|
||||
{
|
||||
return array('optimalWidth' => $this->width, 'optimalHeight' => $this->height);
|
||||
}
|
||||
if( ($this->width < $newWidth) and ($this->height < $newHeight) )
|
||||
{
|
||||
return array('optimalWidth' => $this->width, 'optimalHeight' => $this->height);
|
||||
}
|
||||
|
||||
switch ($option)
|
||||
{
|
||||
case 'exact':
|
||||
$optimalWidth = $newWidth;
|
||||
$optimalHeight= $newHeight;
|
||||
break;
|
||||
case 'portrait':
|
||||
$optimalWidth = $this->getSizeByFixedHeight($newHeight);
|
||||
$optimalHeight= $newHeight;
|
||||
break;
|
||||
case 'landscape':
|
||||
$optimalWidth = $newWidth;
|
||||
$optimalHeight= $this->getSizeByFixedWidth($newWidth);
|
||||
break;
|
||||
case 'auto':
|
||||
$optionArray = $this->getSizeByAuto($newWidth, $newHeight);
|
||||
$optimalWidth = $optionArray['optimalWidth'];
|
||||
$optimalHeight = $optionArray['optimalHeight'];
|
||||
break;
|
||||
case 'crop':
|
||||
$optionArray = $this->getOptimalCrop($newWidth, $newHeight);
|
||||
$optimalWidth = $optionArray['optimalWidth'];
|
||||
$optimalHeight = $optionArray['optimalHeight'];
|
||||
break;
|
||||
}
|
||||
switch ($option)
|
||||
{
|
||||
case 'exact':
|
||||
$optimalWidth = $newWidth;
|
||||
$optimalHeight= $newHeight;
|
||||
break;
|
||||
case 'portrait':
|
||||
$optimalWidth = $this->getSizeByFixedHeight($newHeight);
|
||||
$optimalHeight= $newHeight;
|
||||
break;
|
||||
case 'landscape':
|
||||
$optimalWidth = $newWidth;
|
||||
$optimalHeight= $this->getSizeByFixedWidth($newWidth);
|
||||
break;
|
||||
case 'auto':
|
||||
$optionArray = $this->getSizeByAuto($newWidth, $newHeight);
|
||||
$optimalWidth = $optionArray['optimalWidth'];
|
||||
$optimalHeight = $optionArray['optimalHeight'];
|
||||
break;
|
||||
case 'crop':
|
||||
$optionArray = $this->getOptimalCrop($newWidth, $newHeight);
|
||||
$optimalWidth = $optionArray['optimalWidth'];
|
||||
$optimalHeight = $optionArray['optimalHeight'];
|
||||
break;
|
||||
}
|
||||
|
||||
return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
|
||||
}
|
||||
return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
|
||||
}
|
||||
|
||||
private function getSizeByFixedHeight($newHeight)
|
||||
{
|
||||
$ratio = $this->width / $this->height;
|
||||
$newWidth = $newHeight * $ratio;
|
||||
return $newWidth;
|
||||
}
|
||||
private function getSizeByFixedHeight($newHeight)
|
||||
{
|
||||
$ratio = $this->width / $this->height;
|
||||
$newWidth = $newHeight * $ratio;
|
||||
return $newWidth;
|
||||
}
|
||||
|
||||
private function getSizeByFixedWidth($newWidth)
|
||||
{
|
||||
$ratio = $this->height / $this->width;
|
||||
$newHeight = $newWidth * $ratio;
|
||||
return $newHeight;
|
||||
}
|
||||
private function getSizeByFixedWidth($newWidth)
|
||||
{
|
||||
$ratio = $this->height / $this->width;
|
||||
$newHeight = $newWidth * $ratio;
|
||||
return $newHeight;
|
||||
}
|
||||
|
||||
private function getSizeByAuto($newWidth, $newHeight)
|
||||
{
|
||||
if ($this->height < $this->width)
|
||||
// *** Image to be resized is wider (landscape)
|
||||
{
|
||||
$optimalWidth = $newWidth;
|
||||
$optimalHeight= $this->getSizeByFixedWidth($newWidth);
|
||||
}
|
||||
elseif ($this->height > $this->width)
|
||||
// *** Image to be resized is taller (portrait)
|
||||
{
|
||||
$optimalWidth = $this->getSizeByFixedHeight($newHeight);
|
||||
$optimalHeight= $newHeight;
|
||||
}
|
||||
else
|
||||
// *** Image to be resizerd is a square
|
||||
{
|
||||
if ($newHeight < $newWidth) {
|
||||
$optimalWidth = $newWidth;
|
||||
$optimalHeight= $this->getSizeByFixedWidth($newWidth);
|
||||
} else if ($newHeight > $newWidth) {
|
||||
$optimalWidth = $this->getSizeByFixedHeight($newHeight);
|
||||
$optimalHeight= $newHeight;
|
||||
} else {
|
||||
// *** Sqaure being resized to a square
|
||||
$optimalWidth = $newWidth;
|
||||
$optimalHeight= $newHeight;
|
||||
}
|
||||
}
|
||||
private function getSizeByAuto($newWidth, $newHeight)
|
||||
{
|
||||
if ($this->height < $this->width)
|
||||
// *** Image to be resized is wider (landscape)
|
||||
{
|
||||
$optimalWidth = $newWidth;
|
||||
$optimalHeight= $this->getSizeByFixedWidth($newWidth);
|
||||
}
|
||||
elseif ($this->height > $this->width)
|
||||
// *** Image to be resized is taller (portrait)
|
||||
{
|
||||
$optimalWidth = $this->getSizeByFixedHeight($newHeight);
|
||||
$optimalHeight= $newHeight;
|
||||
}
|
||||
else
|
||||
// *** Image to be resizerd is a square
|
||||
{
|
||||
if ($newHeight < $newWidth) {
|
||||
$optimalWidth = $newWidth;
|
||||
$optimalHeight= $this->getSizeByFixedWidth($newWidth);
|
||||
} else if ($newHeight > $newWidth) {
|
||||
$optimalWidth = $this->getSizeByFixedHeight($newHeight);
|
||||
$optimalHeight= $newHeight;
|
||||
} else {
|
||||
// *** Sqaure being resized to a square
|
||||
$optimalWidth = $newWidth;
|
||||
$optimalHeight= $newHeight;
|
||||
}
|
||||
}
|
||||
|
||||
return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
|
||||
}
|
||||
return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
|
||||
}
|
||||
|
||||
private function getOptimalCrop($newWidth, $newHeight)
|
||||
{
|
||||
private function getOptimalCrop($newWidth, $newHeight)
|
||||
{
|
||||
|
||||
$heightRatio = $this->height / $newHeight;
|
||||
$widthRatio = $this->width / $newWidth;
|
||||
$heightRatio = $this->height / $newHeight;
|
||||
$widthRatio = $this->width / $newWidth;
|
||||
|
||||
if ($heightRatio < $widthRatio) {
|
||||
$optimalRatio = $heightRatio;
|
||||
} else {
|
||||
$optimalRatio = $widthRatio;
|
||||
}
|
||||
if ($heightRatio < $widthRatio) {
|
||||
$optimalRatio = $heightRatio;
|
||||
} else {
|
||||
$optimalRatio = $widthRatio;
|
||||
}
|
||||
|
||||
$optimalHeight = $this->height / $optimalRatio;
|
||||
$optimalWidth = $this->width / $optimalRatio;
|
||||
$optimalHeight = $this->height / $optimalRatio;
|
||||
$optimalWidth = $this->width / $optimalRatio;
|
||||
|
||||
return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
|
||||
}
|
||||
return array('optimalWidth' => $optimalWidth, 'optimalHeight' => $optimalHeight);
|
||||
}
|
||||
|
||||
private function crop($optimalWidth, $optimalHeight, $newWidth, $newHeight)
|
||||
{
|
||||
// *** Find center - this will be used for the crop
|
||||
$cropStartX = ( $optimalWidth / 2) - ( $newWidth /2 );
|
||||
$cropStartY = ( $optimalHeight/ 2) - ( $newHeight/2 );
|
||||
private function crop($optimalWidth, $optimalHeight, $newWidth, $newHeight)
|
||||
{
|
||||
// *** Find center - this will be used for the crop
|
||||
$cropStartX = ( $optimalWidth / 2) - ( $newWidth /2 );
|
||||
$cropStartY = ( $optimalHeight/ 2) - ( $newHeight/2 );
|
||||
|
||||
$crop = $this->imageResized;
|
||||
//imagedestroy($this->imageResized);
|
||||
$crop = $this->imageResized;
|
||||
//imagedestroy($this->imageResized);
|
||||
|
||||
// *** Now crop from center to exact requested size
|
||||
$this->imageResized = imagecreatetruecolor($newWidth , $newHeight);
|
||||
imagealphablending($this->imageResized, false);
|
||||
imagesavealpha($this->imageResized, true);
|
||||
imagecopyresampled($this->imageResized, $crop , 0, 0, $cropStartX, $cropStartY, $newWidth, $newHeight , $newWidth, $newHeight);
|
||||
}
|
||||
// *** Now crop from center to exact requested size
|
||||
$this->imageResized = imagecreatetruecolor($newWidth , $newHeight);
|
||||
imagealphablending($this->imageResized, false);
|
||||
imagesavealpha($this->imageResized, true);
|
||||
imagecopyresampled($this->imageResized, $crop , 0, 0, $cropStartX, $cropStartY, $newWidth, $newHeight , $newWidth, $newHeight);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +1,27 @@
|
|||
<?php
|
||||
|
||||
class Theme {
|
||||
class Theme
|
||||
{
|
||||
|
||||
public static function socialNetworks()
|
||||
{
|
||||
global $site;
|
||||
$socialNetworks = array(
|
||||
'github'=>'Github',
|
||||
'gitlab'=>'GitLab',
|
||||
'twitter'=>'Twitter',
|
||||
'facebook'=>'Facebook',
|
||||
'instagram'=>'Instagram',
|
||||
'codepen'=>'Codepen',
|
||||
'linkedin'=>'Linkedin',
|
||||
'xing'=>'Xing',
|
||||
'mastodon'=>'Mastodon',
|
||||
'vk'=>'VK'
|
||||
'github' => 'Github',
|
||||
'gitlab' => 'GitLab',
|
||||
'twitter' => 'Twitter',
|
||||
'facebook' => 'Facebook',
|
||||
'instagram' => 'Instagram',
|
||||
'codepen' => 'Codepen',
|
||||
'linkedin' => 'Linkedin',
|
||||
'xing' => 'Xing',
|
||||
'telegram' => 'Telegram',
|
||||
'mastodon' => 'Mastodon',
|
||||
'vk' => 'VK',
|
||||
'dribbble' => 'Dribbble'
|
||||
);
|
||||
|
||||
foreach ($socialNetworks as $key=>$label) {
|
||||
foreach ($socialNetworks as $key => $label) {
|
||||
if (!$site->{$key}()) {
|
||||
unset($socialNetworks[$key]);
|
||||
}
|
||||
|
@ -59,7 +62,7 @@ class Theme {
|
|||
public static function rssUrl()
|
||||
{
|
||||
if (pluginActivated('pluginRSS')) {
|
||||
return DOMAIN_BASE.'rss.xml';
|
||||
return DOMAIN_BASE . 'rss.xml';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -67,7 +70,7 @@ class Theme {
|
|||
public static function sitemapUrl()
|
||||
{
|
||||
if (pluginActivated('pluginSitemap')) {
|
||||
return DOMAIN_BASE.'sitemap.xml';
|
||||
return DOMAIN_BASE . 'sitemap.xml';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -90,9 +93,9 @@ class Theme {
|
|||
|
||||
public static function metaTags($tag)
|
||||
{
|
||||
if ($tag=='title') {
|
||||
if ($tag == 'title') {
|
||||
return self::metaTagTitle();
|
||||
} elseif ($tag=='description') {
|
||||
} elseif ($tag == 'description') {
|
||||
return self::metaTagDescription();
|
||||
}
|
||||
}
|
||||
|
@ -106,11 +109,11 @@ class Theme {
|
|||
global $WHERE_AM_I;
|
||||
global $page;
|
||||
|
||||
if ($WHERE_AM_I=='page') {
|
||||
if ($WHERE_AM_I == 'page') {
|
||||
$format = $site->titleFormatPages();
|
||||
$format = Text::replace('{{page-title}}', $page->title(), $format);
|
||||
$format = Text::replace('{{page-description}}', $page->description(), $format);
|
||||
} elseif ($WHERE_AM_I=='tag') {
|
||||
} elseif ($WHERE_AM_I == 'tag') {
|
||||
try {
|
||||
$tagKey = $url->slug();
|
||||
$tag = new Tag($tagKey);
|
||||
|
@ -119,8 +122,7 @@ class Theme {
|
|||
} catch (Exception $e) {
|
||||
// Tag doesn't exist
|
||||
}
|
||||
|
||||
} elseif ($WHERE_AM_I=='category') {
|
||||
} elseif ($WHERE_AM_I == 'category') {
|
||||
try {
|
||||
$categoryKey = $url->slug();
|
||||
$category = new Category($categoryKey);
|
||||
|
@ -137,7 +139,7 @@ class Theme {
|
|||
$format = Text::replace('{{site-slogan}}', $site->slogan(), $format);
|
||||
$format = Text::replace('{{site-description}}', $site->description(), $format);
|
||||
|
||||
return '<title>'.$format.'</title>'.PHP_EOL;
|
||||
return '<title>' . $format . '</title>' . PHP_EOL;
|
||||
}
|
||||
|
||||
public static function metaTagDescription()
|
||||
|
@ -149,9 +151,9 @@ class Theme {
|
|||
|
||||
$description = $site->description();
|
||||
|
||||
if ($WHERE_AM_I=='page') {
|
||||
if ($WHERE_AM_I == 'page') {
|
||||
$description = $page->description();
|
||||
} elseif ($WHERE_AM_I=='category') {
|
||||
} elseif ($WHERE_AM_I == 'category') {
|
||||
try {
|
||||
$categoryKey = $url->slug();
|
||||
$category = new Category($categoryKey);
|
||||
|
@ -161,7 +163,7 @@ class Theme {
|
|||
}
|
||||
}
|
||||
|
||||
return '<meta name="description" content="'.$description.'">'.PHP_EOL;
|
||||
return '<meta name="description" content="' . $description . '">' . PHP_EOL;
|
||||
}
|
||||
|
||||
// DEPRECATED v3.0.0
|
||||
|
@ -180,48 +182,48 @@ class Theme {
|
|||
|
||||
public static function charset($charset)
|
||||
{
|
||||
return '<meta charset="'.$charset.'">'.PHP_EOL;
|
||||
return '<meta charset="' . $charset . '">' . PHP_EOL;
|
||||
}
|
||||
|
||||
public static function viewport($content)
|
||||
{
|
||||
return '<meta name="viewport" content="'.$content.'">'.PHP_EOL;
|
||||
return '<meta name="viewport" content="' . $content . '">' . PHP_EOL;
|
||||
}
|
||||
|
||||
public static function src($file, $base=DOMAIN_THEME)
|
||||
public static function src($file, $base = DOMAIN_THEME)
|
||||
{
|
||||
return $base.$file;
|
||||
return $base . $file;
|
||||
}
|
||||
|
||||
public static function css($files, $base=DOMAIN_THEME)
|
||||
public static function css($files, $base = DOMAIN_THEME)
|
||||
{
|
||||
if( !is_array($files) ) {
|
||||
if (!is_array($files)) {
|
||||
$files = array($files);
|
||||
}
|
||||
|
||||
$links = '';
|
||||
foreach($files as $file) {
|
||||
$links .= '<link rel="stylesheet" type="text/css" href="'.$base.$file.'?version='.BLUDIT_VERSION.'">'.PHP_EOL;
|
||||
foreach ($files as $file) {
|
||||
$links .= '<link rel="stylesheet" type="text/css" href="' . $base . $file . '?version=' . BLUDIT_VERSION . '">' . PHP_EOL;
|
||||
}
|
||||
|
||||
return $links;
|
||||
}
|
||||
|
||||
public static function javascript($files, $base=DOMAIN_THEME, $attributes='')
|
||||
public static function javascript($files, $base = DOMAIN_THEME, $attributes = '')
|
||||
{
|
||||
if( !is_array($files) ) {
|
||||
if (!is_array($files)) {
|
||||
$files = array($files);
|
||||
}
|
||||
|
||||
$scripts = '';
|
||||
foreach($files as $file) {
|
||||
$scripts .= '<script '.$attributes.' src="'.$base.$file.'?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
|
||||
foreach ($files as $file) {
|
||||
$scripts .= '<script ' . $attributes . ' src="' . $base . $file . '?version=' . BLUDIT_VERSION . '"></script>' . PHP_EOL;
|
||||
}
|
||||
|
||||
return $scripts;
|
||||
}
|
||||
|
||||
public static function js($files, $base=DOMAIN_THEME, $attributes='')
|
||||
public static function js($files, $base = DOMAIN_THEME, $attributes = '')
|
||||
{
|
||||
return self::javascript($files, $base, $attributes);
|
||||
}
|
||||
|
@ -234,9 +236,9 @@ class Theme {
|
|||
}
|
||||
}
|
||||
|
||||
public static function favicon($file='favicon.png', $typeIcon='image/png')
|
||||
public static function favicon($file = 'favicon.png', $typeIcon = 'image/png')
|
||||
{
|
||||
return '<link rel="icon" href="'.DOMAIN_THEME.$file.'" type="'.$typeIcon.'">'.PHP_EOL;
|
||||
return '<link rel="icon" href="' . DOMAIN_THEME . $file . '" type="' . $typeIcon . '">' . PHP_EOL;
|
||||
}
|
||||
|
||||
public static function keywords($keywords)
|
||||
|
@ -244,35 +246,38 @@ class Theme {
|
|||
if (is_array($keywords)) {
|
||||
$keywords = implode(',', $keywords);
|
||||
}
|
||||
return '<meta name="keywords" content="'.$keywords.'">'.PHP_EOL;
|
||||
return '<meta name="keywords" content="' . $keywords . '">' . PHP_EOL;
|
||||
}
|
||||
|
||||
public static function jquery()
|
||||
{
|
||||
return '<script src="'.DOMAIN_CORE_JS.'jquery.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
|
||||
return '<script src="' . DOMAIN_CORE_JS . 'jquery.min.js?version=' . BLUDIT_VERSION . '"></script>' . PHP_EOL;
|
||||
}
|
||||
|
||||
public static function jsBootstrap($attributes='')
|
||||
public static function jsBootstrap($attributes = '')
|
||||
{
|
||||
return '<script '.$attributes.' src="'.DOMAIN_CORE_JS.'bootstrap.bundle.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
|
||||
return '<script ' . $attributes . ' src="' . DOMAIN_CORE_JS . 'bootstrap.bundle.min.js?version=' . BLUDIT_VERSION . '"></script>' . PHP_EOL;
|
||||
}
|
||||
|
||||
public static function cssBootstrap()
|
||||
{
|
||||
return '<link rel="stylesheet" type="text/css" href="'.DOMAIN_CORE_CSS.'bootstrap.min.css?version='.BLUDIT_VERSION.'">'.PHP_EOL;
|
||||
return '<link rel="stylesheet" type="text/css" href="' . DOMAIN_CORE_CSS . 'bootstrap.min.css?version=' . BLUDIT_VERSION . '">' . PHP_EOL;
|
||||
}
|
||||
|
||||
public static function cssBootstrapIcons()
|
||||
{
|
||||
// https://icons.getbootstrap.com/
|
||||
return '<link rel="stylesheet" type="text/css" href="' . DOMAIN_CORE_CSS . 'bootstrap-icons/bootstrap-icons.css?version=' . BLUDIT_VERSION . '">' . PHP_EOL;
|
||||
}
|
||||
|
||||
public static function cssLineAwesome()
|
||||
{
|
||||
return '<link rel="stylesheet" type="text/css" href="'.DOMAIN_CORE_CSS.'line-awesome/css/line-awesome-font-awesome.min.css?version='.BLUDIT_VERSION.'">'.PHP_EOL;
|
||||
return '<link rel="stylesheet" type="text/css" href="' . DOMAIN_CORE_CSS . 'line-awesome/css/line-awesome-font-awesome.min.css?version=' . BLUDIT_VERSION . '">' . PHP_EOL;
|
||||
}
|
||||
|
||||
public static function jsSortable($attributes='')
|
||||
public static function jsSortable($attributes = '')
|
||||
{
|
||||
// https://github.com/psfpro/bootstrap-html5sortable
|
||||
return '<script '.$attributes.' src="'.DOMAIN_CORE_JS.'jquery.sortable.min.js?version='.BLUDIT_VERSION.'"></script>'.PHP_EOL;
|
||||
return '<script ' . $attributes . ' src="' . DOMAIN_CORE_JS . 'jquery.sortable.min.js?version=' . BLUDIT_VERSION . '"></script>' . PHP_EOL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
4
bl-kernel/js/jquery.min.js
vendored
4
bl-kernel/js/jquery.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,8 +1,9 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
class Login {
|
||||
|
||||
class Login
|
||||
{
|
||||
protected $users;
|
||||
protected $site;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
|
@ -12,11 +13,11 @@ class Login {
|
|||
$this->users = new Users();
|
||||
}
|
||||
|
||||
if (isset($GLOBALS['site'])) {
|
||||
$this->site = $GLOBALS['site'];
|
||||
} else {
|
||||
$this->site = new Site();
|
||||
}
|
||||
if (isset($GLOBALS['site'])) {
|
||||
$this->site = $GLOBALS['site'];
|
||||
} else {
|
||||
$this->site = new Site();
|
||||
}
|
||||
|
||||
// Start the Session
|
||||
if (!Session::started()) {
|
||||
|
@ -39,18 +40,18 @@ class Login {
|
|||
// Returns TRUE if the user is logged, FALSE otherwise
|
||||
public function isLogged()
|
||||
{
|
||||
if (Session::get('fingerPrint')===$this->fingerPrint()) {
|
||||
if (Session::get('fingerPrint') === $this->fingerPrint()) {
|
||||
$username = Session::get('username');
|
||||
if (!empty($username)) {
|
||||
return true;
|
||||
} else {
|
||||
Log::set(__METHOD__.LOG_SEP.'Session username empty, destroying the session.');
|
||||
Log::set(__METHOD__ . LOG_SEP . 'Session username empty, destroying the session.');
|
||||
Session::destroy();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Log::set(__METHOD__.LOG_SEP.'FingerPrints are different. ['.Session::get('fingerPrint').'] != ['.$this->fingerPrint().']');
|
||||
Log::set(__METHOD__ . LOG_SEP . 'FingerPrints are different. [' . Session::get('fingerPrint') . '] != [' . $this->fingerPrint() . ']');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -62,7 +63,7 @@ class Login {
|
|||
Session::set('fingerPrint', $this->fingerPrint());
|
||||
Session::set('sessionTime', time());
|
||||
|
||||
Log::set(__METHOD__.LOG_SEP.'User logged, fingerprint ['.$this->fingerPrint().']');
|
||||
Log::set(__METHOD__ . LOG_SEP . 'User logged, fingerprint [' . $this->fingerPrint() . ']');
|
||||
}
|
||||
|
||||
public function setRememberMe($username)
|
||||
|
@ -77,7 +78,7 @@ class Login {
|
|||
Cookie::set(REMEMBER_COOKIE_USERNAME, $username, REMEMBER_COOKIE_EXPIRE_IN_DAYS);
|
||||
Cookie::set(REMEMBER_COOKIE_TOKEN, $token, REMEMBER_COOKIE_EXPIRE_IN_DAYS);
|
||||
|
||||
Log::set(__METHOD__.LOG_SEP.'Cookies set for Remember Me.');
|
||||
Log::set(__METHOD__ . LOG_SEP . 'Cookies set for Remember Me.');
|
||||
}
|
||||
|
||||
public function invalidateRememberMe()
|
||||
|
@ -101,12 +102,12 @@ class Login {
|
|||
$username = trim($username);
|
||||
|
||||
if (empty($username) || empty($password)) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Username or password empty. Username: '.$username);
|
||||
Log::set(__METHOD__ . LOG_SEP . 'Username or password empty. Username: ' . $username);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Text::length($password)<PASSWORD_LENGTH) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Password length is shorter than required.');
|
||||
if (Text::length($password) < PASSWORD_LENGTH) {
|
||||
Log::set(__METHOD__ . LOG_SEP . 'Password length is shorter than required.');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -117,13 +118,13 @@ class Login {
|
|||
}
|
||||
|
||||
$passwordHash = $this->users->generatePasswordHash($password, $user->salt());
|
||||
if ($passwordHash===$user->password()) {
|
||||
if ($passwordHash === $user->password()) {
|
||||
$this->setLogin($username, $user->role());
|
||||
Log::set(__METHOD__.LOG_SEP.'Successful user login by username and password - Username ['.$username.']');
|
||||
Log::set(__METHOD__ . LOG_SEP . 'Successful user login by username and password - Username [' . $username . ']');
|
||||
return true;
|
||||
}
|
||||
|
||||
Log::set(__METHOD__.LOG_SEP.'Password incorrect.');
|
||||
Log::set(__METHOD__ . LOG_SEP . 'Password incorrect.');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -145,20 +146,20 @@ class Login {
|
|||
|
||||
if (empty($username) || empty($token)) {
|
||||
$this->invalidateRememberMe();
|
||||
Log::set(__METHOD__.LOG_SEP.'Username or Token empty. Username: '.$username.' - Token: '.$token);
|
||||
Log::set(__METHOD__ . LOG_SEP . 'Username or Token empty. Username: ' . $username . ' - Token: ' . $token);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($username !== $this->users->getByRememberToken($token)) {
|
||||
$this->invalidateRememberMe();
|
||||
Log::set(__METHOD__.LOG_SEP.'The user has different token or the token doesn\'t exist.');
|
||||
Log::set(__METHOD__ . LOG_SEP . 'The user has different token or the token doesn\'t exist.');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get user from database and login
|
||||
$user = $this->users->getUserDB($username);
|
||||
$this->setLogin($username, $user['role']);
|
||||
Log::set(__METHOD__.LOG_SEP.'User authenticated via Remember Me.');
|
||||
Log::set(__METHOD__ . LOG_SEP . 'User authenticated via Remember Me.');
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -177,4 +178,4 @@ class Login {
|
|||
Session::destroy();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,27 +1,28 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
class Pages extends dbJSON {
|
||||
class Pages extends dbJSON
|
||||
{
|
||||
|
||||
protected $parentKeyList = array();
|
||||
protected $dbFields = array(
|
||||
'title'=>'',
|
||||
'description'=>'',
|
||||
'username'=>'',
|
||||
'tags'=>array(),
|
||||
'type'=>'published', // published, static, draft, sticky, scheduled, autosave
|
||||
'date'=>'',
|
||||
'dateModified'=>'',
|
||||
'position'=>0,
|
||||
'coverImage'=>'',
|
||||
'category'=>'',
|
||||
'md5file'=>'',
|
||||
'uuid'=>'',
|
||||
'allowComments'=>true,
|
||||
'template'=>'',
|
||||
'noindex'=>false,
|
||||
'nofollow'=>false,
|
||||
'noarchive'=>false,
|
||||
'custom'=>array()
|
||||
'title' => '',
|
||||
'description' => '',
|
||||
'username' => '',
|
||||
'tags' => array(),
|
||||
'type' => 'published', // published, static, draft, sticky, scheduled, autosave
|
||||
'date' => '',
|
||||
'dateModified' => '',
|
||||
'position' => 0,
|
||||
'coverImage' => '',
|
||||
'category' => '',
|
||||
'md5file' => '',
|
||||
'uuid' => '',
|
||||
'allowComments' => true,
|
||||
'template' => '',
|
||||
'noindex' => false,
|
||||
'nofollow' => false,
|
||||
'noarchive' => false,
|
||||
'custom' => array()
|
||||
);
|
||||
|
||||
function __construct()
|
||||
|
@ -47,7 +48,7 @@ class Pages extends dbJSON {
|
|||
// Return TRUE if the page exists, FALSE otherwise
|
||||
public function exists($key)
|
||||
{
|
||||
return isset( $this->db[$key] );
|
||||
return isset($this->db[$key]);
|
||||
}
|
||||
|
||||
// Create a new page
|
||||
|
@ -57,18 +58,18 @@ class Pages extends dbJSON {
|
|||
$row = array();
|
||||
|
||||
// Predefined values
|
||||
foreach ($this->dbFields as $field=>$value) {
|
||||
if ($field=='tags') {
|
||||
foreach ($this->dbFields as $field => $value) {
|
||||
if ($field == 'tags') {
|
||||
$tags = '';
|
||||
if (isset($args['tags'])) {
|
||||
$tags = $args['tags'];
|
||||
}
|
||||
$finalValue = $this->generateTags($tags);
|
||||
} elseif ($field=='custom') {
|
||||
} elseif ($field == 'custom') {
|
||||
if (isset($args['custom'])) {
|
||||
global $site;
|
||||
$customFields = $site->customFields();
|
||||
foreach ($args['custom'] as $customField=>$customValue) {
|
||||
foreach ($args['custom'] as $customField => $customValue) {
|
||||
$html = Sanitize::html($customValue);
|
||||
// Store the custom field as defined type
|
||||
settype($html, $customFields[$customField]['type']);
|
||||
|
@ -91,7 +92,7 @@ class Pages extends dbJSON {
|
|||
|
||||
// Content
|
||||
// This variable is not belong to the database so is not defined in $row
|
||||
$contentRaw = (empty($args['content'])?'':$args['content']);
|
||||
$contentRaw = (empty($args['content']) ? '' : $args['content']);
|
||||
|
||||
// Parent
|
||||
// This variable is not belong to the database so is not defined in $row
|
||||
|
@ -128,24 +129,24 @@ class Pages extends dbJSON {
|
|||
}
|
||||
|
||||
// Schedule page
|
||||
if (($row['date']>Date::current(DB_DATE_FORMAT)) && ($row['type']=='published')) {
|
||||
if (($row['date'] > Date::current(DB_DATE_FORMAT)) && ($row['type'] == 'published')) {
|
||||
$row['type'] = 'scheduled';
|
||||
}
|
||||
|
||||
// Create the directory
|
||||
if (Filesystem::mkdir(PATH_PAGES.$key, true) === false) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to create the directory ['.PATH_PAGES.$key.']',LOG_TYPE_ERROR);
|
||||
if (Filesystem::mkdir(PATH_PAGES . $key, true) === false) {
|
||||
Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to create the directory [' . PATH_PAGES . $key . ']', LOG_TYPE_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create the index.txt and save the file
|
||||
if (file_put_contents(PATH_PAGES.$key.DS.FILENAME, $contentRaw) === false) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to create the content in the file ['.FILENAME.']',LOG_TYPE_ERROR);
|
||||
if (file_put_contents(PATH_PAGES . $key . DS . FILENAME, $contentRaw) === false) {
|
||||
Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to create the content in the file [' . FILENAME . ']', LOG_TYPE_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Checksum MD5
|
||||
$row['md5file'] = md5_file(PATH_PAGES.$key.DS.FILENAME);
|
||||
$row['md5file'] = md5_file(PATH_PAGES . $key . DS . FILENAME);
|
||||
|
||||
// Insert in database
|
||||
$this->db[$key] = $row;
|
||||
|
@ -156,10 +157,12 @@ class Pages extends dbJSON {
|
|||
// Save database
|
||||
$this->save();
|
||||
|
||||
// Create symlink for images directory
|
||||
if (Filesystem::mkdir(PATH_UPLOADS_PAGES.$row['uuid'])) {
|
||||
symlink(PATH_UPLOADS_PAGES.$row['uuid'], PATH_UPLOADS_PAGES.$key);
|
||||
// Create upload page directory for images
|
||||
if (!Filesystem::directoryExists(PATH_UPLOADS_PAGES . $row['uuid'])) {
|
||||
Filesystem::mkdir(PATH_UPLOADS_PAGES . $row['uuid']);
|
||||
}
|
||||
// Create a symlink to the upload page directory for images for better SEO
|
||||
Filesystem::symlink(PATH_UPLOADS_PAGES . $row['uuid'], PATH_UPLOADS_PAGES . $key);
|
||||
|
||||
return $key;
|
||||
}
|
||||
|
@ -179,14 +182,14 @@ class Pages extends dbJSON {
|
|||
|
||||
// Check values from the arguments ($args)
|
||||
// If some field is missing the current value is taken
|
||||
foreach ($this->dbFields as $field=>$value) {
|
||||
if ( ($field=='tags') && isset($args['tags'])) {
|
||||
foreach ($this->dbFields as $field => $value) {
|
||||
if (($field == 'tags') && isset($args['tags'])) {
|
||||
$finalValue = $this->generateTags($args['tags']);
|
||||
} elseif ($field=='custom') {
|
||||
} elseif ($field == 'custom') {
|
||||
if (isset($args['custom'])) {
|
||||
global $site;
|
||||
$customFields = $site->customFields();
|
||||
foreach ($args['custom'] as $customField=>$customValue) {
|
||||
foreach ($args['custom'] as $customField => $customValue) {
|
||||
$html = Sanitize::html($customValue);
|
||||
// Store the custom field as defined type
|
||||
settype($html, $customFields[$customField]['type']);
|
||||
|
@ -241,27 +244,27 @@ class Pages extends dbJSON {
|
|||
$row['dateModified'] = Date::current(DB_DATE_FORMAT);
|
||||
|
||||
// Schedule page
|
||||
if (($row['date']>Date::current(DB_DATE_FORMAT)) && ($row['type']=='published')) {
|
||||
if (($row['date'] > Date::current(DB_DATE_FORMAT)) && ($row['type'] == 'published')) {
|
||||
$row['type'] = 'scheduled';
|
||||
}
|
||||
|
||||
// Move the directory from old key to new key only if the keys are different
|
||||
if ($newKey!==$key) {
|
||||
if (Filesystem::mv(PATH_PAGES.$key, PATH_PAGES.$newKey) === false) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to move the directory to '.PATH_PAGES.$newKey);
|
||||
if ($newKey !== $key) {
|
||||
if (Filesystem::mv(PATH_PAGES . $key, PATH_PAGES . $newKey) === false) {
|
||||
Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to move the directory to ' . PATH_PAGES . $newKey);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Regenerate the symlink to a proper directory
|
||||
unlink(PATH_UPLOADS_PAGES.$key);
|
||||
symlink(PATH_UPLOADS_PAGES.$row['uuid'], PATH_UPLOADS_PAGES.$newKey);
|
||||
unlink(PATH_UPLOADS_PAGES . $key);
|
||||
Filesystem::symlink(PATH_UPLOADS_PAGES . $row['uuid'], PATH_UPLOADS_PAGES . $newKey);
|
||||
}
|
||||
|
||||
// If the content was passed via arguments replace the content
|
||||
if (isset($args['content'])) {
|
||||
// Make the index.txt and save the file.
|
||||
if (file_put_contents(PATH_PAGES.$newKey.DS.FILENAME, $args['content'])===false) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to put the content in the file '.FILENAME);
|
||||
if (file_put_contents(PATH_PAGES . $newKey . DS . FILENAME, $args['content']) === false) {
|
||||
Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to put the content in the file ' . FILENAME);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -273,7 +276,7 @@ class Pages extends dbJSON {
|
|||
$this->reindexChildren($key, $newKey);
|
||||
|
||||
// Checksum MD5
|
||||
$row['md5file'] = md5_file(PATH_PAGES.$newKey.DS.FILENAME);
|
||||
$row['md5file'] = md5_file(PATH_PAGES . $newKey . DS . FILENAME);
|
||||
|
||||
// Insert in database the new row
|
||||
$this->db[$newKey] = $row;
|
||||
|
@ -289,14 +292,15 @@ class Pages extends dbJSON {
|
|||
|
||||
// This function reindex the orphan children with the new parent key
|
||||
// If a page has subpages and the page change his key is necesarry check the children key
|
||||
public function reindexChildren($oldParentKey, $newParentKey) {
|
||||
if ($oldParentKey==$newParentKey){
|
||||
public function reindexChildren($oldParentKey, $newParentKey)
|
||||
{
|
||||
if ($oldParentKey == $newParentKey) {
|
||||
return false;
|
||||
}
|
||||
$tmp = $this->db;
|
||||
foreach ($tmp as $key=>$fields) {
|
||||
if (Text::startsWith($key, $oldParentKey.'/')) {
|
||||
$newKey = Text::replace($oldParentKey.'/', $newParentKey.'/', $key);
|
||||
foreach ($tmp as $key => $fields) {
|
||||
if (Text::startsWith($key, $oldParentKey . '/')) {
|
||||
$newKey = Text::replace($oldParentKey . '/', $newParentKey . '/', $key);
|
||||
$this->db[$newKey] = $this->db[$key];
|
||||
unset($this->db[$key]);
|
||||
}
|
||||
|
@ -312,26 +316,28 @@ class Pages extends dbJSON {
|
|||
|
||||
// Page doesn't exist in database
|
||||
if (!$this->exists($key)) {
|
||||
Log::set(__METHOD__.LOG_SEP.'The page does not exist. Key: '.$key);
|
||||
Log::set(__METHOD__ . LOG_SEP . 'The page does not exist. Key: ' . $key);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Delete directory and files
|
||||
if (Filesystem::deleteRecursive(PATH_PAGES.$key) === false) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to delete the directory '.PATH_PAGES.$key, LOG_TYPE_ERROR);
|
||||
if (Filesystem::deleteRecursive(PATH_PAGES . $key) === false) {
|
||||
Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to delete the directory ' . PATH_PAGES . $key, LOG_TYPE_ERROR);
|
||||
}
|
||||
|
||||
// Delete page images directory; The function already check if exists the directory
|
||||
if (Filesystem::deleteRecursive(PATH_UPLOADS_PAGES.$key) === false) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Directory with images not found '.PATH_UPLOADS_PAGES.$key);
|
||||
if (($uuid = $this->getUUID($key))) {
|
||||
if (Filesystem::deleteRecursive(PATH_UPLOADS_PAGES . $uuid) === false) {
|
||||
Log::set(__METHOD__ . LOG_SEP . 'Directory with images not found ' . PATH_UPLOADS_PAGES . $uuid);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove from database
|
||||
unset($this->db[$key]);
|
||||
|
||||
// Save the database
|
||||
if ($this->save()===false) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.');
|
||||
if ($this->save() === false) {
|
||||
Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to save the database file.');
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -342,8 +348,8 @@ class Pages extends dbJSON {
|
|||
{
|
||||
$username = $args['username'];
|
||||
|
||||
foreach ($this->db as $key=>$fields) {
|
||||
if ($fields['username']===$username) {
|
||||
foreach ($this->db as $key => $fields) {
|
||||
if ($fields['username'] === $username) {
|
||||
$this->delete($key);
|
||||
}
|
||||
}
|
||||
|
@ -357,8 +363,8 @@ class Pages extends dbJSON {
|
|||
$oldUsername = $args['oldUsername'];
|
||||
$newUsername = isset($args['newUsername']) ? $args['newUsername'] : 'admin';
|
||||
|
||||
foreach ($this->db as $key=>$fields) {
|
||||
if ($fields['username']===$oldUsername) {
|
||||
foreach ($this->db as $key => $fields) {
|
||||
if ($fields['username'] === $oldUsername) {
|
||||
$this->db[$key]['username'] = $newUsername;
|
||||
}
|
||||
}
|
||||
|
@ -380,7 +386,7 @@ class Pages extends dbJSON {
|
|||
// Returns a database with all pages
|
||||
// $onlyKeys = true; Returns only the pages keys
|
||||
// $onlyKeys = false; Returns part of the database, I do not recommend use this
|
||||
public function getDB($onlyKeys=true)
|
||||
public function getDB($onlyKeys = true)
|
||||
{
|
||||
$tmp = $this->db;
|
||||
if ($onlyKeys) {
|
||||
|
@ -392,11 +398,11 @@ class Pages extends dbJSON {
|
|||
// Returns a database with published pages
|
||||
// $onlyKeys = true; Returns only the pages keys
|
||||
// $onlyKeys = false; Returns part of the database, I do not recommend use this
|
||||
public function getPublishedDB($onlyKeys=true)
|
||||
public function getPublishedDB($onlyKeys = true)
|
||||
{
|
||||
$tmp = $this->db;
|
||||
foreach ($tmp as $key=>$fields) {
|
||||
if ($fields['type']!='published') {
|
||||
foreach ($tmp as $key => $fields) {
|
||||
if ($fields['type'] != 'published') {
|
||||
unset($tmp[$key]);
|
||||
}
|
||||
}
|
||||
|
@ -408,11 +414,11 @@ class Pages extends dbJSON {
|
|||
|
||||
// Returns an array with a list of keys/database of static pages
|
||||
// By default the static pages are sort by position
|
||||
public function getStaticDB($onlyKeys=true)
|
||||
public function getStaticDB($onlyKeys = true)
|
||||
{
|
||||
$tmp = $this->db;
|
||||
foreach ($tmp as $key=>$fields) {
|
||||
if ($fields['type']!='static') {
|
||||
foreach ($tmp as $key => $fields) {
|
||||
if ($fields['type'] != 'static') {
|
||||
unset($tmp[$key]);
|
||||
}
|
||||
}
|
||||
|
@ -424,11 +430,11 @@ class Pages extends dbJSON {
|
|||
}
|
||||
|
||||
// Returns an array with a list of keys/database of draft pages
|
||||
public function getDraftDB($onlyKeys=true)
|
||||
public function getDraftDB($onlyKeys = true)
|
||||
{
|
||||
$tmp = $this->db;
|
||||
foreach ($tmp as $key=>$fields) {
|
||||
if($fields['type']!='draft') {
|
||||
foreach ($tmp as $key => $fields) {
|
||||
if ($fields['type'] != 'draft') {
|
||||
unset($tmp[$key]);
|
||||
}
|
||||
}
|
||||
|
@ -439,11 +445,11 @@ class Pages extends dbJSON {
|
|||
}
|
||||
|
||||
// Returns an array with a list of keys/database of autosave pages
|
||||
public function getAutosaveDB($onlyKeys=true)
|
||||
public function getAutosaveDB($onlyKeys = true)
|
||||
{
|
||||
$tmp = $this->db;
|
||||
foreach ($tmp as $key=>$fields) {
|
||||
if($fields['type']!='autosave') {
|
||||
foreach ($tmp as $key => $fields) {
|
||||
if ($fields['type'] != 'autosave') {
|
||||
unset($tmp[$key]);
|
||||
}
|
||||
}
|
||||
|
@ -454,11 +460,11 @@ class Pages extends dbJSON {
|
|||
}
|
||||
|
||||
// Returns an array with a list of keys/database of scheduled pages
|
||||
public function getScheduledDB($onlyKeys=true)
|
||||
public function getScheduledDB($onlyKeys = true)
|
||||
{
|
||||
$tmp = $this->db;
|
||||
foreach ($tmp as $key=>$fields) {
|
||||
if($fields['type']!='scheduled') {
|
||||
foreach ($tmp as $key => $fields) {
|
||||
if ($fields['type'] != 'scheduled') {
|
||||
unset($tmp[$key]);
|
||||
}
|
||||
}
|
||||
|
@ -469,11 +475,11 @@ class Pages extends dbJSON {
|
|||
}
|
||||
|
||||
// Returns an array with a list of keys of sticky pages
|
||||
public function getStickyDB($onlyKeys=true)
|
||||
public function getStickyDB($onlyKeys = true)
|
||||
{
|
||||
$tmp = $this->db;
|
||||
foreach ($tmp as $key=>$fields) {
|
||||
if($fields['type']!='sticky') {
|
||||
foreach ($tmp as $key => $fields) {
|
||||
if ($fields['type'] != 'sticky') {
|
||||
unset($tmp[$key]);
|
||||
}
|
||||
}
|
||||
|
@ -487,8 +493,8 @@ class Pages extends dbJSON {
|
|||
public function nextPositionNumber()
|
||||
{
|
||||
$tmp = 1;
|
||||
foreach ($this->db as $key=>$fields) {
|
||||
if ($fields['position']>$tmp) {
|
||||
foreach ($this->db as $key => $fields) {
|
||||
if ($fields['position'] > $tmp) {
|
||||
$tmp = $fields['position'];
|
||||
}
|
||||
}
|
||||
|
@ -498,12 +504,12 @@ class Pages extends dbJSON {
|
|||
// Returns the next page key of the current page key
|
||||
public function nextPageKey($currentKey)
|
||||
{
|
||||
if ($this->db[$currentKey]['type']=='published') {
|
||||
if ($this->db[$currentKey]['type'] == 'published') {
|
||||
$keys = array_keys($this->db);
|
||||
$position = array_search($currentKey, $keys) - 1;
|
||||
if (isset($keys[$position])) {
|
||||
$nextKey = $keys[$position];
|
||||
if ($this->db[$nextKey]['type']=='published') {
|
||||
if ($this->db[$nextKey]['type'] == 'published') {
|
||||
return $nextKey;
|
||||
}
|
||||
}
|
||||
|
@ -514,12 +520,12 @@ class Pages extends dbJSON {
|
|||
// Returns the previous page key of the current page key
|
||||
public function previousPageKey($currentKey)
|
||||
{
|
||||
if ($this->db[$currentKey]['type']=='published') {
|
||||
if ($this->db[$currentKey]['type'] == 'published') {
|
||||
$keys = array_keys($this->db);
|
||||
$position = array_search($currentKey, $keys) + 1;
|
||||
if (isset($keys[$position])) {
|
||||
$prevKey = $keys[$position];
|
||||
if ($this->db[$prevKey]['type']=='published') {
|
||||
if ($this->db[$prevKey]['type'] == 'published') {
|
||||
return $prevKey;
|
||||
}
|
||||
}
|
||||
|
@ -532,24 +538,24 @@ class Pages extends dbJSON {
|
|||
// (int) $pageNumber, the page number
|
||||
// (int) $numberOfItems, amount of items to return, if -1 returns all the items
|
||||
// (boolean) $onlyPublished, TRUE to return only published pages
|
||||
public function getList($pageNumber, $numberOfItems, $published=true, $static=false, $sticky=false, $draft=false, $scheduled=false)
|
||||
public function getList($pageNumber, $numberOfItems, $published = true, $static = false, $sticky = false, $draft = false, $scheduled = false)
|
||||
{
|
||||
$list = array();
|
||||
foreach ($this->db as $key=>$fields) {
|
||||
if ($published && $fields['type']=='published') {
|
||||
foreach ($this->db as $key => $fields) {
|
||||
if ($published && $fields['type'] == 'published') {
|
||||
array_push($list, $key);
|
||||
} elseif ($static && $fields['type']=='static') {
|
||||
} elseif ($static && $fields['type'] == 'static') {
|
||||
array_push($list, $key);
|
||||
} elseif ($sticky && $fields['type']=='sticky') {
|
||||
} elseif ($sticky && $fields['type'] == 'sticky') {
|
||||
array_push($list, $key);
|
||||
} elseif ($draft && $fields['type']=='draft') {
|
||||
} elseif ($draft && $fields['type'] == 'draft') {
|
||||
array_push($list, $key);
|
||||
} elseif ($scheduled && $fields['type']=='scheduled') {
|
||||
} elseif ($scheduled && $fields['type'] == 'scheduled') {
|
||||
array_push($list, $key);
|
||||
}
|
||||
}
|
||||
|
||||
if ($numberOfItems==-1) {
|
||||
if ($numberOfItems == -1) {
|
||||
return $list;
|
||||
}
|
||||
|
||||
|
@ -558,8 +564,8 @@ class Pages extends dbJSON {
|
|||
|
||||
$total = count($list);
|
||||
$init = (int) $numberOfItems * $realPageNumber;
|
||||
$end = (int) min( ($init + $numberOfItems - 1), $total );
|
||||
$outrange = $init<0 ? true : $init>$end;
|
||||
$end = (int) min(($init + $numberOfItems - 1), $total);
|
||||
$outrange = $init < 0 ? true : $init > $end;
|
||||
if (!$outrange) {
|
||||
return array_slice($list, $init, $numberOfItems, true);
|
||||
}
|
||||
|
@ -570,7 +576,7 @@ class Pages extends dbJSON {
|
|||
// Returns the amount of pages
|
||||
// (boolean) $onlyPublished, TRUE returns the total of published pages (without draft and scheduled)
|
||||
// (boolean) $onlyPublished, FALSE returns the total of pages
|
||||
public function count($onlyPublished=true)
|
||||
public function count($onlyPublished = true)
|
||||
{
|
||||
if ($onlyPublished) {
|
||||
$db = $this->getPublishedDB(false);
|
||||
|
@ -584,7 +590,7 @@ class Pages extends dbJSON {
|
|||
public function getParents()
|
||||
{
|
||||
$db = $this->getPublishedDB();
|
||||
foreach ($db as $key=>$pageKey) {
|
||||
foreach ($db as $key => $pageKey) {
|
||||
// if the key has slash then is a child
|
||||
if (Text::stringContains($pageKey, '/')) {
|
||||
unset($db[$key]);
|
||||
|
@ -597,8 +603,8 @@ class Pages extends dbJSON {
|
|||
{
|
||||
$tmp = $this->db;
|
||||
$list = array();
|
||||
foreach ($tmp as $key=>$fields) {
|
||||
if (Text::startsWith($key, $parentKey.'/')) {
|
||||
foreach ($tmp as $key => $fields) {
|
||||
if (Text::startsWith($key, $parentKey . '/')) {
|
||||
array_push($list, $key);
|
||||
}
|
||||
}
|
||||
|
@ -607,16 +613,16 @@ class Pages extends dbJSON {
|
|||
|
||||
public function sortBy()
|
||||
{
|
||||
if (ORDER_BY=='date') {
|
||||
if (ORDER_BY == 'date') {
|
||||
return $this->sortByDate(true);
|
||||
}
|
||||
return $this->sortByPosition(false);
|
||||
}
|
||||
|
||||
// Sort pages by position
|
||||
public function sortByPosition($HighToLow=false)
|
||||
public function sortByPosition($HighToLow = false)
|
||||
{
|
||||
if($HighToLow) {
|
||||
if ($HighToLow) {
|
||||
uasort($this->db, array($this, 'sortByPositionHighToLow'));
|
||||
} else {
|
||||
uasort($this->db, array($this, 'sortByPositionLowToHigh'));
|
||||
|
@ -626,17 +632,30 @@ class Pages extends dbJSON {
|
|||
|
||||
private function sortByPositionLowToHigh($a, $b)
|
||||
{
|
||||
return $a['position']>$b['position'];
|
||||
if ($a['position'] < $b['position']) {
|
||||
return -1;
|
||||
} elseif ($a['position'] > $b['position']) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private function sortByPositionHighToLow($a, $b)
|
||||
{
|
||||
return $a['position']<$b['position'];
|
||||
if ($a['position'] > $b['position']) {
|
||||
return -1;
|
||||
} elseif ($a['position'] < $b['position']) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Sort pages by date
|
||||
public function sortByDate($HighToLow=true)
|
||||
public function sortByDate($HighToLow = true)
|
||||
{
|
||||
if($HighToLow) {
|
||||
if ($HighToLow) {
|
||||
uasort($this->db, array($this, 'sortByDateHighToLow'));
|
||||
} else {
|
||||
uasort($this->db, array($this, 'sortByDateLowToHigh'));
|
||||
|
@ -646,15 +665,16 @@ class Pages extends dbJSON {
|
|||
|
||||
private function sortByDateLowToHigh($a, $b)
|
||||
{
|
||||
return $a['date']>$b['date'];
|
||||
return $a['date'] > $b['date'];
|
||||
}
|
||||
private function sortByDateHighToLow($a, $b)
|
||||
{
|
||||
return $a['date']<$b['date'];
|
||||
return $a['date'] < $b['date'];
|
||||
}
|
||||
|
||||
function generateUUID() {
|
||||
return md5( uniqid().time() );
|
||||
function generateUUID()
|
||||
{
|
||||
return md5(uniqid() . time());
|
||||
}
|
||||
|
||||
// Returns the UUID of a page, by the page key
|
||||
|
@ -670,8 +690,8 @@ class Pages extends dbJSON {
|
|||
// if the UUID doesn't exits returns FALSE
|
||||
function getByUUID($uuid)
|
||||
{
|
||||
foreach ($this->db as $key=>$value) {
|
||||
if ($value['uuid']==$uuid) {
|
||||
foreach ($this->db as $key => $value) {
|
||||
if ($value['uuid'] == $uuid) {
|
||||
return $key;
|
||||
}
|
||||
}
|
||||
|
@ -680,7 +700,7 @@ class Pages extends dbJSON {
|
|||
|
||||
|
||||
// Returns string without HTML tags and truncated
|
||||
private function generateSlug($text, $truncateLength=60)
|
||||
private function generateSlug($text, $truncateLength = 60)
|
||||
{
|
||||
$tmpslug = Text::removeHTMLTags($text);
|
||||
$tmpslug = Text::removeLineBreaks($tmpslug);
|
||||
|
@ -696,25 +716,24 @@ class Pages extends dbJSON {
|
|||
$saveDatabase = false;
|
||||
|
||||
// The database need to be sorted by date
|
||||
foreach($this->db as $pageKey=>$fields) {
|
||||
if($fields['type']=='scheduled') {
|
||||
if($fields['date']<=$currentDate) {
|
||||
foreach ($this->db as $pageKey => $fields) {
|
||||
if ($fields['type'] == 'scheduled') {
|
||||
if ($fields['date'] <= $currentDate) {
|
||||
$this->db[$pageKey]['type'] = 'published';
|
||||
$saveDatabase = true;
|
||||
}
|
||||
}
|
||||
elseif( ($fields['type']=='published') && (ORDER_BY=='date') ) {
|
||||
} elseif (($fields['type'] == 'published') && (ORDER_BY == 'date')) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if($saveDatabase) {
|
||||
if( $this->save() === false ) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.');
|
||||
if ($saveDatabase) {
|
||||
if ($this->save() === false) {
|
||||
Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to save the database file.');
|
||||
return false;
|
||||
}
|
||||
|
||||
Log::set(__METHOD__.LOG_SEP.'New pages published from the scheduler.');
|
||||
Log::set(__METHOD__ . LOG_SEP . 'New pages published from the scheduler.');
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -722,7 +741,7 @@ class Pages extends dbJSON {
|
|||
}
|
||||
|
||||
// Generate a valid Key/Slug
|
||||
public function generateKey($text, $parent=false, $returnSlug=false, $oldKey='')
|
||||
public function generateKey($text, $parent = false, $returnSlug = false, $oldKey = '')
|
||||
{
|
||||
global $L;
|
||||
global $site;
|
||||
|
@ -734,7 +753,7 @@ class Pages extends dbJSON {
|
|||
if (Text::isEmpty($parent)) {
|
||||
$newKey = Text::cleanUrl($text);
|
||||
} else {
|
||||
$newKey = Text::cleanUrl($parent).'/'.Text::cleanUrl($text);
|
||||
$newKey = Text::cleanUrl($parent) . '/' . Text::cleanUrl($text);
|
||||
}
|
||||
|
||||
// cleanURL can return empty string
|
||||
|
@ -742,14 +761,14 @@ class Pages extends dbJSON {
|
|||
$newKey = $L->g('empty');
|
||||
}
|
||||
|
||||
if ($newKey!==$oldKey) {
|
||||
if ($newKey !== $oldKey) {
|
||||
// Verify if the key is already been used
|
||||
if (isset($this->db[$newKey])) {
|
||||
$i = 0;
|
||||
while (isset($this->db[$newKey.'-'.$i])) {
|
||||
while (isset($this->db[$newKey . '-' . $i])) {
|
||||
$i++;
|
||||
}
|
||||
$newKey = $newKey.'-'.$i;
|
||||
$newKey = $newKey . '-' . $i;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -786,8 +805,8 @@ class Pages extends dbJSON {
|
|||
// Change all pages with the old category key to the new category key
|
||||
public function changeCategory($oldCategoryKey, $newCategoryKey)
|
||||
{
|
||||
foreach ($this->db as $key=>$value) {
|
||||
if ($value['category']===$oldCategoryKey) {
|
||||
foreach ($this->db as $key => $value) {
|
||||
if ($value['category'] === $oldCategoryKey) {
|
||||
$this->db[$key]['category'] = $newCategoryKey;
|
||||
}
|
||||
}
|
||||
|
@ -804,8 +823,8 @@ class Pages extends dbJSON {
|
|||
if (json_last_error() != JSON_ERROR_NONE) {
|
||||
return false;
|
||||
}
|
||||
foreach ($this->db as $pageKey=>$pageFields) {
|
||||
foreach ($customFields as $customField=>$customValues) {
|
||||
foreach ($this->db as $pageKey => $pageFields) {
|
||||
foreach ($customFields as $customField => $customValues) {
|
||||
if (!isset($pageFields['custom'][$customField])) {
|
||||
$defaultValue = '';
|
||||
if (isset($customValues['default'])) {
|
||||
|
@ -818,6 +837,4 @@ class Pages extends dbJSON {
|
|||
|
||||
return $this->save();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
class Page {
|
||||
class Page
|
||||
{
|
||||
|
||||
protected $vars;
|
||||
|
||||
|
@ -12,19 +13,19 @@ class Page {
|
|||
|
||||
// If key is FALSE, the page is create with default values, like an empty page
|
||||
// Useful for Page Not Found
|
||||
if ($key===false) {
|
||||
if ($key === false) {
|
||||
$row = $pages->getDefaultFields();
|
||||
} else {
|
||||
if (Text::isEmpty($key) || !$pages->exists($key)) {
|
||||
$errorMessage = 'Page not found in database by key ['.$key.']';
|
||||
Log::set(__METHOD__.LOG_SEP.$errorMessage);
|
||||
$errorMessage = 'Page not found in database by key [' . $key . ']';
|
||||
Log::set(__METHOD__ . LOG_SEP . $errorMessage);
|
||||
throw new Exception($errorMessage);
|
||||
}
|
||||
$row = $pages->getPageDB($key);
|
||||
}
|
||||
|
||||
foreach ($row as $field=>$value) {
|
||||
if ($field=='date') {
|
||||
foreach ($row as $field => $value) {
|
||||
if ($field == 'date') {
|
||||
$this->setField('dateRaw', $value);
|
||||
} else {
|
||||
$this->setField($field, $value);
|
||||
|
@ -49,10 +50,10 @@ class Page {
|
|||
// Returns the raw content
|
||||
// This content is not markdown parser
|
||||
// (boolean) $sanitize, TRUE returns the content sanitized
|
||||
public function contentRaw($sanitize=false)
|
||||
public function contentRaw($sanitize = false)
|
||||
{
|
||||
$key = $this->key();
|
||||
$filePath = PATH_PAGES.$key.DS.FILENAME;
|
||||
$filePath = PATH_PAGES . $key . DS . FILENAME;
|
||||
$contentRaw = file_get_contents($filePath);
|
||||
|
||||
if ($sanitize) {
|
||||
|
@ -64,7 +65,7 @@ class Page {
|
|||
// Returns the full content
|
||||
// This content is markdown parser
|
||||
// (boolean) $sanitize, TRUE returns the content sanitized
|
||||
public function content($sanitize=false)
|
||||
public function content($sanitize = false)
|
||||
{
|
||||
// If already set the content, return it
|
||||
$content = $this->getValue('content');
|
||||
|
@ -83,7 +84,7 @@ class Page {
|
|||
|
||||
// Parse img src relative to absolute (with domain)
|
||||
if (IMAGE_RELATIVE_TO_ABSOLUTE) {
|
||||
$domain = IMAGE_RESTRICT?DOMAIN_UPLOADS_PAGES.$this->uuid().'/':DOMAIN_UPLOADS;
|
||||
$domain = IMAGE_RESTRICT ? DOMAIN_UPLOADS_PAGES . $this->uuid() . '/' : DOMAIN_UPLOADS;
|
||||
$content = Text::imgRel2Abs($content, $domain);
|
||||
}
|
||||
|
||||
|
@ -96,7 +97,7 @@ class Page {
|
|||
// Returns the first part of the content if the content is splited, otherwise is returned the full content
|
||||
// This content is markdown parser
|
||||
// (boolean) $sanitize, TRUE returns the content sanitized
|
||||
public function contentBreak($sanitize=false)
|
||||
public function contentBreak($sanitize = false)
|
||||
{
|
||||
$content = $this->content($sanitize);
|
||||
$explode = explode(PAGE_BREAK, $content);
|
||||
|
@ -104,10 +105,10 @@ class Page {
|
|||
}
|
||||
|
||||
// Returns the date according to locale settings and the format defined in the system
|
||||
public function date($format=false)
|
||||
public function date($format = false)
|
||||
{
|
||||
$dateRaw = $this->dateRaw();
|
||||
if ($format===false) {
|
||||
if ($format === false) {
|
||||
global $site;
|
||||
$format = $site->dateFormat();
|
||||
}
|
||||
|
@ -122,10 +123,10 @@ class Page {
|
|||
}
|
||||
|
||||
// Returns the date according to locale settings and format settings
|
||||
public function dateModified($format=false)
|
||||
public function dateModified($format = false)
|
||||
{
|
||||
$dateRaw = $this->getValue('dateModified');
|
||||
if ($format===false) {
|
||||
if ($format === false) {
|
||||
global $site;
|
||||
$format = $site->dateFormat();
|
||||
}
|
||||
|
@ -146,16 +147,16 @@ class Page {
|
|||
|
||||
// Returns the permalink
|
||||
// (boolean) $absolute, TRUE returns the page link with the DOMAIN, FALSE without the DOMAIN
|
||||
public function permalink($absolute=true)
|
||||
public function permalink($absolute = true)
|
||||
{
|
||||
// Get the key of the page
|
||||
$key = $this->key();
|
||||
|
||||
if($absolute) {
|
||||
return DOMAIN_PAGES.$key;
|
||||
if ($absolute) {
|
||||
return DOMAIN_PAGES . $key;
|
||||
}
|
||||
|
||||
return HTML_PATH_ROOT.PAGE_URI_FILTER.$key;
|
||||
return HTML_PATH_ROOT . PAGE_URI_FILTER . $key;
|
||||
}
|
||||
|
||||
// Returns the previous page key
|
||||
|
@ -199,7 +200,7 @@ class Page {
|
|||
// Returns the category permalink
|
||||
public function categoryPermalink()
|
||||
{
|
||||
return DOMAIN_CATEGORIES.$this->categoryKey();
|
||||
return DOMAIN_CATEGORIES . $this->categoryKey();
|
||||
}
|
||||
|
||||
// Returns the field from the array
|
||||
|
@ -210,9 +211,9 @@ class Page {
|
|||
$categoryKey = $this->categoryKey();
|
||||
$map = $categories->getMap($categoryKey);
|
||||
|
||||
if ($field=='key') {
|
||||
if ($field == 'key') {
|
||||
return $this->categoryKey();
|
||||
} elseif(isset($map[$field])) {
|
||||
} elseif (isset($map[$field])) {
|
||||
return $map[$field];
|
||||
}
|
||||
|
||||
|
@ -220,7 +221,7 @@ class Page {
|
|||
}
|
||||
|
||||
// Returns the user object or passing the method returns the object User method
|
||||
public function user($method=false)
|
||||
public function user($method = false)
|
||||
{
|
||||
$username = $this->username();
|
||||
try {
|
||||
|
@ -248,7 +249,7 @@ class Page {
|
|||
// Returns the tags separated by comma
|
||||
// (boolean) $returnsArray, TRUE to get the tags as an array, FALSE to get the tags separated by comma
|
||||
// The tags in array format returns array( tagKey => tagName )
|
||||
public function tags($returnsArray=false)
|
||||
public function tags($returnsArray = false)
|
||||
{
|
||||
$tags = $this->getValue('tags');
|
||||
if ($returnsArray) {
|
||||
|
@ -267,7 +268,7 @@ class Page {
|
|||
|
||||
|
||||
|
||||
public function json($returnsArray=false)
|
||||
public function json($returnsArray = false)
|
||||
{
|
||||
$tmp['key'] = $this->key();
|
||||
$tmp['title'] = $this->title();
|
||||
|
@ -297,7 +298,7 @@ class Page {
|
|||
// Returns the endpoint of the coverimage, FALSE if the page doesn't have a cover image
|
||||
// (boolean) $absolute, TRUE returns the complete URL, FALSE returns the filename
|
||||
// If the user defined an external cover image the function returns it
|
||||
public function coverImage($absolute=true)
|
||||
public function coverImage($absolute = true)
|
||||
{
|
||||
$filename = $this->getValue('coverImage');
|
||||
if (empty($filename)) {
|
||||
|
@ -311,9 +312,9 @@ class Page {
|
|||
|
||||
if ($absolute) {
|
||||
if (IMAGE_RESTRICT) {
|
||||
return DOMAIN_UPLOADS_PAGES.$this->uuid().'/'.$filename;
|
||||
return DOMAIN_UPLOADS_PAGES . $this->uuid() . '/' . $filename;
|
||||
}
|
||||
return DOMAIN_UPLOADS.$filename;
|
||||
return DOMAIN_UPLOADS . $filename;
|
||||
}
|
||||
|
||||
return $filename;
|
||||
|
@ -323,7 +324,7 @@ class Page {
|
|||
public function thumbCoverImage()
|
||||
{
|
||||
$filename = $this->coverImage(false);
|
||||
if ($filename==false) {
|
||||
if ($filename == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -333,9 +334,9 @@ class Page {
|
|||
}
|
||||
|
||||
if (IMAGE_RESTRICT) {
|
||||
return DOMAIN_UPLOADS_PAGES.$this->uuid().'/thumbnails/'.$filename;
|
||||
return DOMAIN_UPLOADS_PAGES . $this->uuid() . '/thumbnails/' . $filename;
|
||||
}
|
||||
return DOMAIN_UPLOADS_THUMBNAILS.$filename;
|
||||
return DOMAIN_UPLOADS_THUMBNAILS . $filename;
|
||||
}
|
||||
|
||||
// Returns TRUE if the content has the text splited
|
||||
|
@ -359,37 +360,37 @@ class Page {
|
|||
// (boolean) Returns TRUE if the page is published, FALSE otherwise
|
||||
public function published()
|
||||
{
|
||||
return ($this->getValue('type')==='published');
|
||||
return ($this->getValue('type') === 'published');
|
||||
}
|
||||
|
||||
// (boolean) Returns TRUE if the page is scheduled, FALSE otherwise
|
||||
public function scheduled()
|
||||
{
|
||||
return ($this->getValue('type')==='scheduled');
|
||||
return ($this->getValue('type') === 'scheduled');
|
||||
}
|
||||
|
||||
// (boolean) Returns TRUE if the page is draft, FALSE otherwise
|
||||
public function draft()
|
||||
{
|
||||
return ($this->getValue('type')=='draft');
|
||||
return ($this->getValue('type') == 'draft');
|
||||
}
|
||||
|
||||
// (boolean) Returns TRUE if the page is autosave, FALSE otherwise
|
||||
public function autosave()
|
||||
{
|
||||
return ($this->getValue('type')=='autosave');
|
||||
return ($this->getValue('type') == 'autosave');
|
||||
}
|
||||
|
||||
// (boolean) Returns TRUE if the page is sticky, FALSE otherwise
|
||||
public function sticky()
|
||||
{
|
||||
return ($this->getValue('type')=='sticky');
|
||||
return ($this->getValue('type') == 'sticky');
|
||||
}
|
||||
|
||||
// (boolean) Returns TRUE if the page is static, FALSE otherwise
|
||||
public function isStatic()
|
||||
{
|
||||
return ($this->getValue('type')=='static');
|
||||
return ($this->getValue('type') == 'static');
|
||||
}
|
||||
|
||||
// (string) Returns type of the page
|
||||
|
@ -460,7 +461,7 @@ class Page {
|
|||
// Returns TRUE if the page is a parent, has or not children
|
||||
public function isParent()
|
||||
{
|
||||
return $this->parentKey()===false;
|
||||
return $this->parentKey() === false;
|
||||
}
|
||||
|
||||
// Returns the parent method output, if the page doesn't have a parent returns FALSE
|
||||
|
@ -482,7 +483,7 @@ class Page {
|
|||
// Returns TRUE if the page is a child, FALSE otherwise
|
||||
public function isChild()
|
||||
{
|
||||
return $this->parentKey()!==false;
|
||||
return $this->parentKey() !== false;
|
||||
}
|
||||
|
||||
// Returns TRUE if the page has children
|
||||
|
@ -519,7 +520,8 @@ class Page {
|
|||
}
|
||||
|
||||
// Returns the amount of minutes takes to read the page
|
||||
public function readingTime() {
|
||||
public function readingTime()
|
||||
{
|
||||
global $L;
|
||||
|
||||
$words = $this->content(true);
|
||||
|
@ -528,11 +530,11 @@ class Page {
|
|||
$average = $words / 200;
|
||||
$minutes = round($average);
|
||||
|
||||
if ($minutes>1) {
|
||||
return $minutes.' '.$L->get('minutes');
|
||||
if ($minutes > 1) {
|
||||
return $minutes . ' ' . $L->get('minutes');
|
||||
}
|
||||
|
||||
return '~1 '.$L->get('minute');
|
||||
return '~1 ' . $L->get('minute');
|
||||
}
|
||||
|
||||
// Returns relative time (e.g. "1 minute ago")
|
||||
|
@ -540,42 +542,50 @@ class Page {
|
|||
// Modified for Bludit
|
||||
// $complete = false : short version
|
||||
// $complete = true : full version
|
||||
public function relativeTime($complete = false) {
|
||||
$current = new DateTime;
|
||||
$past = new DateTime($this->getValue('dateRaw'));
|
||||
$elapsed = $current->diff($past);
|
||||
public function relativeTime($complete = false)
|
||||
{
|
||||
$current = new DateTime;
|
||||
$past = new DateTime($this->getValue('dateRaw'));
|
||||
$elapsed = $current->diff($past);
|
||||
|
||||
// Calculate weeks separately
|
||||
$weeks = floor($elapsed->d / 7);
|
||||
$elapsed->d -= $weeks * 7;
|
||||
|
||||
$string = array(
|
||||
'y' => 'year',
|
||||
'm' => 'month',
|
||||
'w' => $weeks,
|
||||
'd' => 'day',
|
||||
'h' => 'hour',
|
||||
'i' => 'minute',
|
||||
's' => 'second',
|
||||
);
|
||||
|
||||
$elapsed->w = floor($elapsed->d / 7);
|
||||
$elapsed->d -= $elapsed->w * 7;
|
||||
|
||||
$string = array(
|
||||
'y' => 'year',
|
||||
'm' => 'month',
|
||||
'w' => 'week',
|
||||
'd' => 'day',
|
||||
'h' => 'hour',
|
||||
'i' => 'minute',
|
||||
's' => 'second',
|
||||
);
|
||||
|
||||
foreach($string as $key => &$value) {
|
||||
if($elapsed->$key) {
|
||||
$value = $elapsed->$key . ' ' . $value . ($elapsed->$key > 1 ? 's' : ' ');
|
||||
} else {
|
||||
unset($string[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if(!$complete) {
|
||||
$string = array_slice($string, 0 , 1);
|
||||
}
|
||||
|
||||
return $string ? implode(', ', $string) . ' ago' : 'Just now';
|
||||
}
|
||||
foreach ($string as $key => &$value) {
|
||||
if ($key == 'w') {
|
||||
if ($weeks > 0) {
|
||||
$value = $weeks . ' week' . ($weeks > 1 ? 's' : '');
|
||||
} else {
|
||||
unset($string[$key]);
|
||||
}
|
||||
} elseif ($elapsed->$key) {
|
||||
$value = $elapsed->$key . ' ' . $value . ($elapsed->$key > 1 ? 's' : '');
|
||||
} else {
|
||||
unset($string[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$complete) {
|
||||
$string = array_slice($string, 0, 1);
|
||||
}
|
||||
|
||||
return $string ? implode(', ', $string) . ' ago' : 'Just now';
|
||||
}
|
||||
|
||||
// Returns the value from the field, false if the fields doesn't exists
|
||||
// If you set the $option as TRUE, the function returns an array with all the values of the field
|
||||
public function custom($field, $options=false)
|
||||
public function custom($field, $options = false)
|
||||
{
|
||||
if (isset($this->vars['custom'][$field])) {
|
||||
if ($options) {
|
||||
|
@ -588,14 +598,17 @@ class Page {
|
|||
|
||||
// Returns an array with all pages key related to the page
|
||||
// The relation is based on the tags
|
||||
public function related() {
|
||||
public function related()
|
||||
{
|
||||
global $tags;
|
||||
$pageTags = $this->tags(true);
|
||||
$list = array();
|
||||
// For each tag get the list of related pages
|
||||
foreach ($pageTags as $tagKey=>$tagName) {
|
||||
foreach ($pageTags as $tagKey => $tagName) {
|
||||
$pagesRelated = $tags->getList($tagKey, 1, -1);
|
||||
$list = array_merge($list, $pagesRelated);
|
||||
if (is_array($pagesRelated)) {
|
||||
$list = array_merge($list, $pagesRelated);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove duplicates
|
||||
|
|
|
@ -1,54 +1,56 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
class Site extends dbJSON {
|
||||
class Site extends dbJSON
|
||||
{
|
||||
public $dbFields = array(
|
||||
'title'=> 'I am Guybrush Threepwood, mighty developer',
|
||||
'slogan'=> '',
|
||||
'description'=> '',
|
||||
'footer'=> 'I wanna be a pirate!',
|
||||
'itemsPerPage'=> 6,
|
||||
'language'=> 'en',
|
||||
'locale'=> 'en, en_US, en_AU, en_CA, en_GB, en_IE, en_NZ',
|
||||
'timezone'=> 'America/Argentina/Buenos_Aires',
|
||||
'theme'=> 'alternative',
|
||||
'adminTheme'=> 'booty',
|
||||
'homepage'=> '',
|
||||
'pageNotFound'=> '',
|
||||
'uriPage'=> '/',
|
||||
'uriTag'=> '/tag/',
|
||||
'uriCategory'=> '/category/',
|
||||
'uriBlog'=> '/blog/',
|
||||
'url'=> '',
|
||||
'emailFrom'=> '',
|
||||
'dateFormat'=> 'F j, Y',
|
||||
'timeFormat'=> 'g:i a',
|
||||
'currentBuild'=> 0,
|
||||
'twitter'=> '',
|
||||
'facebook'=> '',
|
||||
'codepen'=> '',
|
||||
'instagram'=> '',
|
||||
'github'=> '',
|
||||
'gitlab'=> '',
|
||||
'linkedin'=> '',
|
||||
'xing'=> '',
|
||||
'mastodon'=> '',
|
||||
'dribbble'=> '',
|
||||
'vk'=> '',
|
||||
'orderBy'=> 'date', // date or position
|
||||
'extremeFriendly'=> true,
|
||||
'autosaveInterval'=> 2, // minutes
|
||||
'titleFormatHomepage'=> '{{site-slogan}} | {{site-title}}',
|
||||
'titleFormatPages'=> '{{page-title}} | {{site-title}}',
|
||||
'titleFormatCategory'=> '{{category-name}} | {{site-title}}',
|
||||
'titleFormatTag'=> '{{tag-name}} | {{site-title}}',
|
||||
'imageRestrict'=> true,
|
||||
'imageRelativeToAbsolute'=> false,
|
||||
'thumbnailWidth'=> 400, // px
|
||||
'thumbnailHeight'=> 400, // px
|
||||
'thumbnailQuality'=> 100,
|
||||
'logo'=> '',
|
||||
'markdownParser'=> true,
|
||||
'customFields'=> '{}'
|
||||
'title' => 'I am Guybrush Threepwood, mighty developer',
|
||||
'slogan' => '',
|
||||
'description' => '',
|
||||
'footer' => 'I wanna be a pirate!',
|
||||
'itemsPerPage' => 6,
|
||||
'language' => 'en',
|
||||
'locale' => 'en, en_US, en_AU, en_CA, en_GB, en_IE, en_NZ',
|
||||
'timezone' => 'America/Argentina/Buenos_Aires',
|
||||
'theme' => 'alternative',
|
||||
'adminTheme' => 'booty',
|
||||
'homepage' => '',
|
||||
'pageNotFound' => '',
|
||||
'uriPage' => '/',
|
||||
'uriTag' => '/tag/',
|
||||
'uriCategory' => '/category/',
|
||||
'uriBlog' => '/blog/',
|
||||
'url' => '',
|
||||
'emailFrom' => '',
|
||||
'dateFormat' => 'F j, Y',
|
||||
'timeFormat' => 'g:i a',
|
||||
'currentBuild' => 0,
|
||||
'twitter' => '',
|
||||
'facebook' => '',
|
||||
'codepen' => '',
|
||||
'instagram' => '',
|
||||
'github' => '',
|
||||
'gitlab' => '',
|
||||
'linkedin' => '',
|
||||
'xing' => '',
|
||||
'telegram' => '',
|
||||
'mastodon' => '',
|
||||
'dribbble' => '',
|
||||
'vk' => '',
|
||||
'orderBy' => 'date', // date or position
|
||||
'extremeFriendly' => true,
|
||||
'autosaveInterval' => 2, // minutes
|
||||
'titleFormatHomepage' => '{{site-slogan}} | {{site-title}}',
|
||||
'titleFormatPages' => '{{page-title}} | {{site-title}}',
|
||||
'titleFormatCategory' => '{{category-name}} | {{site-title}}',
|
||||
'titleFormatTag' => '{{tag-name}} | {{site-title}}',
|
||||
'imageRestrict' => true,
|
||||
'imageRelativeToAbsolute' => false,
|
||||
'thumbnailWidth' => 400, // px
|
||||
'thumbnailHeight' => 400, // px
|
||||
'thumbnailQuality' => 100,
|
||||
'logo' => '',
|
||||
'markdownParser' => true,
|
||||
'customFields' => '{}'
|
||||
);
|
||||
|
||||
function __construct()
|
||||
|
@ -56,10 +58,10 @@ class Site extends dbJSON {
|
|||
parent::__construct(DB_SITE);
|
||||
|
||||
// Set timezone
|
||||
$this->setTimezone( $this->timezone() );
|
||||
$this->setTimezone($this->timezone());
|
||||
|
||||
// Set locale
|
||||
$this->setLocale( $this->locale() );
|
||||
$this->setLocale($this->locale());
|
||||
}
|
||||
|
||||
// Returns an array with site configuration.
|
||||
|
@ -71,11 +73,14 @@ class Site extends dbJSON {
|
|||
public function set($args)
|
||||
{
|
||||
// Check values on args or set default values
|
||||
foreach ($this->dbFields as $field=>$value) {
|
||||
foreach ($this->dbFields as $field => $value) {
|
||||
if (isset($args[$field])) {
|
||||
$finalValue = Sanitize::html($args[$field]);
|
||||
if ($finalValue==='false') { $finalValue = false; }
|
||||
elseif ($finalValue==='true') { $finalValue = true; }
|
||||
if ($finalValue === 'false') {
|
||||
$finalValue = false;
|
||||
} elseif ($finalValue === 'true') {
|
||||
$finalValue = true;
|
||||
}
|
||||
settype($finalValue, gettype($value));
|
||||
$this->db[$field] = $finalValue;
|
||||
}
|
||||
|
@ -85,9 +90,9 @@ class Site extends dbJSON {
|
|||
|
||||
// Returns an array with the URL filters
|
||||
// Also, you can get the a particular filter
|
||||
public function uriFilters($filter='')
|
||||
public function uriFilters($filter = '')
|
||||
{
|
||||
$filters['admin'] = '/'.ADMIN_URI_FILTER.'/';
|
||||
$filters['admin'] = '/' . ADMIN_URI_FILTER . '/';
|
||||
$filters['page'] = $this->getField('uriPage');
|
||||
$filters['tag'] = $this->getField('uriTag');
|
||||
$filters['category'] = $this->getField('uriCategory');
|
||||
|
@ -110,13 +115,13 @@ class Site extends dbJSON {
|
|||
// DEPRECATED in v3.0, use Theme::rssUrl()
|
||||
public function rss()
|
||||
{
|
||||
return DOMAIN_BASE.'rss.xml';
|
||||
return DOMAIN_BASE . 'rss.xml';
|
||||
}
|
||||
|
||||
// DEPRECATED in v3.0, use Theme::sitemapUrl()
|
||||
public function sitemap()
|
||||
{
|
||||
return DOMAIN_BASE.'sitemap.xml';
|
||||
return DOMAIN_BASE . 'sitemap.xml';
|
||||
}
|
||||
|
||||
public function thumbnailWidth()
|
||||
|
@ -189,6 +194,11 @@ class Site extends dbJSON {
|
|||
return $this->getField('xing');
|
||||
}
|
||||
|
||||
public function telegram()
|
||||
{
|
||||
return $this->getField('telegram');
|
||||
}
|
||||
|
||||
public function mastodon()
|
||||
{
|
||||
return $this->getField('mastodon');
|
||||
|
@ -292,11 +302,11 @@ class Site extends dbJSON {
|
|||
|
||||
// Returns the absolute URL of the site logo
|
||||
// If you set $absolute=false returns only the filename
|
||||
public function logo($absolute=true)
|
||||
public function logo($absolute = true)
|
||||
{
|
||||
$logo = $this->getField('logo');
|
||||
if ($absolute && $logo) {
|
||||
return DOMAIN_UPLOADS.$logo;
|
||||
return DOMAIN_UPLOADS . $logo;
|
||||
}
|
||||
return $logo;
|
||||
}
|
||||
|
@ -313,25 +323,24 @@ class Site extends dbJSON {
|
|||
public function domain()
|
||||
{
|
||||
// If the URL field is not set, try detect the domain.
|
||||
if(Text::isEmpty( $this->url() )) {
|
||||
if(!empty($_SERVER['HTTPS'])) {
|
||||
if (Text::isEmpty($this->url())) {
|
||||
if (!empty($_SERVER['HTTPS'])) {
|
||||
$protocol = 'https://';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$protocol = 'http://';
|
||||
}
|
||||
|
||||
$domain = trim($_SERVER['HTTP_HOST'], '/');
|
||||
return $protocol.$domain;
|
||||
return $protocol . $domain;
|
||||
}
|
||||
|
||||
// Parse the domain from the field url (Settings->Advanced)
|
||||
$parse = parse_url($this->url());
|
||||
$domain = rtrim($parse['host'], '/');
|
||||
$port = !empty($parse['port']) ? ':'.$parse['port'] : '';
|
||||
$scheme = !empty($parse['scheme']) ? $parse['scheme'].'://' : 'http://';
|
||||
$port = !empty($parse['port']) ? ':' . $parse['port'] : '';
|
||||
$scheme = !empty($parse['scheme']) ? $parse['scheme'] . '://' : 'http://';
|
||||
|
||||
return $scheme.$domain.$port;
|
||||
return $scheme . $domain . $port;
|
||||
}
|
||||
|
||||
// Returns the timezone.
|
||||
|
@ -340,17 +349,17 @@ class Site extends dbJSON {
|
|||
return $this->getField('timezone');
|
||||
}
|
||||
|
||||
public function urlPath()
|
||||
{
|
||||
$url = $this->getField('url');
|
||||
return parse_url($url, PHP_URL_PATH);
|
||||
}
|
||||
public function urlPath()
|
||||
{
|
||||
$url = $this->getField('url');
|
||||
return parse_url($url, PHP_URL_PATH);
|
||||
}
|
||||
|
||||
public function isHTTPS()
|
||||
{
|
||||
$url = $this->getField('url');
|
||||
return parse_url($url, PHP_URL_SCHEME) === 'https';
|
||||
}
|
||||
public function isHTTPS()
|
||||
{
|
||||
$url = $this->getField('url');
|
||||
return parse_url($url, PHP_URL_SCHEME) === 'https';
|
||||
}
|
||||
|
||||
// Returns the current build / version of Bludit.
|
||||
public function currentBuild()
|
||||
|
@ -361,7 +370,11 @@ class Site extends dbJSON {
|
|||
// Returns the amount of pages per page
|
||||
public function itemsPerPage()
|
||||
{
|
||||
return $this->getField('itemsPerPage');
|
||||
$value = $this->getField('itemsPerPage');
|
||||
if (($value > 0) or ($value == -1)) {
|
||||
return $value;
|
||||
}
|
||||
return 6;
|
||||
}
|
||||
|
||||
// Returns the current language.
|
||||
|
@ -407,10 +420,9 @@ class Site extends dbJSON {
|
|||
$localeList = explode(',', $locale);
|
||||
foreach ($localeList as $locale) {
|
||||
$locale = trim($locale);
|
||||
if (setlocale(LC_ALL, $locale.'.UTF-8')!==false) {
|
||||
if (setlocale(LC_ALL, $locale . '.UTF-8') !== false) {
|
||||
return true;
|
||||
}
|
||||
elseif (setlocale(LC_ALL, $locale)!==false) {
|
||||
} elseif (setlocale(LC_ALL, $locale) !== false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -431,5 +443,4 @@ class Site extends dbJSON {
|
|||
$customFields = Sanitize::htmlDecode($this->getField('customFields'));
|
||||
return json_decode($customFields, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
class User {
|
||||
class User
|
||||
{
|
||||
protected $vars;
|
||||
|
||||
function __construct($username)
|
||||
|
@ -9,18 +10,18 @@ class User {
|
|||
|
||||
$this->vars['username'] = $username;
|
||||
|
||||
if ($username===false) {
|
||||
if ($username === false) {
|
||||
$row = $users->getDefaultFields();
|
||||
} else {
|
||||
if (Text::isEmpty($username) || !$users->exists($username)) {
|
||||
$errorMessage = 'User not found in the database by username ['.$username.']';
|
||||
Log::set(__METHOD__.LOG_SEP.$errorMessage);
|
||||
$errorMessage = 'User not found in the database by username [' . $username . ']';
|
||||
Log::set(__METHOD__ . LOG_SEP . $errorMessage);
|
||||
throw new Exception($errorMessage);
|
||||
}
|
||||
$row = $users->getUserDB($username);
|
||||
}
|
||||
|
||||
foreach ($row as $field=>$value) {
|
||||
foreach ($row as $field => $value) {
|
||||
$this->setField($field, $value);
|
||||
}
|
||||
}
|
||||
|
@ -145,6 +146,11 @@ class User {
|
|||
return $this->getValue('xing');
|
||||
}
|
||||
|
||||
public function telegram()
|
||||
{
|
||||
return $this->getValue('xing');
|
||||
}
|
||||
|
||||
public function mastodon()
|
||||
{
|
||||
return $this->getValue('mastodon');
|
||||
|
@ -157,14 +163,14 @@ class User {
|
|||
|
||||
public function profilePicture()
|
||||
{
|
||||
$filename = $this->getValue('username').'.png';
|
||||
if (!file_exists(PATH_UPLOADS_PROFILES.$filename)) {
|
||||
$filename = $this->getValue('username') . '.png';
|
||||
if (!file_exists(PATH_UPLOADS_PROFILES . $filename)) {
|
||||
return false;
|
||||
}
|
||||
return DOMAIN_UPLOADS_PROFILES.$filename;
|
||||
return DOMAIN_UPLOADS_PROFILES . $filename;
|
||||
}
|
||||
|
||||
public function json($returnsArray=false)
|
||||
public function json($returnsArray = false)
|
||||
{
|
||||
$tmp['username'] = $this->username();
|
||||
$tmp['firstName'] = $this->firstName();
|
||||
|
@ -179,6 +185,7 @@ class User {
|
|||
$tmp['gitlab'] = $this->gitlab();
|
||||
$tmp['linkedin'] = $this->linkedin();
|
||||
$tmp['xing'] = $this->xing();
|
||||
$tmp['telegram'] = $this->telegram();
|
||||
$tmp['mastodon'] = $this->mastodon();
|
||||
$tmp['vk'] = $this->vk();
|
||||
$tmp['profilePicture'] = $this->profilePicture();
|
||||
|
@ -189,5 +196,4 @@ class User {
|
|||
|
||||
return json_encode($tmp);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
1345
bl-kernel/vendors/bootstrap-icons/bootstrap-icons.css
vendored
Normal file
1345
bl-kernel/vendors/bootstrap-icons/bootstrap-icons.css
vendored
Normal file
File diff suppressed because it is too large
Load diff
1327
bl-kernel/vendors/bootstrap-icons/bootstrap-icons.json
vendored
Normal file
1327
bl-kernel/vendors/bootstrap-icons/bootstrap-icons.json
vendored
Normal file
File diff suppressed because it is too large
Load diff
BIN
bl-kernel/vendors/bootstrap-icons/fonts/bootstrap-icons.woff
vendored
Normal file
BIN
bl-kernel/vendors/bootstrap-icons/fonts/bootstrap-icons.woff
vendored
Normal file
Binary file not shown.
BIN
bl-kernel/vendors/bootstrap-icons/fonts/bootstrap-icons.woff2
vendored
Normal file
BIN
bl-kernel/vendors/bootstrap-icons/fonts/bootstrap-icons.woff2
vendored
Normal file
Binary file not shown.
|
@ -183,7 +183,7 @@
|
|||
"you-can-change-this-field-when-save-the-current-changes": "You can change this field when you save the current changes.",
|
||||
"items-per-page": "Items per page",
|
||||
"invite-a-friend-to-collaborate-on-your-site": "Invite a friend to collaborate on your site",
|
||||
"number-of-items-to-show-per-page": "Number of items to show per page.",
|
||||
"number-of-items-to-show-per-page": "Number of items to show per page, -1 means all items.",
|
||||
"website-or-blog": "Website or Blog",
|
||||
"order-content-by": "Order content by",
|
||||
"edit-or-delete-content-from-your-site": "Edit or delete content from your site",
|
||||
|
|
397
bl-languages/lt.json
Normal file
397
bl-languages/lt.json
Normal file
|
@ -0,0 +1,397 @@
|
|||
{
|
||||
"language-data": {
|
||||
"native": "Lietuvių",
|
||||
"english-name": "Lithuanian",
|
||||
"locale": "lt, lt_LT",
|
||||
"last-update": "2024-07-19",
|
||||
"authors": [
|
||||
"Kristupas Grigas @kurisotofaa purelypost.com",
|
||||
"",
|
||||
"",
|
||||
""
|
||||
]
|
||||
},
|
||||
"dates": {
|
||||
"Mon": "P",
|
||||
"Tue": "A",
|
||||
"Wed": "T",
|
||||
"Thu": "K",
|
||||
"Fri": "Pn",
|
||||
"Sat": "Š",
|
||||
"Sun": "S",
|
||||
"Monday": "Pirmadienis",
|
||||
"Tuesday": "Antradienis",
|
||||
"Wednesday": "Trečiadienis",
|
||||
"Thursday": "Ketvirtadienis",
|
||||
"Friday": "Penktadienis",
|
||||
"Saturday": "Šeštadienis",
|
||||
"Sunday": "Sekmadienis",
|
||||
"Jan": "Sau",
|
||||
"Feb": "Vas",
|
||||
"Mar": "Kov",
|
||||
"Apr": "Bal",
|
||||
"Jun": "Bir",
|
||||
"Jul": "Lie",
|
||||
"Aug": "Rgp",
|
||||
"Sep": "Rgs",
|
||||
"Oct": "Spa",
|
||||
"Nov": "Lap",
|
||||
"Dec": "Gru",
|
||||
"January": "Sausis",
|
||||
"February": "Vasaris",
|
||||
"March": "Kovas",
|
||||
"April": "Balandis",
|
||||
"May": "Gegužė",
|
||||
"June": "Birželis",
|
||||
"July": "Liepa",
|
||||
"August": "Rugpjūtis",
|
||||
"September": "Rugsėjis",
|
||||
"October": "Spalis",
|
||||
"November": "Lapkritis",
|
||||
"December": "Gruodis"
|
||||
},
|
||||
"dashboard": "prietaisų skydelis",
|
||||
"manage-users": "Valdyti naudotojus",
|
||||
"manage-categories": "Valdyti kategorijas",
|
||||
"general-settings": "bendrieji nustatymai",
|
||||
"advanced-settings": "išplėstiniai nustatymai",
|
||||
"thanks-for-supporting-bludit": "Ačiū, kad palaikote Bludit",
|
||||
"upgrade-to-bludit-pro": "Atnaujinti į Bludit PRO",
|
||||
"language": "Kalba",
|
||||
"plugin": "Įskiepis",
|
||||
"plugins": "Įskiepiai",
|
||||
"developers": "Kūrėjai",
|
||||
"themes": "Temos",
|
||||
"about": "Apie",
|
||||
"url": "URL",
|
||||
"welcome": "Sveiki atvykę",
|
||||
"logout": "Atsijungti",
|
||||
"website": "Svetainė",
|
||||
"publish": "Paskelbti",
|
||||
"manage": "Valdyti",
|
||||
"content": "Turinys",
|
||||
"category": "Kategorija",
|
||||
"categories": "Kategorijos",
|
||||
"users": "Naudotojai",
|
||||
"settings": "Settings",
|
||||
"general": "Bendrieji",
|
||||
"advanced": "Išplėstinai",
|
||||
"new-content": "Naujas turinys",
|
||||
"manage-content": "Valdyti turinį",
|
||||
"add-new-content": "Pridėti naujo turinio",
|
||||
"new-category": "Nauja kategorija",
|
||||
"you-do-not-have-sufficient-permissions": "Neturite pakankamų leidimų",
|
||||
"add-a-new-user": "Pridėti naują naudotoją",
|
||||
"url-associated-with-the-content": "su turiniu susietas URL adresas.",
|
||||
"language-and-timezone": "Kalba ir laiko zona",
|
||||
"change-your-language-and-region-settings": "Pakeisk tavo kalbą ir regiono nustatymus",
|
||||
"notifications": "Pranešimai",
|
||||
"plugin-activated": "Įskiepis aktyvuotas",
|
||||
"plugin-deactivated": "Įskiepis išjungtas",
|
||||
"new-theme-configured": "Nauja tema sukonfiguruota",
|
||||
"settings-changes": "Nustatymų keitimai",
|
||||
"plugin-configured": "Įskiepis sukonfiguruotas",
|
||||
"welcome-to-bludit": "Sveiki atvykę į Bludit",
|
||||
"statistics": "Statistikos",
|
||||
"drafts": "Juodraščiai",
|
||||
"title": "Antraštė",
|
||||
"save": "Išsaugoti",
|
||||
"save-as-draft": "Išsaugoti kaip juodraštį",
|
||||
"cancel": "Atšaukti",
|
||||
"description": "Aprašymas",
|
||||
"this-field-can-help-describe-the-content": "Šis laukas gali padėti keliais žodžiais apibūdinti turinį.",
|
||||
"images": "Nuotraukos",
|
||||
"error": "Klaida",
|
||||
"supported-image-file-types": "Palaikomi nuotraukų failų tipai",
|
||||
"cover-image": "Viršelio vaizdas",
|
||||
"drag-and-drop-or-click-here": "Vilkite ir nuleiskite arba spustelėkite čia",
|
||||
"there-are-no-images": "Nėra nuotraukų",
|
||||
"upload-and-more-images": "Įkėlimas ir daugiau nuotraukų",
|
||||
"click-on-the-image-for-options": "Spustelėkite paveikslėlį, kad pamatytumėte parinktis.",
|
||||
"click-here-to-cancel": "Spustelėkite čia ir atšaukite",
|
||||
"insert-image": "Įterpti nuotrauką",
|
||||
"set-as-cover-image": "Nustatyti kaip viršelio vaizdą",
|
||||
"delete-image": "Ištrinti nuotrauką",
|
||||
"tags": "Žymės",
|
||||
"add": "Pridėti",
|
||||
"status": "Statusas",
|
||||
"published": "Paskelbta",
|
||||
"draft": "Juodraštis",
|
||||
"empty-title": "Tuščia antraštė",
|
||||
"empty": "tuščia",
|
||||
"date": "Data",
|
||||
"external-cover-image": "Išorinis viršelio vaizdas",
|
||||
"parent": "Pagrindinis",
|
||||
"full-image-url": "Pilnas nuotraukos URL adresas.",
|
||||
"this-field-is-used-when-you-order-the-content-by-position": "Šis laukas naudojamas, kai turinį rikiuojate pagal poziciją.",
|
||||
"position": "Pozicija",
|
||||
"friendly-url": "Draugiškas URL adresas",
|
||||
"image-description": "Nuotraukos aprašymas",
|
||||
"add-a-new-category": "Pridėti naują kategoriją",
|
||||
"name": "Vardas",
|
||||
"username": "Prisijungimo vardas",
|
||||
"first-name": "Pirmas Vardas",
|
||||
"last-name": "Pavardė",
|
||||
"to-schedule-the-content-select-the-date-and-time": "Norėdami suplanuoti turinį, pasirinkite datą ir laiką, būseną reikia nustatyti į \"paskelbta\".",
|
||||
"email": "El. Paštas",
|
||||
"role": "Rolė",
|
||||
"registered": "Prisiregistruota",
|
||||
"site-information": "Svetainės informacija",
|
||||
"site-title": "Svetainės antraštė",
|
||||
"use-this-field-to-name-your-site": "Naudokite šį lauką svetainei pavadinti.",
|
||||
"site-slogan": "Svetainės šūkis",
|
||||
"use-this-field-to-add-a-catchy-phrase": "Šį lauką naudokite norėdami į svetainę įtraukti patrauklią frazę.",
|
||||
"site-description": "Svetainės aprašymas",
|
||||
"you-can-add-a-site-description-to-provide": "Šį lauką naudokite norėdami į svetainę įtraukti patrauklią frazę.",
|
||||
"footer-text": "Tekstas apačioje",
|
||||
"you-can-add-a-small-text-on-the-bottom": "Kiekvieno puslapio apačioje galite pridėti nedidelį tekstą, pvz., autorių teises, savininką, datas ir pan.",
|
||||
"social-networks-links": "Socialinių tinklų nuorodos",
|
||||
"site-url": "Svetainės URL adresas",
|
||||
"email-account-settings": "El. pašto paskyros nustatymai",
|
||||
"sender-email": "Siuntėjo el. paštas",
|
||||
"emails-will-be-sent-from-this-address": "El. laiškai bus sunčiami iš šio adreso",
|
||||
"url-filters": "URL adreso filtrai",
|
||||
"select-your-sites-language": "Pasirinkite jūsų svetainės kalbą",
|
||||
"timezone": "Laiko zona",
|
||||
"select-a-timezone-for-a-correct": "Pasirinkite laiko zona teisingąi datai\/laiko parodymui jūsų svetainėje.",
|
||||
"locale": "Vietovė",
|
||||
"date-and-time-formats": "Datos ir laiko formatai",
|
||||
"date-format": "Datos formatas",
|
||||
"current-format": "Dabartinis formatas",
|
||||
"version": "Versija",
|
||||
"author": "Autorius",
|
||||
"activate": "Aktyvuoti",
|
||||
"deactivate": "Išjungti",
|
||||
"edit-category": "Pakeisti kategoriją",
|
||||
"delete": "Ištrinti",
|
||||
"password": "Slaptažodis",
|
||||
"confirm-password": "Patvirtinti slaptažodį",
|
||||
"editor": "Redaktorius",
|
||||
"administrator": "Administratorius",
|
||||
"edit-user": "Pakeisti naudotoją",
|
||||
"edit-content": "Pakeisti turinį",
|
||||
"profile": "Profilis",
|
||||
"change-password": "Pakeisti slaptažodį",
|
||||
"enabled": "Įjungtas",
|
||||
"disable-the-user": "Išjungti naudotoją",
|
||||
"profile-picture": "Profilio nuotrauką",
|
||||
"edit-or-delete-your-categories": "Pakeisti ar ištrinti jūsų kategorijas",
|
||||
"create-a-new-category-to-organize-your-content": "Sukurti naują kategoriją tūrinio organizavimui",
|
||||
"confirm-delete-this-action-cannot-be-undone": "Patvirtinkite ištrynimą, šio veiksmo atšaukti negalima.",
|
||||
"do-you-want-to-disable-the-user": "Ar norite išjungti naudotoją ?",
|
||||
"new-password": "Naujas slaptažodis",
|
||||
"you-can-change-this-field-when-save-the-current-changes": "Šį lauką galite pakeisti, kai išsaugosite esamus pakeitimus.",
|
||||
"items-per-page": "Elementai per puslapį",
|
||||
"invite-a-friend-to-collaborate-on-your-site": "Pakvieskite draugą bendradarbiauti savo svetainėje",
|
||||
"number-of-items-to-show-per-page": "Viename puslapyje rodomų elementų skaičius, -1 reiškia visus elementus.",
|
||||
"website-or-blog": "Svetainė ar tinklaraštis",
|
||||
"order-content-by": "Rikiuoti turinį pagal",
|
||||
"edit-or-delete-content-from-your-site": "Redaguokite arba ištrinkite svetainės turinį",
|
||||
"order-the-content-by-date-to-build-a-blog": "Jei norite sukurti tinklaraštį, sudėliokite turinį pagal datą, o jei norite sukurti svetainę, sudėliokite turinį pagal poziciją.",
|
||||
"page-not-found-content": "Atrodo, kad šis puslapis neegzistuoja.",
|
||||
"page-not-found": "Puslapis nerastas",
|
||||
"predefined-pages": "Iš anksto nustatyti puslapiai",
|
||||
"returning-page-when-the-page-doesnt-exist": "Puslapio grąžinimas, kai puslapis neegzistuoja, pagal numatytuosius nustatymus grąžinamas numatytasis pranešimas.",
|
||||
"returning-page-for-the-main-page": "Pagal numatytuosius nustatymus pagrindiniame puslapyje rodomas naujausio turinio eiliškumas pagal datą arba poziciją.",
|
||||
"full-url-of-your-site": "Pilnas jūsų svetainės URL adresas. Nurodykite HTTP arba HTTPS protokolą (tik jei serveryje įjungėte SSL).",
|
||||
"with-the-locales-you-can-set-the-regional-user-interface": "Naudodami vietines sąsajas galite nustatyti regioninę naudotojo sąsają, pvz., datas savo kalba. Vietovės turi būti įdiegtos jūsų sistemoje.",
|
||||
"bludit-installer": "Bludit Instaliuotojas",
|
||||
"choose-your-language": "Pasirinkite kalbą",
|
||||
"next": "Toliau",
|
||||
"complete-the-form-choose-a-password-for-the-username-admin": "Pabaik formą, pasirink slaptažodį naudotojo vardui <b>< admin ><\/b>",
|
||||
"show-password": "Parodyti slaptažodį",
|
||||
"install": "Instaliuoti",
|
||||
"login": "Prisijungti",
|
||||
"back-to-login-form": "Grįžti į prisijungimo formą",
|
||||
"get-login-access-code": "Gaukite prisijungimo prieigos kodą",
|
||||
"email-access-code": "El. pašto prieigos kodas",
|
||||
"whats-next": "Kas toliau",
|
||||
"username-or-password-incorrect": "Prisijungimo vardas ar slaptažodis neteisingas",
|
||||
"follow-bludit-on": "Sekite Bludit",
|
||||
"this-is-a-brief-description-of-yourself-our-your-site": "Tai trumpas jūsų arba jūsų svetainės aprašymas, norėdami pakeisti šį tekstą, eikite į administratoriaus skydelį, nustatymus, įskiepius ir sukonfigūruokite įskiepį \"apie\".",
|
||||
"new-version-available": "Nauja versija pasiekiama",
|
||||
"new-category-created": "Nauja kategorija sukurta",
|
||||
"category-deleted": "Kategorija ištrinta",
|
||||
"category-edited": "Kategorija redaguota",
|
||||
"new-user-created": "Naujas naudotojas sukurtas",
|
||||
"user-edited": "Naudotojas redaguotas",
|
||||
"user-deleted": "Naudotojas ištrintas",
|
||||
"recommended-for-recovery-password-and-notifications": "Rekomenduojama naudoti slaptažodžio atkūrimui ir pranešimams.",
|
||||
"authentication-token": "Autentifikavimo žetonas",
|
||||
"token": "Žetonas",
|
||||
"current-status": "Dabartinis statusas",
|
||||
"upload-image": "Įkelti nuotrauką",
|
||||
"the-changes-have-been-saved": "Pakeitimai išsaugoti",
|
||||
"label": "Etiketė",
|
||||
"links": "Nuorodos",
|
||||
"this-title-is-almost-always-used-in-the-sidebar-of-the-site": "Šis pavadinimas beveik visada naudojamas svetainės šoninėje juostoje.",
|
||||
"password-must-be-at-least-6-characters-long": "Slaptažodis turi būti bent 6 simbolių ilgio",
|
||||
"ip-address-has-been-blocked": "IP addresas užblokuotas",
|
||||
"try-again-in-a-few-minutes": "Pabandykite už kelių minučių",
|
||||
"content-published-from-scheduler": "Iš tvarkaraščio sudarytojo skelbiamas turinys",
|
||||
"blog": "Tinklaraštis",
|
||||
"complete-all-fields": "Užpildykite visus laukelius",
|
||||
"static": "Statinis",
|
||||
"about-your-site-or-yourself": "Apie svetainę arba jus",
|
||||
"homepage": "Pagrindinis puslapis",
|
||||
"disabled": "Išjungta",
|
||||
"to-enable-the-user-you-must-set-a-new-password": "Norėdami įjungti naudotoją, turite nustatyti naują slaptažodį.",
|
||||
"delete-the-user-and-associate-his-content-to-admin-user": "Ištrinkite naudotoją ir susiekite jo turinį su administratoriaus naudotoju",
|
||||
"delete-the-user-and-all-his-content": "Ištrinkite naudotoją ir visą jo turinį",
|
||||
"user-disabled": "Naudotojas išjungtas",
|
||||
"user-password-changed": "Naudotojo slaptažodis pakeistas",
|
||||
"the-password-and-confirmation-password-do-not-match": "Nesutampa slaptažodis ir patvirtinimo slaptažodis",
|
||||
"scheduled-content": "Suplanuotas turinys",
|
||||
"there-are-no-scheduled-content": "Nėra suplanuoto turinio",
|
||||
"new-content-created": "Naujas turinys sukurtas",
|
||||
"content-edited": "Turinys redaguotas",
|
||||
"content-deleted": "Turinys ištrintas",
|
||||
"undefined": "Neapibrėžta",
|
||||
"create-new-content-for-your-site": "Sukurkite naujo turinio jūsų svetainei",
|
||||
"order-items-by": "Rušiuoti elementus pagal",
|
||||
"all-content": "Visas turinys",
|
||||
"dynamic": "Dinaminis",
|
||||
"type": "Tipas",
|
||||
"draft-content": "Juodraštinis turinys",
|
||||
"post": "Paštas",
|
||||
"default": "Numatytasis",
|
||||
"latest-content": "Naujausias turinys",
|
||||
"default-message": "Numatyta žinutė",
|
||||
"no-parent": "Jokio pagrindo",
|
||||
"have-you-seen-my-ball": "Matei mano kamuolį?",
|
||||
"pagebreak": "Puslapio pertrauka",
|
||||
"pages": "Puslapiai",
|
||||
"this-plugin-may-not-be-supported-by-this-version-of-bludit": "Šis įskiepis gali būti nepalaikomas šios Bludit versijos",
|
||||
"previous": "Praeitas",
|
||||
"previous-page": "Praeitas puslapis",
|
||||
"next-page": "Kitas puslapis",
|
||||
"scheduled": "Suplanuota",
|
||||
"this-token-is-similar-to-a-password-it-should-not-be-shared": "Šis žetonas yra panašus į slaptažodį, juo neturėtų būti dalijamasi.",
|
||||
"congratulations-you-have-successfully-installed-your-bludit": "Sveikinimai, jūs instaliavote savo Bludit",
|
||||
"this-theme-may-not-be-supported-by-this-version-of-bludit": "Ši tema gali būti nepalaikoma šios Bludit versijos",
|
||||
"read-more": "Skaityti daugiau",
|
||||
"remember-me": "Prisiminti mane",
|
||||
"plugins-position": "Įskepio pozicija",
|
||||
"plugins-sorted": "Surušiuoti įskiepiai",
|
||||
"plugins-position-changed": "Įskiepio pozicija pakeista",
|
||||
"drag-and-drop-to-set-the-position-of-the-plugin": "Vilkite ir nuleiskite, kad nustatytumėte įskiepių poziciją",
|
||||
"change-the-position-of-the-plugins": "Pakeisti įskiepių poziciją",
|
||||
"reading-time": "Skaitymo laikas",
|
||||
"minutes": "Minučių",
|
||||
"minute": "Minutė",
|
||||
"example-page-1-slug": "sukurk-tavo-turini",
|
||||
"example-page-1-title": "Sukurk tavo turinį",
|
||||
"example-page-1-content": "Pradėkite rašyti savo turinį arba redaguokite esamą, kad jis atitiktų jūsų poreikius. Norėdami sukurti, redaguoti ar pašalinti turinį, turite prisijungti prie <a href=\".\/admin\/\">administratoriaus skydelio<\/a> su vartotojo vardu `admin` ir slaptažodžiu, kurį nustatėte diegimo metu.",
|
||||
"example-page-2-slug": "konfiguruok-tavo-svetaine",
|
||||
"example-page-2-title": "Konfiguruok tavo svetainę",
|
||||
"example-page-2-content": "Atnaujinkite svetainės nustatymus iš <a href=\".\/admin\/\">administratoriaus skydelio<\/a>, pavadinimą, aprašymą ir socialinius tinklus galite pakeisti iš <a href=\".\/admin\/settings\">Nustatymai > Bendrieji<\/a>.",
|
||||
"example-page-3-slug": "sekite-bludit",
|
||||
"example-page-3-title": "Sekite Bludit",
|
||||
"example-page-3-content": "Gaukite informaciją apie naujienas, naujus leidinius, naujas temas ar naujus įskiepius mūsų socialiniuose tinkluose <a href=\"https:\/\/www.facebook.com\/bluditcms\/\" target=\"_blank\">Facebook<\/a>, <a href=\"https:\/\/www.twitter.com\/bludit\/\" target=\"_blank\">Twitter<\/a> and <a href=\"https:\/\/www.youtube.com\/c\/Bluditcms\" target=\"_blank\">YouTube<\/a> arba apsilankykite mūsų <a href=\"https:\/\/blog.bludit.com\" target=\"_blank\">Tinklaraštyje<\/a>.",
|
||||
"example-page-4-slug": "apie",
|
||||
"example-page-4-title": "Apie",
|
||||
"example-page-4-content": "Puslapis „Apie“ paprastai yra vienas iš labiausiai lankomų jūsų svetainės puslapių, jis turi būti paprastas, jame turi būti keli pagrindiniai dalykai, pvz., jūsų vardas ir pavardė, kas esate, kaip su jumis susisiekti, nedidelė istorija ir pan.",
|
||||
"the-extension-zip-is-not-installed": "Zip plėtinys nėra įdiegtas, norėdami naudoti šį įskiepį, turite įdiegti plėtinį.",
|
||||
"there-are-no-sticky-pages-at-this-moment": "Šiuo metu lipnių puslapių nėra.",
|
||||
"there-are-no-scheduled-pages-at-this-moment": "Šiuo metu nėra suplanuotų puslapių.",
|
||||
"update": "Atnaujinimas",
|
||||
"template": "Šablonas",
|
||||
"nickname": "Slapyvardis",
|
||||
"disable-user": "Išjungti naudotoją",
|
||||
"delete-user-and-keep-content": "Ištrinti naudotoją ir palikti turinį",
|
||||
"delete-user-and-delete-content": "Ištrinti naudotoją ir ištrinti turinį (Įspėjimas)",
|
||||
"social-networks": "Socialiniai tinklai",
|
||||
"interval": "Laikotarpis",
|
||||
"number-in-minutes-for-every-execution-of-autosave": "Kiekvieno automatinio išsaugojimo vykdymo skaičius minutėmis.",
|
||||
"extreme-friendly-url": "Ekstremalus draugiškas URL",
|
||||
"title-formats": "Pavadinimo formatai",
|
||||
"delete-content": "Ištrinti turinį",
|
||||
"are-you-sure-you-want-to-delete-this-page": "Ar tikrai norite ištrinti šį puslapį?",
|
||||
"sticky": "Lipnus",
|
||||
"actions": "Veiksmai",
|
||||
"edit": "Redaguoti",
|
||||
"options": "Pasirinkimai",
|
||||
"enter-title": "Įvesti pavadinimą",
|
||||
"media-manager": "Vaizdų valdymas",
|
||||
"set-a-cover-image-from-external-url,-such-as-a-cdn-or-some-server-dedicated-for-images": "Nustatykite viršelio paveikslėlį iš išorinio URL adreso, pvz., CDN arba kokio nors vaizdams skirto serverio.",
|
||||
"user": "Naudotojas",
|
||||
"date-format-format": "Datos formatas: <code>MMMM-MėnMėn-DD Valandos:Minutės:Sekundės<\/code>",
|
||||
"start-typing-a-page-title-to-see-a-list-of-suggestions": "Pradėkite rašyti puslapio pavadinimą ir pamatysite pasiūlymų sąrašą.",
|
||||
"field-used-when-ordering-content-by-position": "Laukas, naudojamas rušiuojant turinį pagal poziciją.",
|
||||
"write-a-template-name-to-filter-the-page-in-the-theme-and-change-the-style-of-the-page": "Įrašykite šablono pavadinimą, kad filtruotumėte puslapį temoje ir pakeistumėte puslapio stilių.",
|
||||
"write-the-tags-separated-by-commas": "Įrašykite kableliais atskirtas žymas.",
|
||||
"apply-code-noindex-code-to-this-page": "Taikyti <code>noindex<\/code> šiam puslapiui.",
|
||||
"this-tells-search-engines-not-to-show-this-page-in-their-search-results": "Tai nurodo paieškos sistemoms nerodyti šio puslapio paieškos rezultatuose.",
|
||||
"apply-code-nofollow-code-to-this-page": "Taikyti <code>nofollow<\/code> šiam puslapiui.",
|
||||
"this-tells-search-engines-not-to-follow-links-on-this-page": "Tai nurodo paieškos sistemoms nesekti šio puslapio nuorodų.",
|
||||
"apply-code-noarchive-code-to-this-page": "Taikyti <code>noarchive<\/code> šiam puslapiui.",
|
||||
"this-tells-search-engines-not-to-save-a-cached-copy-of-this-page": "Tai nurodo paieškos sistemoms nesaugoti šio puslapio spartinančiosios kopijos.",
|
||||
"uncategorized": "Be kategorijos",
|
||||
"done": "Baigta",
|
||||
"delete-category": "Delete category",
|
||||
"are-you-sure-you-want-to-delete-this-category?": "Ar tikrai norite ištrinti šią kategoriją?",
|
||||
"confirm-new-password": "Patvirtinti naują slaptažodį",
|
||||
"the-nickname-is-almost-used-in-the-themes-to-display-the-author-of-the-content": "Slapyvardis beveik naudojamas temose turinio autoriui rodyti",
|
||||
"allow-unicode": "Leisti Unicode",
|
||||
"allow-unicode-characters-in-the-url-and-some-part-of-the-system": "URL ir kai kuriose sistemos dalyse leiskite naudoti „Unicode“ simbolius.",
|
||||
"variables-allowed": "Kintamieji leidžiami",
|
||||
"tag": "Žyma",
|
||||
"drag-and-drop-to-sort-the-plugins": "Norėdami rūšiuoti įskiepius, vilkite ir nuleiskite.",
|
||||
"seo": "SEO",
|
||||
"documentation": "Dokumentacija",
|
||||
"forum-support": "Forumo pagalba",
|
||||
"chat-support": "Susirašinėjimo pagalba",
|
||||
"quick-links": "Greitos nuorodos",
|
||||
"leave-empty-for-autocomplete-by-bludit": "Palikite tuščią, jei norite, kad Bludit atliktų automatinį užbaigimą.",
|
||||
"choose-a-password-for-the-user-admin": "Pasirinkite slaptažodį naudotojui <code>admin<\/code>",
|
||||
"access-denied": "Prieiga nesuteikta",
|
||||
"choose-images-to-upload": "Pasirinkite nuotraukas įkėlimui",
|
||||
"insert": "Įterpti",
|
||||
"upload": "Įkelti",
|
||||
"autosave": "Automatiškai išsaugoti",
|
||||
"the-content-is-saved-as-a-draft-to-publish-it": "Šis turinys išsaugotas kaip juodraštis. Norėdami jį paskelbti, spustelėkite mygtuką <b>Paskelbti<\/b> arba, jei vis dar dirbate, spustelėkite <b>Išsaugoti kaip juodraštį<\/b>.",
|
||||
"site": "Svetainė",
|
||||
"first": "Pirmas",
|
||||
"last": "Paskutinys",
|
||||
"there-are-no-pages-at-this-moment": "Šiuo momentu nėra jokių puslapių.",
|
||||
"there-are-no-static-pages-at-this-moment": "Šiuo momentu nėra statinių puslapių.",
|
||||
"there-are-no-draft-pages-at-this-moment": "Šiuo momentu nėra juodraščių-puslapių.",
|
||||
"good-morning": "Labas rytas",
|
||||
"good-afternoon": "Laba diena",
|
||||
"good-evening": "Labas vakaras",
|
||||
"good-night": "Labanakt",
|
||||
"hello": "Labas",
|
||||
"there-are-no-images-for-the-page": "Nėra nuotraukų puslapiui.",
|
||||
"select-cover-image": "Pasirinkti viršelio vaizdą",
|
||||
"this-plugin-depends-on-the-following-plugins": "Šis įskiepis priklauso nuo šių įskiepių.",
|
||||
"no-pages-found": "Nerasta puslapių.",
|
||||
"system-updated": "Systema atnaujinta.",
|
||||
"security": "Saugumas",
|
||||
"remove-cover-image": "Panaikinti viršelio vaizdą",
|
||||
"width": "Plotis",
|
||||
"height": "Aukštis",
|
||||
"quality": "Kokybė",
|
||||
"thumbnails": "Viršelio vaizdai",
|
||||
"thumbnail": "Viršelio vaizdas",
|
||||
"thumbnail-width-in-pixels": "Viršelio vaizdo plotis pikseliais (px).",
|
||||
"thumbnail-height-in-pixels": "Viršelio vaizdo aukštis pikseliais (px).",
|
||||
"thumbnail-quality-in-percentage": "TViršelio vaizdo kokybė procentais (%).",
|
||||
"maximum-load-file-size-allowed:": "Didžiausias leidžiamas failo įkelimo dydis:",
|
||||
"file-type-is-not-supported": "Failo tipas nepalaikomas. Leidžiami tipai:",
|
||||
"page-content": "Puslapio turinys",
|
||||
"markdown-parser": "Markdown analizatorius",
|
||||
"site-logo": "Svetainės logotipas",
|
||||
"search": "Paieška",
|
||||
"search-plugins": "Ieškoti įskiepių",
|
||||
"enabled-plugins": "Įjungti įskiepiai",
|
||||
"disabled-plugins": "Išjungti įskiepiai",
|
||||
"remove-logo": "Ištrinti logotipą",
|
||||
"preview": "Peržiurėti",
|
||||
"author-can-write-and-edit-their-own-content": "autorius: Gali rašyti ir redaguoti savo turinį. Redaktorius: Gali rašyti ir redaguoti kitų turinį.",
|
||||
"custom-fields": "Pasirinktiniai laukai",
|
||||
"define-custom-fields-for-the-content": "Apibrėžkite pasirinktinius turinio laukus. Daugiau informacijos apie pasirinktinius laukus rasite <a href='https:\/\/docs.bludit.com\/en\/content\/custom-fields'>dokumentacijoje<\/a>.",
|
||||
"start-typing-to-see-a-list-of-suggestions": "Pradėkite rašyti, kad pamatytumėte pasiūlymų sąrašą.",
|
||||
"view": "Žiūrėti",
|
||||
"insert-thumbnail": "Įterpti viršelio vaizdą",
|
||||
"insert-linked-thumbnail": "Įterpti susietą viršelio vaizdą"
|
||||
}
|
|
@ -3,11 +3,11 @@
|
|||
"native": "Русский (Россия)",
|
||||
"english-name": "Russian",
|
||||
"locale": "ru, ru_RU",
|
||||
"last-update": "2018-08-20",
|
||||
"last-update": "2023-09-20",
|
||||
"authors": [
|
||||
"Сергей Ворон https:\/\/voron.pw",
|
||||
"Макс Костиков https:\/\/kostikov.co",
|
||||
"Paul https:\/\/paul.bid",
|
||||
"Paul Bid (Павел Бид) https:\/\/paul.bid",
|
||||
""
|
||||
]
|
||||
},
|
||||
|
@ -183,7 +183,7 @@
|
|||
"you-can-change-this-field-when-save-the-current-changes": "Вы сможете изменить это поле после того, как сохраните текущие настройки.",
|
||||
"items-per-page": "Записей на странице",
|
||||
"invite-a-friend-to-collaborate-on-your-site": "Пригласить друга для совместной работы на сайте",
|
||||
"number-of-items-to-show-per-page": "Количество записей, отображаемых на странице.",
|
||||
"number-of-items-to-show-per-page": "Количество записей, отображаемых на странице, -1 отобразит все записи.",
|
||||
"website-or-blog": "«Веб-сайт» или «Блог»",
|
||||
"order-content-by": "Сортировать записи по",
|
||||
"edit-or-delete-content-from-your-site": "Редактировать или удалить запись на Вашем сайте",
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.14.0",
|
||||
"releaseDate": "2022-08-05",
|
||||
"version": "3.16.2",
|
||||
"releaseDate": "2024-08-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.14.0",
|
||||
"compatible": "3.16.2",
|
||||
"notes": ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
<?php
|
||||
|
||||
class pluginAbout extends Plugin {
|
||||
class pluginAbout extends Plugin
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->dbFields = array(
|
||||
'label'=>'About',
|
||||
'text'=>''
|
||||
'label' => 'About',
|
||||
'text' => ''
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -19,14 +20,14 @@ class pluginAbout extends Plugin {
|
|||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Label').'</label>';
|
||||
$html .= '<input name="label" type="text" value="'.$this->getValue('label').'">';
|
||||
$html .= '<span class="tip">'.$L->get('This title is almost always used in the sidebar of the site').'</span>';
|
||||
$html .= '<label>' . $L->get('Label') . '</label>';
|
||||
$html .= '<input name="label" type="text" dir="auto" value="' . $this->getValue('label') . '">';
|
||||
$html .= '<span class="tip">' . $L->get('This title is almost always used in the sidebar of the site') . '</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('About').'</label>';
|
||||
$html .= '<textarea name="text" id="jstext">'.$this->getValue('text').'</textarea>';
|
||||
$html .= '<label>' . $L->get('About') . '</label>';
|
||||
$html .= '<textarea name="text" id="jstext">' . $this->getValue('text') . '</textarea>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
|
@ -35,12 +36,12 @@ class pluginAbout extends Plugin {
|
|||
public function siteSidebar()
|
||||
{
|
||||
$html = '<div class="plugin plugin-about">';
|
||||
$html .= '<h2 class="plugin-label">'.$this->getValue('label').'</h2>';
|
||||
$html .= '<h2 class="plugin-label">' . $this->getValue('label') . '</h2>';
|
||||
$html .= '<div class="plugin-content">';
|
||||
$html .= html_entity_decode(nl2br($this->getValue('text')));
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
14
bl-plugins/alternative/languages/de_AT.json
Normal file
14
bl-plugins/alternative/languages/de_AT.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Theme Popeye",
|
||||
"description": "Das Plugin erlaubt verschiedene Einstellungen für das Theme Popeye."
|
||||
},
|
||||
"enable-or-disable-dark-mode": "Dunkelmodus aktivieren oder deaktivieren.",
|
||||
"enable-or-disable-google-fonts": "Google Fonts aktivieren oder deaktivieren.",
|
||||
"relative": "Relativ",
|
||||
"absolute": "Absolut",
|
||||
"change-the-date-format-for-the-main-page": "Einstellung des Datumsformats auf der Haupt- oder Blogseite.",
|
||||
"show-tags": "Schlagwörter zeigen",
|
||||
"show-tags-in-the-main-page-for-each-article": "Zeigt auf der Haupt- oder Blogseite die Schlagwörter der Beiträge."
|
||||
}
|
14
bl-plugins/alternative/languages/de_CH.json
Normal file
14
bl-plugins/alternative/languages/de_CH.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Theme Popeye",
|
||||
"description": "Das Plugin erlaubt verschiedene Einstellungen für das Theme Popeye."
|
||||
},
|
||||
"enable-or-disable-dark-mode": "Dunkelmodus aktivieren oder deaktivieren.",
|
||||
"enable-or-disable-google-fonts": "Google Fonts aktivieren oder deaktivieren.",
|
||||
"relative": "Relativ",
|
||||
"absolute": "Absolut",
|
||||
"change-the-date-format-for-the-main-page": "Einstellung des Datumsformats auf der Haupt- oder Blogseite.",
|
||||
"show-tags": "Schlagwörter zeigen",
|
||||
"show-tags-in-the-main-page-for-each-article": "Zeigt auf der Haupt- oder Blogseite die Schlagwörter der Beiträge."
|
||||
}
|
14
bl-plugins/alternative/languages/de_DE.json
Normal file
14
bl-plugins/alternative/languages/de_DE.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Theme Popeye",
|
||||
"description": "Das Plugin erlaubt verschiedene Einstellungen für das Theme Popeye."
|
||||
},
|
||||
"enable-or-disable-dark-mode": "Dunkelmodus aktivieren oder deaktivieren.",
|
||||
"enable-or-disable-google-fonts": "Google Fonts aktivieren oder deaktivieren.",
|
||||
"relative": "Relativ",
|
||||
"absolute": "Absolut",
|
||||
"change-the-date-format-for-the-main-page": "Einstellung des Datumsformats auf der Haupt- oder Blogseite.",
|
||||
"show-tags": "Schlagwörter zeigen",
|
||||
"show-tags-in-the-main-page-for-each-article": "Zeigt auf der Haupt- oder Blogseite die Schlagwörter der Beiträge."
|
||||
}
|
13
bl-plugins/alternative/languages/en.json
Normal file
13
bl-plugins/alternative/languages/en.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"plugin-data": {
|
||||
"name": "Alternative Theme",
|
||||
"description": "This plugin provides configuration for the Alternative theme."
|
||||
},
|
||||
"enable-or-disable-dark-mode": "Enable or disable dark mode.",
|
||||
"enable-or-disable-google-fonts": "Enable or disable Google fonts.",
|
||||
"relative": "Relative",
|
||||
"absolute": "Absolute",
|
||||
"change-the-date-format-for-the-main-page": "Change the date format for the main page.",
|
||||
"show-tags": "Show tags",
|
||||
"show-tags-in-the-main-page-for-each-article": "Show tags on the main page for each article."
|
||||
}
|
14
bl-plugins/alternative/languages/ja_JP.json
Normal file
14
bl-plugins/alternative/languages/ja_JP.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Popeye Theme",
|
||||
"description": "Popeyeテーマの設定を行うプラグインです。"
|
||||
},
|
||||
"enable-or-disable-dark-mode": "ダークモードを有効または無効にします。",
|
||||
"enable-or-disable-google-fonts": "Google Fontsの利用を有効または無効にします。",
|
||||
"relative": "相対的",
|
||||
"absolute": "絶対的",
|
||||
"change-the-date-format-for-the-main-page": "メインページの日付表示形式を変更します。",
|
||||
"show-tags": "タグの表示",
|
||||
"show-tags-in-the-main-page-for-each-article": "メインページの各記事にタグを表示します。"
|
||||
}
|
14
bl-plugins/alternative/languages/nl_NL.json
Normal file
14
bl-plugins/alternative/languages/nl_NL.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Popeye Thema",
|
||||
"description": "Met deze plugin kan het thema Popeye geconfigureerd worden."
|
||||
},
|
||||
"enable-or-disable-dark-mode": "Donkere modus in-/uitschakelen.",
|
||||
"enable-or-disable-google-fonts": "Lettertypes van Google in-/uitschakelen.",
|
||||
"relative": "Relatief",
|
||||
"absolute": "Absoluut",
|
||||
"change-the-date-format-for-the-main-page": "Het datumformaat voor de hoofdpagina aanpassen.",
|
||||
"show-tags": "Tags tonen",
|
||||
"show-tags-in-the-main-page-for-each-article": "Op de hoofdpagina voor ieder artikel de tags tonen."
|
||||
}
|
13
bl-plugins/alternative/languages/ru.json
Normal file
13
bl-plugins/alternative/languages/ru.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"plugin-data": {
|
||||
"name": "Настройки темы Alternative",
|
||||
"description": "Этот плагин содержит настройки для темы Alternative."
|
||||
},
|
||||
"enable-or-disable-dark-mode": "Включить или выключить тёмный режим.",
|
||||
"enable-or-disable-google-fonts": "Включить или выключить шрифты от Google (Google fonts).",
|
||||
"relative": "Относительный",
|
||||
"absolute": "Абсолютный",
|
||||
"change-the-date-format-for-the-main-page": "Изменить формат даты для главной страницы.",
|
||||
"show-tags": "Отображать теги",
|
||||
"show-tags-in-the-main-page-for-each-article": "Показывать теги на главной странице для каждой записи."
|
||||
}
|
11
bl-plugins/alternative/metadata.json
Normal file
11
bl-plugins/alternative/metadata.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.16.2",
|
||||
"releaseDate": "2023-07-10",
|
||||
"license": "MIT",
|
||||
"compatible": "3.16.2",
|
||||
"notes": "",
|
||||
"type": "theme"
|
||||
}
|
65
bl-plugins/alternative/plugin.php
Normal file
65
bl-plugins/alternative/plugin.php
Normal file
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
class alternative extends Plugin
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->dbFields = array(
|
||||
'googleFonts' => false,
|
||||
'showPostInformation' => false,
|
||||
'dateFormat' => 'relative'
|
||||
);
|
||||
}
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $L;
|
||||
|
||||
$html = '';
|
||||
|
||||
$html .= '<div class="mb-3">';
|
||||
$html .= '<label class="form-label" for="googleFonts">' . $L->get('Google Fonts') . '</label>';
|
||||
$html .= '<select class="form-select" id="googleFonts" name="googleFonts">';
|
||||
$html .= '<option value="false" ' . ($this->getValue('googleFonts') === false ? 'selected' : '') . '>' . $L->get('Disabled') . '</option>';
|
||||
$html .= '<option value="true" ' . ($this->getValue('googleFonts') === true ? 'selected' : '') . '>' . $L->get('Enabled') . '</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '<div class="form-text">' . $L->get('Enable or disable Google fonts.') . '</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div class="mb-3">';
|
||||
$html .= '<label class="form-label" for="showPostInformation">' . $L->get('Show Post Information') . '</label>';
|
||||
$html .= '<select class="form-select" id="showPostInformation" name="showPostInformation">';
|
||||
$html .= '<option value="false" ' . ($this->getValue('showPostInformation') === false ? 'selected' : '') . '>' . $L->get('Disabled') . '</option>';
|
||||
$html .= '<option value="true" ' . ($this->getValue('showPostInformation') === true ? 'selected' : '') . '>' . $L->get('Enabled') . '</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div class="mb-3">';
|
||||
$html .= '<label class="form-label" for="dateFormat">' . $L->get('Date format') . '</label>';
|
||||
$html .= '<select class="form-select" id="dateFormat" name="dateFormat">';
|
||||
$html .= '<option value="noshow" ' . ($this->getValue('dateFormat') == 'noshow' ? 'selected' : '') . '>' . $L->get('No show') . '</option>';
|
||||
$html .= '<option value="relative" ' . ($this->getValue('dateFormat') == 'relative' ? 'selected' : '') . '>' . $L->get('Relative') . '</option>';
|
||||
$html .= '<option value="absolute" ' . ($this->getValue('dateFormat') == 'absolute' ? 'selected' : '') . '>' . $L->get('Absolute') . '</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '<div class="form-text">' . $L->get('Change the date format for the main page.') . '</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function showPostInformation()
|
||||
{
|
||||
return $this->getValue('showPostInformation');
|
||||
}
|
||||
|
||||
public function googleFonts()
|
||||
{
|
||||
return $this->getValue('googleFonts');
|
||||
}
|
||||
|
||||
public function dateFormat()
|
||||
{
|
||||
return $this->getValue('dateFormat');
|
||||
}
|
||||
}
|
11
bl-plugins/api/languages/ru.json
Normal file
11
bl-plugins/api/languages/ru.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "API",
|
||||
"description": "Интерфейс для взаимодействия с Bludit по HTTP-протоколу.<br>Узнайте больше про этот плагин в разделе <a href=\"https://docs.bludit.com/en/api/introduction\">Введение в API для Bludit</a> (раздел на английском)."
|
||||
},
|
||||
"api-token": "API Tокен",
|
||||
"amount-of-pages": "Количество страниц",
|
||||
"this-is-the-maximum-of-pages-to-return-when-you-call-to": "Максимальное количество возвращаемых страниц при обращении к <code>/api/pages</code>",
|
||||
"this-token-is-for-read-only-and-is-regenerated-every-time-you-install-the-plugin": "Данный токен используется только для чтения, токен обновляется при каждой переустановке плагина."
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "API",
|
||||
"description": "Интерфейс для взаимодействия с Bludit по HTTP-протоколу. <br>Узнайте больше про этот плагин в разделе <a href=\"https://docs.bludit.com/en/api/introduction\">API Introduction</a>."
|
||||
},
|
||||
"api-token": "API Tокен",
|
||||
"amount-of-pages": "Количество страниц",
|
||||
"this-is-the-maximum-of-pages-to-return-when-you-call-to": "Максимальное количество возвращаемых страниц при обращении к /api/pages",
|
||||
"this-token-is-for-read-only-and-is-regenerated-every-time-you-install-the-plugin": "Данный токен используется только для чтения, он обновляется при каждой переустановке плагина."
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.14.0",
|
||||
"releaseDate": "2022-08-05",
|
||||
"version": "3.16.2",
|
||||
"releaseDate": "2024-08-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.14.0",
|
||||
"compatible": "3.16.2",
|
||||
"notes": ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
<?php
|
||||
|
||||
class pluginAPI extends Plugin {
|
||||
class pluginAPI extends Plugin
|
||||
{
|
||||
|
||||
private $method;
|
||||
|
||||
public function init()
|
||||
{
|
||||
// Generate the API Token
|
||||
$token = md5( uniqid().time().DOMAIN );
|
||||
$token = md5(uniqid() . time() . DOMAIN);
|
||||
|
||||
$this->dbFields = array(
|
||||
'token'=>$token, // API Token
|
||||
'numberOfItems'=>15 // Amount of items to return
|
||||
'token' => $token, // API Token
|
||||
'numberOfItems' => 15 // Amount of items to return
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -29,28 +30,28 @@ class pluginAPI extends Plugin {
|
|||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('URL').'</label>';
|
||||
$html .= '<p class="text-muted">'.DOMAIN_BASE.'api/{endpoint}</p>';
|
||||
$html .= '<label>' . $L->get('URL') . '</label>';
|
||||
$html .= '<p class="text-muted">' . DOMAIN_BASE . 'api/{endpoint}</p>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('API Token').'</label>';
|
||||
$html .= '<input name="token" type="text" value="'.$this->getValue('token').'">';
|
||||
$html .= '<span class="tip">'.$L->get('This token is for read only and is regenerated every time you install the plugin').'</span>';
|
||||
$html .= '<label>' . $L->get('API Token') . '</label>';
|
||||
$html .= '<input name="token" type="text" dir="auto" value="' . $this->getValue('token') . '">';
|
||||
$html .= '<span class="tip">' . $L->get('This token is for read only and is regenerated every time you install the plugin') . '</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Amount of pages').'</label>';
|
||||
$html .= '<input id="jsnumberOfItems" name="numberOfItems" type="text" value="'.$this->getValue('numberOfItems').'">';
|
||||
$html .= '<span class="tip">'.$L->get('This is the maximum of pages to return when you call to').'</span>';
|
||||
$html .= '<label>' . $L->get('Amount of pages') . '</label>';
|
||||
$html .= '<input id="jsnumberOfItems" name="numberOfItems" type="text" dir="auto" value="' . $this->getValue('numberOfItems') . '">';
|
||||
$html .= '<span class="tip">' . $L->get('This is the maximum of pages to return when you call to') . '</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
// API HOOKS
|
||||
// ----------------------------------------------------------------------------
|
||||
// API HOOKS
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
public function beforeAll()
|
||||
{
|
||||
|
@ -60,8 +61,8 @@ class pluginAPI extends Plugin {
|
|||
|
||||
// CHECK URL
|
||||
// ------------------------------------------------------------
|
||||
$URI = $this->webhook('api', $returnsAfterURI=true, $fixed=false);
|
||||
if ($URI===false) {
|
||||
$URI = $this->webhook('api', $returnsAfterURI = true, $fixed = false);
|
||||
if ($URI === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -73,14 +74,14 @@ class pluginAPI extends Plugin {
|
|||
// ------------------------------------------------------------
|
||||
$inputs = $this->getMethodInputs();
|
||||
if (empty($inputs)) {
|
||||
$this->response(400, 'Bad Request', array('message'=>'Missing method inputs.'));
|
||||
$this->response(400, 'Bad Request', array('message' => 'Missing method inputs.'));
|
||||
}
|
||||
|
||||
// ENDPOINT PARAMETERS
|
||||
// ------------------------------------------------------------
|
||||
$parameters = $this->getEndpointParameters($URI);
|
||||
if (empty($parameters)) {
|
||||
$this->response(400, 'Bad Request', array('message'=>'Missing endpoint parameters.'));
|
||||
$this->response(400, 'Bad Request', array('message' => 'Missing endpoint parameters.'));
|
||||
}
|
||||
|
||||
// API TOKEN
|
||||
|
@ -90,12 +91,12 @@ class pluginAPI extends Plugin {
|
|||
|
||||
// Check empty token
|
||||
if (empty($inputs['token'])) {
|
||||
$this->response(400, 'Bad Request', array('message'=>'Missing API token.'));
|
||||
$this->response(400, 'Bad Request', array('message' => 'Missing API token.'));
|
||||
}
|
||||
|
||||
// Check if the token is valid
|
||||
if ($inputs['token']!==$tokenAPI) {
|
||||
$this->response(401, 'Unauthorized', array('message'=>'Invalid API token.'));
|
||||
if ($inputs['token'] !== $tokenAPI) {
|
||||
$this->response(401, 'Unauthorized', array('message' => 'Invalid API token.'));
|
||||
}
|
||||
|
||||
// AUTHENTICATION TOKEN
|
||||
|
@ -105,10 +106,10 @@ class pluginAPI extends Plugin {
|
|||
|
||||
// Get the user with the authentication token, FALSE if doesn't exit
|
||||
$username = $users->getByAuthToken($inputs['authentication']);
|
||||
if ($username!==false) {
|
||||
if ($username !== false) {
|
||||
try {
|
||||
$user = new User($username);
|
||||
if (($user->role()=='admin') && ($user->enabled())) {
|
||||
if (($user->role() == 'admin') && ($user->enabled())) {
|
||||
// Loggin the user to create the session
|
||||
$login = new Login();
|
||||
$login->setLogin($username, 'admin');
|
||||
|
@ -130,89 +131,88 @@ class pluginAPI extends Plugin {
|
|||
// ------------------------------------------------------------
|
||||
|
||||
// (GET) /api/pages
|
||||
if ( ($method==='GET') && ($parameters[0]==='pages') && empty($parameters[1]) ) {
|
||||
if (($method === 'GET') && ($parameters[0] === 'pages') && empty($parameters[1])) {
|
||||
$data = $this->getPages($inputs);
|
||||
}
|
||||
// (GET) /api/pages/<key>
|
||||
elseif ( ($method==='GET') && ($parameters[0]==='pages') && !empty($parameters[1]) ) {
|
||||
elseif (($method === 'GET') && ($parameters[0] === 'pages') && !empty($parameters[1])) {
|
||||
$pageKey = $parameters[1];
|
||||
if (isset($parameters[2])) {
|
||||
$pageKey = $parameters[1].'/'.$parameters[2];
|
||||
$pageKey = $parameters[1] . '/' . $parameters[2];
|
||||
}
|
||||
$data = $this->getPage($pageKey);
|
||||
}
|
||||
// (PUT) /api/pages/<key>
|
||||
elseif ( ($method==='PUT') && ($parameters[0]==='pages') && !empty($parameters[1]) && $writePermissions ) {
|
||||
elseif (($method === 'PUT') && ($parameters[0] === 'pages') && !empty($parameters[1]) && $writePermissions) {
|
||||
$pageKey = $parameters[1];
|
||||
$data = $this->editPage($pageKey, $inputs);
|
||||
}
|
||||
// (DELETE) /api/pages/<key>
|
||||
elseif ( ($method==='DELETE') && ($parameters[0]==='pages') && !empty($parameters[1]) && $writePermissions ) {
|
||||
elseif (($method === 'DELETE') && ($parameters[0] === 'pages') && !empty($parameters[1]) && $writePermissions) {
|
||||
$pageKey = $parameters[1];
|
||||
$data = $this->deletePage($pageKey);
|
||||
}
|
||||
// (POST) /api/pages
|
||||
elseif ( ($method==='POST') && ($parameters[0]==='pages') && empty($parameters[1]) && $writePermissions ) {
|
||||
elseif (($method === 'POST') && ($parameters[0] === 'pages') && empty($parameters[1]) && $writePermissions) {
|
||||
$data = $this->createPage($inputs);
|
||||
}
|
||||
// (GET) /api/settings
|
||||
elseif ( ($method==='GET') && ($parameters[0]==='settings') && empty($parameters[1]) && $writePermissions ) {
|
||||
elseif (($method === 'GET') && ($parameters[0] === 'settings') && empty($parameters[1]) && $writePermissions) {
|
||||
$data = $this->getSettings();
|
||||
}
|
||||
// (PUT) /api/settings
|
||||
elseif ( ($method==='PUT') && ($parameters[0]==='settings') && empty($parameters[1]) && $writePermissions ) {
|
||||
elseif (($method === 'PUT') && ($parameters[0] === 'settings') && empty($parameters[1]) && $writePermissions) {
|
||||
$data = $this->editSettings($inputs);
|
||||
}
|
||||
// (POST) /api/images
|
||||
elseif ( ($method==='POST') && ($parameters[0]==='images') && $writePermissions ) {
|
||||
elseif (($method === 'POST') && ($parameters[0] === 'images') && $writePermissions) {
|
||||
$data = $this->uploadImage($inputs);
|
||||
}
|
||||
// (GET) /api/tags
|
||||
elseif ( ($method==='GET') && ($parameters[0]==='tags') && empty($parameters[1]) ) {
|
||||
elseif (($method === 'GET') && ($parameters[0] === 'tags') && empty($parameters[1])) {
|
||||
$data = $this->getTags();
|
||||
}
|
||||
// (GET) /api/tags/<key>
|
||||
elseif ( ($method==='GET') && ($parameters[0]==='tags') && !empty($parameters[1]) ) {
|
||||
elseif (($method === 'GET') && ($parameters[0] === 'tags') && !empty($parameters[1])) {
|
||||
$tagKey = $parameters[1];
|
||||
$data = $this->getTag($tagKey);
|
||||
}
|
||||
// (GET) /api/categories
|
||||
elseif ( ($method==='GET') && ($parameters[0]==='categories') && empty($parameters[1]) ) {
|
||||
elseif (($method === 'GET') && ($parameters[0] === 'categories') && empty($parameters[1])) {
|
||||
$data = $this->getCategories();
|
||||
}
|
||||
// (GET) /api/categories/<key>
|
||||
elseif ( ($method==='GET') && ($parameters[0]==='categories') && !empty($parameters[1]) ) {
|
||||
elseif (($method === 'GET') && ($parameters[0] === 'categories') && !empty($parameters[1])) {
|
||||
$categoryKey = $parameters[1];
|
||||
$data = $this->getCategory($categoryKey);
|
||||
}
|
||||
// (GET) /api/users
|
||||
elseif ( ($method==='GET') && ($parameters[0]==='users') && empty($parameters[1]) ) {
|
||||
elseif (($method === 'GET') && ($parameters[0] === 'users') && empty($parameters[1])) {
|
||||
$data = $this->getUsers();
|
||||
}
|
||||
// (GET) /api/users/<username>
|
||||
elseif ( ($method==='GET') && ($parameters[0]==='users') && !empty($parameters[1]) ) {
|
||||
elseif (($method === 'GET') && ($parameters[0] === 'users') && !empty($parameters[1])) {
|
||||
$username = $parameters[1];
|
||||
$data = $this->getUser($username);
|
||||
}
|
||||
// (GET) /api/files/<page-key>
|
||||
elseif ( ($method==='GET') && ($parameters[0]==='files') && !empty($parameters[1]) ) {
|
||||
elseif (($method === 'GET') && ($parameters[0] === 'files') && !empty($parameters[1])) {
|
||||
$pageKey = $parameters[1];
|
||||
$data = $this->getFiles($pageKey);
|
||||
}
|
||||
// (POST) /api/files/<page-key>
|
||||
elseif ( ($method==='POST') && ($parameters[0]==='files') && !empty($parameters[1]) ) {
|
||||
elseif (($method === 'POST') && ($parameters[0] === 'files') && !empty($parameters[1])) {
|
||||
$pageKey = $parameters[1];
|
||||
$data = $this->uploadFile($pageKey);
|
||||
}
|
||||
else {
|
||||
$this->response(401, 'Unauthorized', array('message'=>'Access denied or invalid endpoint.'));
|
||||
} else {
|
||||
$this->response(401, 'Unauthorized', array('message' => 'Access denied or invalid endpoint.'));
|
||||
}
|
||||
|
||||
$this->response(200, 'OK', $data);
|
||||
}
|
||||
|
||||
// PRIVATE METHODS
|
||||
// ----------------------------------------------------------------------------
|
||||
// PRIVATE METHODS
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
private function getMethod()
|
||||
{
|
||||
|
@ -229,7 +229,7 @@ class pluginAPI extends Plugin {
|
|||
|
||||
private function getMethodInputs()
|
||||
{
|
||||
switch($this->method) {
|
||||
switch ($this->method) {
|
||||
case "POST":
|
||||
$inputs = $_POST;
|
||||
break;
|
||||
|
@ -259,12 +259,12 @@ class pluginAPI extends Plugin {
|
|||
{
|
||||
$tmp = array();
|
||||
if (is_array($inputs)) {
|
||||
foreach ($inputs as $key=>$value) {
|
||||
foreach ($inputs as $key => $value) {
|
||||
$tmp[$key] = Sanitize::html($value);
|
||||
}
|
||||
} elseif (is_string($inputs)) {
|
||||
$tmp = json_decode($inputs, true);
|
||||
if (json_last_error()!==JSON_ERROR_NONE) {
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
$tmp = array();
|
||||
}
|
||||
}
|
||||
|
@ -284,16 +284,16 @@ class pluginAPI extends Plugin {
|
|||
$parameters = explode('/', $URI);
|
||||
|
||||
// Sanitize parameters
|
||||
foreach ($parameters as $key=>$value) {
|
||||
foreach ($parameters as $key => $value) {
|
||||
$parameters[$key] = Sanitize::html($value);
|
||||
}
|
||||
|
||||
return $parameters;
|
||||
}
|
||||
|
||||
private function response($code=200, $message='OK', $data=array())
|
||||
private function response($code = 200, $message = 'OK', $data = array())
|
||||
{
|
||||
header('HTTP/1.1 '.$code.' '.$message);
|
||||
header('HTTP/1.1 ' . $code . ' ' . $message);
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Content-Type: application/json');
|
||||
$json = json_encode($data);
|
||||
|
@ -304,9 +304,9 @@ class pluginAPI extends Plugin {
|
|||
{
|
||||
global $tags;
|
||||
$tmp = array(
|
||||
'status'=>'0',
|
||||
'message'=>'List of tags.',
|
||||
'data'=>array()
|
||||
'status' => '0',
|
||||
'message' => 'List of tags.',
|
||||
'data' => array()
|
||||
);
|
||||
foreach ($tags->keys() as $key) {
|
||||
$tag = $tags->getMap($key);
|
||||
|
@ -323,8 +323,8 @@ class pluginAPI extends Plugin {
|
|||
$tag = new Tag($key);
|
||||
} catch (Exception $e) {
|
||||
return array(
|
||||
'status'=>'1',
|
||||
'message'=>'Tag not found by the key: '.$key
|
||||
'status' => '1',
|
||||
'message' => 'Tag not found by the key: ' . $key
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -332,17 +332,18 @@ class pluginAPI extends Plugin {
|
|||
foreach ($tag->pages() as $pageKey) {
|
||||
try {
|
||||
$page = new Page($pageKey);
|
||||
array_push($list, $page->json($returnsArray=true));
|
||||
} catch (Exception $e){}
|
||||
array_push($list, $page->json($returnsArray = true));
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
}
|
||||
|
||||
$data = $tag->json($returnsArray=true);
|
||||
$data = $tag->json($returnsArray = true);
|
||||
$data['pages'] = $list;
|
||||
|
||||
return array(
|
||||
'status'=>'0',
|
||||
'message'=>'Information about the tag and pages related.',
|
||||
'data'=>$data
|
||||
'status' => '0',
|
||||
'message' => 'Information about the tag and pages related.',
|
||||
'data' => $data
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -351,22 +352,22 @@ class pluginAPI extends Plugin {
|
|||
global $pages;
|
||||
|
||||
// Parameters and the default values
|
||||
$published = (isset($args['published'])?$args['published']=='true':true);
|
||||
$static = (isset($args['static'])?$args['static']=='true':false);
|
||||
$draft = (isset($args['draft'])?$args['draft']=='true':false);
|
||||
$sticky = (isset($args['sticky'])?$args['sticky']=='true':false);
|
||||
$scheduled = (isset($args['scheduled'])?$args['scheduled']=='true':false);
|
||||
$untagged = (isset($args['untagged'])?$args['untagged']=='true':false);
|
||||
$published = (isset($args['published']) ? $args['published'] == 'true' : true);
|
||||
$static = (isset($args['static']) ? $args['static'] == 'true' : false);
|
||||
$draft = (isset($args['draft']) ? $args['draft'] == 'true' : false);
|
||||
$sticky = (isset($args['sticky']) ? $args['sticky'] == 'true' : false);
|
||||
$scheduled = (isset($args['scheduled']) ? $args['scheduled'] == 'true' : false);
|
||||
$untagged = (isset($args['untagged']) ? $args['untagged'] == 'true' : false);
|
||||
|
||||
$numberOfItems = (isset($args['numberOfItems'])?$args['numberOfItems']:10);
|
||||
$pageNumber = (isset($args['pageNumber'])?$args['pageNumber']:1);
|
||||
$numberOfItems = (isset($args['numberOfItems']) ? $args['numberOfItems'] : 10);
|
||||
$pageNumber = (isset($args['pageNumber']) ? $args['pageNumber'] : 1);
|
||||
$list = $pages->getList($pageNumber, $numberOfItems, $published, $static, $sticky, $draft, $scheduled);
|
||||
|
||||
$tmp = array(
|
||||
'status'=>'0',
|
||||
'message'=>'List of pages',
|
||||
'numberOfItems'=>$numberOfItems,
|
||||
'data'=>array()
|
||||
'status' => '0',
|
||||
'message' => 'List of pages',
|
||||
'numberOfItems' => $numberOfItems,
|
||||
'data' => array()
|
||||
);
|
||||
|
||||
foreach ($list as $pageKey) {
|
||||
|
@ -374,12 +375,12 @@ class pluginAPI extends Plugin {
|
|||
// Create the page object from the page key
|
||||
$page = new Page($pageKey);
|
||||
if ($untagged) {
|
||||
if (empty($page->tags())) {
|
||||
if (empty($page->tags())) {
|
||||
// Push the page to the data array for the response
|
||||
array_push($tmp['data'], $page->json($returnsArray=true));
|
||||
array_push($tmp['data'], $page->json($returnsArray = true));
|
||||
}
|
||||
} else{
|
||||
array_push($tmp['data'], $page->json($returnsArray=true));
|
||||
} else {
|
||||
array_push($tmp['data'], $page->json($returnsArray = true));
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// Continue
|
||||
|
@ -394,14 +395,14 @@ class pluginAPI extends Plugin {
|
|||
try {
|
||||
$page = new Page($key);
|
||||
return array(
|
||||
'status'=>'0',
|
||||
'message'=>'Page filtered by key: '.$key,
|
||||
'data'=>$page->json( $returnsArray=true )
|
||||
'status' => '0',
|
||||
'message' => 'Page filtered by key: ' . $key,
|
||||
'data' => $page->json($returnsArray = true)
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
return array(
|
||||
'status'=>'1',
|
||||
'message'=>'Page not found.'
|
||||
'status' => '1',
|
||||
'message' => 'Page not found.'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -415,17 +416,17 @@ class pluginAPI extends Plugin {
|
|||
|
||||
// This function is defined on functions.php
|
||||
$key = createPage($args);
|
||||
if ($key===false) {
|
||||
if ($key === false) {
|
||||
return array(
|
||||
'status'=>'1',
|
||||
'message'=>'Error trying to create the new page.'
|
||||
'status' => '1',
|
||||
'message' => 'Error trying to create the new page.'
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
'status'=>'0',
|
||||
'message'=>'Page created.',
|
||||
'data'=>array('key'=>$key)
|
||||
'status' => '0',
|
||||
'message' => 'Page created.',
|
||||
'data' => array('key' => $key)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -439,17 +440,17 @@ class pluginAPI extends Plugin {
|
|||
$args['key'] = $key;
|
||||
$newKey = editPage($args);
|
||||
|
||||
if ($newKey===false) {
|
||||
if ($newKey === false) {
|
||||
return array(
|
||||
'status'=>'1',
|
||||
'message'=>'Error trying to edit the page.'
|
||||
'status' => '1',
|
||||
'message' => 'Error trying to edit the page.'
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
'status'=>'0',
|
||||
'message'=>'Page edited.',
|
||||
'data'=>array('key'=>$newKey)
|
||||
'status' => '0',
|
||||
'message' => 'Page edited.',
|
||||
'data' => array('key' => $newKey)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -457,14 +458,14 @@ class pluginAPI extends Plugin {
|
|||
{
|
||||
if (deletePage($key)) {
|
||||
return array(
|
||||
'status'=>'0',
|
||||
'message'=>'Page deleted.'
|
||||
'status' => '0',
|
||||
'message' => 'Page deleted.'
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
'status'=>'1',
|
||||
'message'=>'Error trying to delete the page.'
|
||||
'status' => '1',
|
||||
'message' => 'Error trying to delete the page.'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -482,10 +483,10 @@ class pluginAPI extends Plugin {
|
|||
{
|
||||
// Set upload directory
|
||||
if (isset($inputs['uuid']) && IMAGE_RESTRICT) {
|
||||
$imageDirectory = PATH_UPLOADS_PAGES.$inputs['uuid'].DS;
|
||||
$thumbnailDirectory = $imageDirectory.'thumbnails'.DS;
|
||||
$imageEndpoint = DOMAIN_UPLOADS_PAGES.$inputs['uuid'].'/';
|
||||
$thumbnailEndpoint = $imageEndpoint.'thumbnails'.'/';
|
||||
$imageDirectory = PATH_UPLOADS_PAGES . $inputs['uuid'] . DS;
|
||||
$thumbnailDirectory = $imageDirectory . 'thumbnails' . DS;
|
||||
$imageEndpoint = DOMAIN_UPLOADS_PAGES . $inputs['uuid'] . '/';
|
||||
$thumbnailEndpoint = $imageEndpoint . 'thumbnails' . '/';
|
||||
if (!Filesystem::directoryExists($thumbnailDirectory)) {
|
||||
Filesystem::mkdir($thumbnailDirectory, true);
|
||||
}
|
||||
|
@ -498,36 +499,36 @@ class pluginAPI extends Plugin {
|
|||
|
||||
if (!isset($_FILES['image'])) {
|
||||
return array(
|
||||
'status'=>'1',
|
||||
'message'=>'No image sent.'
|
||||
'status' => '1',
|
||||
'message' => 'No image sent.'
|
||||
);
|
||||
}
|
||||
|
||||
if ($_FILES['image']['error'] != 0) {
|
||||
return array(
|
||||
'status'=>'1',
|
||||
'message'=>'Error uploading the image, maximum load file size allowed: '.ini_get('upload_max_filesize')
|
||||
'status' => '1',
|
||||
'message' => 'Error uploading the image, maximum load file size allowed: ' . ini_get('upload_max_filesize')
|
||||
);
|
||||
}
|
||||
|
||||
// Move from PHP tmp file to Bludit tmp directory
|
||||
Filesystem::mv($_FILES['image']['tmp_name'], PATH_TMP.$_FILES['image']['name']);
|
||||
Filesystem::mv($_FILES['image']['tmp_name'], PATH_TMP . $_FILES['image']['name']);
|
||||
|
||||
// Transform image and create thumbnails
|
||||
$image = transformImage(PATH_TMP.$_FILES['image']['name'], $imageDirectory, $thumbnailDirectory);
|
||||
$image = transformImage(PATH_TMP . $_FILES['image']['name'], $imageDirectory, $thumbnailDirectory);
|
||||
if ($image) {
|
||||
$filename = Filesystem::filename($image);
|
||||
return array(
|
||||
'status'=>'0',
|
||||
'message'=>'Image uploaded.',
|
||||
'image'=>$imageEndpoint.$filename,
|
||||
'thumbnail'=>$thumbnailEndpoint.$filename
|
||||
'status' => '0',
|
||||
'message' => 'Image uploaded.',
|
||||
'image' => $imageEndpoint . $filename,
|
||||
'thumbnail' => $thumbnailEndpoint . $filename
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
'status'=>'1',
|
||||
'message'=>'Image extension not allowed.'
|
||||
'status' => '1',
|
||||
'message' => 'Image extension not allowed.'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -542,9 +543,9 @@ class pluginAPI extends Plugin {
|
|||
{
|
||||
global $site;
|
||||
return array(
|
||||
'status'=>'0',
|
||||
'message'=>'Settings.',
|
||||
'data'=>$site->get()
|
||||
'status' => '0',
|
||||
'message' => 'Settings.',
|
||||
'data' => $site->get()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -560,13 +561,13 @@ class pluginAPI extends Plugin {
|
|||
{
|
||||
if (editSettings($args)) {
|
||||
return array(
|
||||
'status'=>'0',
|
||||
'message'=>'Settings edited.'
|
||||
'status' => '0',
|
||||
'message' => 'Settings edited.'
|
||||
);
|
||||
}
|
||||
return array(
|
||||
'status'=>'1',
|
||||
'message'=>'Error trying to edit the settings.'
|
||||
'status' => '1',
|
||||
'message' => 'Error trying to edit the settings.'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -581,9 +582,9 @@ class pluginAPI extends Plugin {
|
|||
{
|
||||
global $categories;
|
||||
$tmp = array(
|
||||
'status'=>'0',
|
||||
'message'=>'List of categories.',
|
||||
'data'=>array()
|
||||
'status' => '0',
|
||||
'message' => 'List of categories.',
|
||||
'data' => array()
|
||||
);
|
||||
foreach ($categories->keys() as $key) {
|
||||
$category = $categories->getMap($key);
|
||||
|
@ -607,8 +608,8 @@ class pluginAPI extends Plugin {
|
|||
$category = new Category($key);
|
||||
} catch (Exception $e) {
|
||||
return array(
|
||||
'status'=>'1',
|
||||
'message'=>'Category not found by the key: '.$key
|
||||
'status' => '1',
|
||||
'message' => 'Category not found by the key: ' . $key
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -616,17 +617,18 @@ class pluginAPI extends Plugin {
|
|||
foreach ($category->pages() as $pageKey) {
|
||||
try {
|
||||
$page = new Page($pageKey);
|
||||
array_push($list, $page->json($returnsArray=true));
|
||||
} catch (Exception $e){}
|
||||
array_push($list, $page->json($returnsArray = true));
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
}
|
||||
|
||||
$data = $category->json($returnsArray=true);
|
||||
$data = $category->json($returnsArray = true);
|
||||
$data['pages'] = $list;
|
||||
|
||||
return array(
|
||||
'status'=>'0',
|
||||
'message'=>'Information about the category and pages related.',
|
||||
'data'=>$data
|
||||
'status' => '0',
|
||||
'message' => 'Information about the category and pages related.',
|
||||
'data' => $data
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -643,16 +645,16 @@ class pluginAPI extends Plugin {
|
|||
$user = new User($username);
|
||||
} catch (Exception $e) {
|
||||
return array(
|
||||
'status'=>'1',
|
||||
'message'=>'User not found by username: '.$username
|
||||
'status' => '1',
|
||||
'message' => 'User not found by username: ' . $username
|
||||
);
|
||||
}
|
||||
|
||||
$data = $user->json($returnsArray=true);
|
||||
$data = $user->json($returnsArray = true);
|
||||
return array(
|
||||
'status'=>'0',
|
||||
'message'=>'User profile.',
|
||||
'data'=>$data
|
||||
'status' => '0',
|
||||
'message' => 'User profile.',
|
||||
'data' => $data
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -665,19 +667,19 @@ class pluginAPI extends Plugin {
|
|||
{
|
||||
global $users;
|
||||
$data = array();
|
||||
foreach ($users->db as $username=>$profile) {
|
||||
foreach ($users->db as $username => $profile) {
|
||||
try {
|
||||
$user = new User($username);
|
||||
$data[$username] = $user->json($returnsArray=true);
|
||||
$data[$username] = $user->json($returnsArray = true);
|
||||
} catch (Exception $e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return array(
|
||||
'status'=>'0',
|
||||
'message'=>'Users profiles.',
|
||||
'data'=>$data
|
||||
'status' => '0',
|
||||
'message' => 'Users profiles.',
|
||||
'data' => $data
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -690,19 +692,19 @@ class pluginAPI extends Plugin {
|
|||
{
|
||||
$chunk = false;
|
||||
$sortByDate = true;
|
||||
$path = PATH_UPLOADS_PAGES.$pageKey.DS;
|
||||
$path = PATH_UPLOADS_PAGES . $pageKey . DS;
|
||||
$listFiles = Filesystem::listFiles($path, '*', '*', $sortByDate, $chunk);
|
||||
|
||||
$files = array();
|
||||
foreach ($listFiles as $file) {
|
||||
$info = array('thumbnail'=>'');
|
||||
$info = array('thumbnail' => '');
|
||||
$info['file'] = $file;
|
||||
$info['filename'] = basename($file);
|
||||
$info['mime'] = Filesystem::mimeType($file);
|
||||
$info['size'] = Filesystem::getSize($file);
|
||||
|
||||
// Check if thumbnail exists for the file
|
||||
$thumbnail = $path.'thumbnails'.DS.$info['filename'];
|
||||
$thumbnail = $path . 'thumbnails' . DS . $info['filename'];
|
||||
if (Filesystem::fileExists($thumbnail)) {
|
||||
$info['thumbnail'] = $thumbnail;
|
||||
}
|
||||
|
@ -711,9 +713,9 @@ class pluginAPI extends Plugin {
|
|||
}
|
||||
|
||||
return array(
|
||||
'status'=>'0',
|
||||
'message'=>'Files for the page key: '.$pageKey,
|
||||
'data'=>$files
|
||||
'status' => '0',
|
||||
'message' => 'Files for the page key: ' . $pageKey,
|
||||
'data' => $files
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -731,34 +733,34 @@ class pluginAPI extends Plugin {
|
|||
{
|
||||
if (!isset($_FILES['file'])) {
|
||||
return array(
|
||||
'status'=>'1',
|
||||
'message'=>'File not sent.'
|
||||
'status' => '1',
|
||||
'message' => 'File not sent.'
|
||||
);
|
||||
}
|
||||
|
||||
if ($_FILES['file']['error'] != 0) {
|
||||
return array(
|
||||
'status'=>'1',
|
||||
'message'=>'Error uploading the file.'
|
||||
'status' => '1',
|
||||
'message' => 'Error uploading the file.'
|
||||
);
|
||||
}
|
||||
|
||||
$filename = $_FILES['file']['name'];
|
||||
$absoluteURL = DOMAIN_UPLOADS_PAGES.$pageKey.DS.$filename;
|
||||
$absolutePath = PATH_UPLOADS_PAGES.$pageKey.DS.$filename;
|
||||
$absoluteURL = DOMAIN_UPLOADS_PAGES . $pageKey . DS . $filename;
|
||||
$absolutePath = PATH_UPLOADS_PAGES . $pageKey . DS . $filename;
|
||||
if (Filesystem::mv($_FILES['file']['tmp_name'], $absolutePath)) {
|
||||
return array(
|
||||
'status'=>'0',
|
||||
'message'=>'File uploaded.',
|
||||
'filename'=>$filename,
|
||||
'absolutePath'=>$absolutePath,
|
||||
'absoluteURL'=>$absoluteURL
|
||||
'status' => '0',
|
||||
'message' => 'File uploaded.',
|
||||
'filename' => $filename,
|
||||
'absolutePath' => $absolutePath,
|
||||
'absoluteURL' => $absoluteURL
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
'status'=>'1',
|
||||
'message'=>'Error moving the file to the final path.'
|
||||
'status' => '1',
|
||||
'message' => 'Error moving the file to the final path.'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
jQuery(document).ready(function($) {
|
||||
$('#backupFile').change(function() {
|
||||
var file = this.files.length >= 1? this.files[0]: null;
|
||||
if (file === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Build Form Data
|
||||
var url = $('#jsform').attr("action") || window.location.href;
|
||||
var form = new FormData();
|
||||
form.append("tokenCSRF", $('[name="tokenCSRF"]').val());
|
||||
form.append("backupFile", file);
|
||||
|
||||
// Apply Form
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: form,
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
mimeType: "multipart/form-data",
|
||||
contentType: false,
|
||||
processData: false,
|
||||
error: function (jqXHR, status, error) {
|
||||
var data = jqXHR.responseJSON;
|
||||
var alert = $("<div></div>").addClass("alert alert-danger").text(data.message);
|
||||
|
||||
$("#jsform .alert:not(.alert-primary)").remove();
|
||||
$("#jstokenCSRF").after(alert);
|
||||
},
|
||||
success: function (data, status, jqXHR) {
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"create-backup": "Opret sikkerhedskopi",
|
||||
"delete-backup": "Slet sikkerhedskopi",
|
||||
"download": "Download",
|
||||
"plugin-data": {
|
||||
"description": "Den enkle måde at tage backup af din Bludit installation på.",
|
||||
"name": "Backup"
|
||||
},
|
||||
"restore-backup": "Gendan sikkerhedskopi",
|
||||
"there-are-no-backups-for-the-moment": "Der er ingen sikkerhedskopier i øjeblikket"
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Backup",
|
||||
"description": "Einfach Backups erstellen und wieder einspielen."
|
||||
},
|
||||
"create-backup": "Backup erstellen",
|
||||
"upload-backup": "Backup hochladen",
|
||||
"download": "Backup herunterladen",
|
||||
"restore-backup": "Backup wiederherstellen",
|
||||
"delete-backup": "Backup löschen",
|
||||
"there-are-no-backups-for-the-moment": "Es gibt keine Backups.",
|
||||
"you-do-not-have-sufficient-permissions": "Du hast nicht die notwendigen Berechtigungen",
|
||||
"the-backup-was-created-successfully": "Das Backup wurde erfolgreich erstellt.",
|
||||
"the-backup-file-could-not-be-created": "Das Backup konnte nicht erstellt werden.",
|
||||
"the-backup-'%s'-could-be-restored-successfully": "Das Backup '%s' konnte erfolgreich wiederhergestellt werden.",
|
||||
"the-backup-'%s'-could-not-be-restored": "Das Backup '%s' konnte nicht wiederhergestellt werden.",
|
||||
"the-backup-'%s'-could-be-deleted-successfully": "Das Backup '%s' konnte erfolgreich gelöscht werden.",
|
||||
"the-backup-'%s'-could-not-be-deleted": "Das Backup '%s' konnte nicht gelöscht werden.",
|
||||
"the-passed-file-is-not-a-valid-zip-archive": "Die angegebene Datei ist kein gültiges ZIP Archiv.",
|
||||
"the-passed-file-does-not-end-with-zip": "Die angegebene Datei endet nicht mit .zip.",
|
||||
"the-passed-file-could-not-be-validated": "Die angegebene Datei konnte nicht geprüft werden.",
|
||||
"the-passed-file-is-not-a-valid-backup-archive": "Die angegebene Datei ist kein gültiges Backup Archiv.",
|
||||
"the-backup-file-could-be-uploaded-successfully": "Die Backup Datei konnte erfolgreich hochgeladen werden."
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Backup",
|
||||
"description": "Einfach Backups erstellen und wieder einspielen."
|
||||
},
|
||||
"create-backup": "Backup erstellen",
|
||||
"upload-backup": "Backup hochladen",
|
||||
"download": "Backup herunterladen",
|
||||
"restore-backup": "Backup wiederherstellen",
|
||||
"delete-backup": "Backup löschen",
|
||||
"there-are-no-backups-for-the-moment": "Es gibt keine Backups.",
|
||||
"you-do-not-have-sufficient-permissions": "Du hast nicht die notwendigen Berechtigungen",
|
||||
"the-backup-was-created-successfully": "Das Backup wurde erfolgreich erstellt.",
|
||||
"the-backup-file-could-not-be-created": "Das Backup konnte nicht erstellt werden.",
|
||||
"the-backup-'%s'-could-be-restored-successfully": "Das Backup '%s' konnte erfolgreich wiederhergestellt werden.",
|
||||
"the-backup-'%s'-could-not-be-restored": "Das Backup '%s' konnte nicht wiederhergestellt werden.",
|
||||
"the-backup-'%s'-could-be-deleted-successfully": "Das Backup '%s' konnte erfolgreich gelöscht werden.",
|
||||
"the-backup-'%s'-could-not-be-deleted": "Das Backup '%s' konnte nicht gelöscht werden.",
|
||||
"the-passed-file-is-not-a-valid-zip-archive": "Die angegebene Datei ist kein gültiges ZIP Archiv.",
|
||||
"the-passed-file-does-not-end-with-zip": "Die angegebene Datei endet nicht mit .zip.",
|
||||
"the-passed-file-could-not-be-validated": "Die angegebene Datei konnte nicht geprüft werden.",
|
||||
"the-passed-file-is-not-a-valid-backup-archive": "Die angegebene Datei ist kein gültiges Backup Archiv.",
|
||||
"the-backup-file-could-be-uploaded-successfully": "Die Backup Datei konnte erfolgreich hochgeladen werden."
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Backup",
|
||||
"description": "Einfach Backups erstellen und wieder einspielen."
|
||||
},
|
||||
"create-backup": "Backup erstellen",
|
||||
"upload-backup": "Backup hochladen",
|
||||
"download": "Backup herunterladen",
|
||||
"restore-backup": "Backup wiederherstellen",
|
||||
"delete-backup": "Backup löschen",
|
||||
"there-are-no-backups-for-the-moment": "Es gibt keine Backups.",
|
||||
"you-do-not-have-sufficient-permissions": "Du hast nicht die notwendigen Berechtigungen",
|
||||
"the-backup-was-created-successfully": "Das Backup wurde erfolgreich erstellt.",
|
||||
"the-backup-file-could-not-be-created": "Das Backup konnte nicht erstellt werden.",
|
||||
"the-backup-'%s'-could-be-restored-successfully": "Das Backup '%s' konnte erfolgreich wiederhergestellt werden.",
|
||||
"the-backup-'%s'-could-not-be-restored": "Das Backup '%s' konnte nicht wiederhergestellt werden.",
|
||||
"the-backup-'%s'-could-be-deleted-successfully": "Das Backup '%s' konnte erfolgreich gelöscht werden.",
|
||||
"the-backup-'%s'-could-not-be-deleted": "Das Backup '%s' konnte nicht gelöscht werden.",
|
||||
"the-passed-file-is-not-a-valid-zip-archive": "Die angegebene Datei ist kein gültiges ZIP Archiv.",
|
||||
"the-passed-file-does-not-end-with-zip": "Die angegebene Datei endet nicht mit .zip.",
|
||||
"the-passed-file-could-not-be-validated": "Die angegebene Datei konnte nicht geprüft werden.",
|
||||
"the-passed-file-is-not-a-valid-backup-archive": "Die angegebene Datei ist kein gültiges Backup Archiv.",
|
||||
"the-backup-file-could-be-uploaded-successfully": "Die Backup Datei konnte erfolgreich hochgeladen werden."
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Backup",
|
||||
"description": "The simple way to backup your Bludit."
|
||||
},
|
||||
"create-backup": "Create Backup",
|
||||
"upload-backup": "Upload Backup",
|
||||
"download": "Download",
|
||||
"restore-backup": "Restore Backup",
|
||||
"delete-backup": "Delete Backup",
|
||||
"there-are-no-backups-for-the-moment": "There are no backups for the moment",
|
||||
"you-do-not-have-sufficient-permissions": "You do not have sufficient permissions",
|
||||
"the-backup-was-created-successfully": "The Backup was created successfully.",
|
||||
"the-backup-file-could-not-be-created": "The Backup file could not be created.",
|
||||
"the-backup-'%s'-could-be-restored-successfully": "The Backup '%s' could be restored successfully.",
|
||||
"the-backup-'%s'-could-not-be-restored": "The Backup '%s' could not be restored.",
|
||||
"the-backup-'%s'-could-be-deleted-successfully": "The Backup '%s' could be deleted successfully.",
|
||||
"the-backup-'%s'-could-not-be-deleted": "The Backup '%s' could not be deleted.",
|
||||
"the-passed-file-is-not-a-valid-zip-archive": "The passed file is not a valid ZIP Archive.",
|
||||
"the-passed-file-does-not-end-with-zip": "The passed file does not ent with .zip.",
|
||||
"the-passed-file-could-not-be-validated": "The passed file could not be validated.",
|
||||
"the-passed-file-is-not-a-valid-backup-archive": "The passed file is not a valid backup archive.",
|
||||
"the-backup-file-could-be-uploaded-successfully": "The backup file could be uploaded successfully."
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Backup",
|
||||
"description": "La forma mas fácil de hacer un backup."
|
||||
},
|
||||
"create-backup": "Crear Backup",
|
||||
"download": "Descargar",
|
||||
"restore-backup": "Recuperar Backup",
|
||||
"delete-backup": "Eliminar Backup",
|
||||
"there-are-no-backups-for-the-moment": "There are no backups for the moment"
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "پشتیبان گیری",
|
||||
"description": "یک روش ساده برای پشتیبانگیری از بلودیت شما."
|
||||
},
|
||||
"create-backup": "ایجاد پشتیبانی",
|
||||
"upload-backup": "بارگذاری پشتیبانی",
|
||||
"download": "دانلود",
|
||||
"restore-backup": "بازگردانی فایل پشتیبانی",
|
||||
"delete-backup": "حذف فایل پشتیبانی",
|
||||
"there-are-no-backups-for-the-moment": "در این لحظه هیچ نسخه پشتیبانی وجود ندارد",
|
||||
"you-do-not-have-sufficient-permissions": "شما مجوزهای لازم را ندارید",
|
||||
"the-backup-was-created-successfully": "نسخه پشتیبان با موفقیت ایجاد شد.",
|
||||
"the-backup-file-could-not-be-created": "امکان ایجاد فایل پشتیبان وجود ندارد.",
|
||||
"the-backup-'%s'-could-be-restored-successfully": "فایل پشتیبانی '%s' با موفقیت بازیابی شد.",
|
||||
"the-backup-'%s'-could-not-be-restored": "فایل پشتیبانی '%s' نمی تواند بازیابی شود.",
|
||||
"the-backup-'%s'-could-be-deleted-successfully": "فایل پشتیبانی '%s' با موفقیت حذف شد.",
|
||||
"the-backup-'%s'-could-not-be-deleted": "فایل پشتیبانی '%s' نمی تواند حذف شود.",
|
||||
"the-passed-file-is-not-a-valid-zip-archive": "فایل انتخاب شده یک فایل ZIP معتبری نمیباشد.",
|
||||
"the-passed-file-does-not-end-with-zip": "فایل انتخاب شده با پسوند zip تمام نمی شود.",
|
||||
"the-passed-file-could-not-be-validated": "فایل انتخاب شده را نمی توان اعتبارسنجی کرد.",
|
||||
"the-passed-file-is-not-a-valid-backup-archive": "فایل انتخاب شده یک فایل معتبر نسخه پشتیبان نمی باشد.",
|
||||
"the-backup-file-could-be-uploaded-successfully": "فایل پشتیبانی با موفقیت آپلود شد."
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Sauvegarde",
|
||||
"description": "Un moyen simple de sauvegarder votre Bludit."
|
||||
},
|
||||
"create-backup": "Créer une sauvegarde",
|
||||
"upload-backup": "Charger une sauvegarde",
|
||||
"download": "Télécharger",
|
||||
"restore-backup": "Restaurer la sauvegarde",
|
||||
"delete-backup": "Supprimer la sauvegarde",
|
||||
"there-are-no-backups-for-the-moment": "Il n'y a pas de sauvegardes pour le moment",
|
||||
"you-do-not-have-sufficient-permissions": "Vous n'avez pas les autorisations suffisantes",
|
||||
"the-backup-was-created-successfully": "La sauvegarde a été créée avec succès.",
|
||||
"the-backup-file-could-not-be-created": "Le fichier de sauvegarde n'a pas pu être créé.",
|
||||
"the-backup-'%s'-could-be-restored-successfully": "La sauvegarde '%s' a pu être restaurée avec succès.",
|
||||
"the-backup-'%s'-could-not-be-restored": "La sauvegarde '%s' n'a pas pu être restaurée.",
|
||||
"the-backup-'%s'-could-be-deleted-successfully": "La sauvegarde '%s' a été supprimée avec succès.",
|
||||
"the-backup-'%s'-could-not-be-deleted": "La sauvegarde '%s' n'a pas pu être supprimée.",
|
||||
"the-passed-file-is-not-a-valid-zip-archive": "Le fichier transmis n'est pas une archive ZIP valide.",
|
||||
"the-passed-file-does-not-end-with-zip": "Le fichier transmis ne comporte pas de .zip.",
|
||||
"the-passed-file-could-not-be-validated": "Le fichier transmis n'a pas pu être validé.",
|
||||
"the-passed-file-is-not-a-valid-backup-archive": "Le fichier transmis n'est pas une archive de sauvegarde valide.",
|
||||
"the-backup-file-could-be-uploaded-successfully": "Le fichier de sauvegarde a pu être téléchargé avec succès."
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Backup",
|
||||
"description": "Il modo semplice per fare il backup di Bludit."
|
||||
},
|
||||
"create-backup": "Crea Backup",
|
||||
"download": "Scarica",
|
||||
"restore-backup": "Ripristina Backup",
|
||||
"delete-backup": "Elimina Backup",
|
||||
"there-are-no-backups-for-the-moment": "Non ci sono backup al momento"
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Backup",
|
||||
"description": "Bluditを簡単にバックアップします。"
|
||||
},
|
||||
"create-backup": "バックアップを作成",
|
||||
"download": "ダウンロード",
|
||||
"restore-backup": "バックアップをリストア",
|
||||
"delete-backup": "バックアップを削除",
|
||||
"there-are-no-backups-for-the-moment": "現在、バックアップはありません"
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Backup",
|
||||
"description": "Eenvoudige manier om backups van Bludit-gegevens te maken."
|
||||
},
|
||||
"create-backup": "Backup maken",
|
||||
"download": "Downloaden",
|
||||
"restore-backup": "Herstellen",
|
||||
"delete-backup": "Verwijderen",
|
||||
"there-are-no-backups-for-the-moment": "Er zijn geen backups."
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Резервные копии",
|
||||
"description": "Самый простой способ создать резервную копию вашего сайта."
|
||||
},
|
||||
"create-backup": "Создать резервную копию",
|
||||
"download": "Загрузить",
|
||||
"restore-backup": "Восстановление из резервной копии",
|
||||
"delete-backup": "Удалить резервную копию",
|
||||
"there-are-no-backups-for-the-moment": "На данный момент резервных копий нет"
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Yedekleme",
|
||||
"description": "Yedek oluşturmak için en kolay yol."
|
||||
},
|
||||
"create-backup": "Yedek oluştur",
|
||||
"download": "İndir",
|
||||
"restore-backup": "Geri yükle",
|
||||
"delete-backup": "Yedeklemeyi sil",
|
||||
"there-are-no-backups-for-the-moment": "Şu an için yedek yok"
|
||||
}
|
|
@ -1,344 +0,0 @@
|
|||
<?php
|
||||
|
||||
class pluginBackup extends Plugin {
|
||||
|
||||
// Directories to backup
|
||||
private $directoriesToBackup = array(
|
||||
PATH_PAGES,
|
||||
PATH_DATABASES,
|
||||
PATH_UPLOADS
|
||||
);
|
||||
|
||||
// This variable define if the extension zip is loaded
|
||||
private $zip = false;
|
||||
|
||||
// The last request status
|
||||
private $lastStatus = null;
|
||||
|
||||
// The last request message
|
||||
private $lastMessage = null;
|
||||
|
||||
public function init()
|
||||
{
|
||||
// Disable default form buttons (Save and Cancel)
|
||||
$this->formButtons = false;
|
||||
|
||||
// Check for zip extension installed
|
||||
$this->zip = extension_loaded('zip');
|
||||
|
||||
// Get Last Message
|
||||
if (empty($_POST) && !empty(Session::get("BACKUP-MESSAGE"))) {
|
||||
$this->lastStatus = Session::get("BACKUP-STATUS");
|
||||
$this->lastMessage = Session::get("BACKUP-MESSAGE");
|
||||
unset($_SESSION["s_BACKUP-STATUS"]);
|
||||
unset($_SESSION["s_BACKUP-MESSAGE"]);
|
||||
}
|
||||
}
|
||||
|
||||
protected function response($status, $message)
|
||||
{
|
||||
// Return JSON object for AJAX requests
|
||||
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strcasecmp($_SERVER['HTTP_X_REQUESTED_WITH'], "xmlhttprequest") === 0) {
|
||||
$http = array(
|
||||
200 => "200 OK",
|
||||
400 => "400 Bad Request",
|
||||
415 => "415 Unsupported Media Type"
|
||||
);
|
||||
header("HTTP/1.1 " . $http[$status]);
|
||||
print(json_encode(array(
|
||||
"status" => $status < 400,
|
||||
"message" => $message
|
||||
)));
|
||||
die();
|
||||
}
|
||||
|
||||
// Store in Session
|
||||
Session::set("BACKUP-STATUS", $status < 400);
|
||||
Session::set("BACKUP-MESSAGE", $message);
|
||||
return $status < 400;
|
||||
}
|
||||
|
||||
public function post()
|
||||
{
|
||||
if (isset($_POST['createBackup'])) {
|
||||
return $this->createBackup();
|
||||
} elseif (isset($_POST['restoreBackup'])) {
|
||||
return $this->restoreBackup($_POST['restoreBackup']);
|
||||
} elseif (isset($_POST['deleteBackup'])) {
|
||||
return $this->deleteBackup($_POST['deleteBackup']);
|
||||
}
|
||||
|
||||
if (isset($_FILES['backupFile'])) {
|
||||
return $this->uploadBackup($_FILES['backupFile']);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function adminHead()
|
||||
{
|
||||
global $url;
|
||||
|
||||
if ($url->slug() !== "configure-plugin/pluginBackup") {
|
||||
return false;
|
||||
}
|
||||
|
||||
$html = $this->includeJS('backup.js');
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function adminSidebar()
|
||||
{
|
||||
global $login;
|
||||
if ($login->role() === 'admin') {
|
||||
$backups = $this->backupList();
|
||||
return '<a class="nav-link" href="'.HTML_PATH_ADMIN_ROOT.'configure-plugin/'.$this->className().'">Backups <span class="badge badge-primary badge-pill">'.count($backups).'</span></a>';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $L;
|
||||
|
||||
$backups = $this->backupList();
|
||||
|
||||
$html = '';
|
||||
if (empty($backups)) {
|
||||
$html .= '<div class="alert alert-primary" role="alert">';
|
||||
$html .= $L->get('There are no backups for the moment');
|
||||
$html .= '</div>';
|
||||
}
|
||||
|
||||
if($this->lastStatus !== null) {
|
||||
$html .= '<div class="alert alert-' . ($this->lastStatus? "success": "danger") . '" role="alert">';
|
||||
$html .= $this->lastMessage;
|
||||
$html .= '</div>';
|
||||
}
|
||||
|
||||
$html .= '<div class="row">';
|
||||
$html .= '<div class="col text-left">';
|
||||
$html .= '<button name="createBackup" value="true" class="btn btn-primary" type="submit"><span class="fa fa-play-circle"></span> '.$L->get('create-backup').'</button>';
|
||||
$html .= '</div>';
|
||||
$html .= '<div class="col-5 text-right">';
|
||||
if ($this->zip) {
|
||||
$html .= '<input id="backupFile" type="file" name="backupFile" value="" style="position:absolute;top:-500em;" />';
|
||||
$html .= '<label for="backupFile" value="true" class="btn btn-light d-inline-block" type="submit" style="margin-top:0 !important;"><span class="fa fa-upload"></span> '.$L->get('upload-backup').'</label>';
|
||||
}
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
$html .= '<hr>';
|
||||
|
||||
foreach ($backups as $backup) {
|
||||
$filename = pathinfo($backup,PATHINFO_FILENAME);
|
||||
$basename = pathinfo($backup,PATHINFO_BASENAME);
|
||||
|
||||
// Format Title
|
||||
list($name, $count) = array_pad(explode(".", $filename, 2), 2, 0);
|
||||
if (($temp = Date::format($name, BACKUP_DATE_FORMAT, 'F j, Y, g:i a')) !== false) {
|
||||
$name = $temp;
|
||||
}
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<h4 class="font-weight-normal">'.$name.($count > 0? " ($count)": "").'</h4>';
|
||||
// Allow download if a zip file
|
||||
if ($this->zip) {
|
||||
$html .= '<a class="btn btn-outline-secondary btn-sm mr-1 mt-1" href="'.DOMAIN_BASE.'plugin-backup-download?file='.$filename.'.zip"><span class="fa fa-download"></span> '.$L->get('download').'</a>';
|
||||
}
|
||||
$html .= '<button name="restoreBackup" value="'.$filename.'" class="btn btn-outline-secondary btn-sm mr-1 mt-1" type="submit"><span class="fa fa-rotate-left"></span> '.$L->get('restore-backup').'</button>';
|
||||
$html .= '<button name="deleteBackup" value="'.$filename.'" class="btn btn-outline-danger btn-sm mr-1 mt-1" type="submit"><span class="fa fa-trash"></span> '.$L->get('delete-backup').'</button>';
|
||||
$html .= '</div>';
|
||||
$html .= '<hr>';
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloading Backups is not allowed by default server config
|
||||
* This webhook is to allow downloads for admins
|
||||
* Webhook: plugin-backup-download?file={backup-name.zip}
|
||||
*/
|
||||
public function beforeAll()
|
||||
{
|
||||
global $L;
|
||||
$webhook = 'plugin-backup-download';
|
||||
if ($this->webhook($webhook)) {
|
||||
if (!empty($_GET['file'])) {
|
||||
$login = new Login();
|
||||
if ($login->role() === 'admin') {
|
||||
$existingBackups = array_map('basename', glob(PATH_WORKSPACES.'backup/*.zip'));
|
||||
if (in_array($_GET['file'], $existingBackups)) {
|
||||
downloadRestrictedFile(PATH_WORKSPACES.'backup/'.$_GET['file']);
|
||||
}
|
||||
} else {
|
||||
Alert::set($L->g('You do not have sufficient permissions'));
|
||||
Redirect::page('dashboard');
|
||||
}
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
public function backupList()
|
||||
{
|
||||
if ($this->zip) {
|
||||
$backups = Filesystem::listFiles($this->workspace(), '*', 'zip', true);
|
||||
} else {
|
||||
$backups = Filesystem::listDirectories($this->workspace(), '*', true);
|
||||
}
|
||||
return $backups;
|
||||
}
|
||||
|
||||
public function createBackup()
|
||||
{
|
||||
global $L;
|
||||
|
||||
// Current backup directory
|
||||
$currentDate = Date::current(BACKUP_DATE_FORMAT);
|
||||
$backupDir = $this->workspace().$currentDate;
|
||||
|
||||
// Copy directories to backup directory
|
||||
// $directoriesToBackup is a private variable of this class
|
||||
foreach ($this->directoriesToBackup as $dir) {
|
||||
$destination = $backupDir.DS.basename($dir);
|
||||
Filesystem::copyRecursive($dir, $destination);
|
||||
}
|
||||
|
||||
// Compress backup directory
|
||||
if ($this->zip) {
|
||||
if (Filesystem::zip($backupDir, $backupDir.'.zip')) {
|
||||
Filesystem::deleteRecursive($backupDir);
|
||||
}
|
||||
|
||||
// Add validation file
|
||||
$zip = new ZipArchive();
|
||||
$zip->open($backupDir.'.zip');
|
||||
$zip->addFromString('.BLUDIT_BACKUP', md5_file($backupDir.'.zip'));
|
||||
$zip->close();
|
||||
}
|
||||
|
||||
if (file_exists($backupDir.'.zip')) {
|
||||
return $this->response(200, $L->get("The Backup was created successfully."));
|
||||
}
|
||||
|
||||
return $this->response(400, $L->get("The Backup file could not be created."));
|
||||
}
|
||||
|
||||
public function validateBackup($filename)
|
||||
{
|
||||
$tmp = PATH_TMP.'backup-'.time().'.zip';
|
||||
copy($filename, $tmp);
|
||||
|
||||
// Check Archive
|
||||
$zip = new ZipArchive();
|
||||
if($zip->open($tmp) !== true) {
|
||||
unlink($tmp);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check Basic Folders
|
||||
if ($zip->addEmptyDir("databases") || $zip->addEmptyDir("pages") || $zip->addEmptyDir("uploads")) {
|
||||
$zip->close();
|
||||
unlink($tmp);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check Checksum
|
||||
if (($checksum = $zip->getFromName(".BLUDIT_BACKUP")) === false) {
|
||||
$zip->close();
|
||||
unlink($tmp);
|
||||
return false;
|
||||
}
|
||||
$zip->deleteName(".BLUDIT_BACKUP");
|
||||
$zip->close();
|
||||
$check = $checksum === md5_file($tmp);
|
||||
|
||||
// Return
|
||||
unlink($tmp);
|
||||
return $check;
|
||||
}
|
||||
|
||||
public function restoreBackup($filename)
|
||||
{
|
||||
global $L;
|
||||
|
||||
// Remove current files
|
||||
foreach ($this->directoriesToBackup as $dir) {
|
||||
Filesystem::deleteRecursive($dir);
|
||||
}
|
||||
|
||||
// Recover backuped files
|
||||
if ($this->zip) {
|
||||
// Zip format
|
||||
$tmp = $this->workspace().$filename.'.zip';
|
||||
$status = Filesystem::unzip($tmp, PATH_CONTENT);
|
||||
} else {
|
||||
// Directory format
|
||||
$tmp = $this->workspace().$filename;
|
||||
$status = Filesystem::copyRecursive($tmp, PATH_CONTENT);
|
||||
}
|
||||
|
||||
if ($status) {
|
||||
return $this->response(200, sprintf($L->get("The Backup '%s' could be restored successfully."), $filename));
|
||||
}
|
||||
return $this->response(400, sprintf($L->get("The Backup '%s' could not be restored."), $filename));
|
||||
}
|
||||
|
||||
public function deleteBackup($filename)
|
||||
{
|
||||
global $L;
|
||||
|
||||
if ($this->zip) {
|
||||
// Zip format
|
||||
$tmp = $this->workspace().$filename.'.zip';
|
||||
$status = Filesystem::rmfile($tmp);
|
||||
} else {
|
||||
// Directory format
|
||||
$tmp = $this->workspace().$filename;
|
||||
$status = Filesystem::deleteRecursive($tmp);
|
||||
}
|
||||
|
||||
if ($status) {
|
||||
return $this->response(200, sprintf($L->get("The Backup '%s' could be deleted successfully."), $filename));
|
||||
}
|
||||
return $this->response(400, sprintf($L->get("The Backup '%s' could not be deleted."), $filename));
|
||||
}
|
||||
|
||||
public function uploadBackup($backup)
|
||||
{
|
||||
global $L;
|
||||
|
||||
// Check File Type
|
||||
if ($backup["type"] !== "application/zip" && $backup["type"] !== "application/x-zip-compressed") {
|
||||
return $this->response(415, $L->get("The passed file is not a valid ZIP Archive."));
|
||||
}
|
||||
|
||||
// Check File Extension
|
||||
if (stripos($backup["name"], ".zip") !== (strlen($backup["name"]) - 4)) {
|
||||
return $this->response(415, $L->get("The passed file does not end with .zip."));
|
||||
}
|
||||
|
||||
// Check ZIP extension
|
||||
if(!$this->zip) {
|
||||
return $this->response(400, $L->get("The passed file could not be validated."));
|
||||
}
|
||||
|
||||
// Validate Backup ZIP
|
||||
if (!$this->validateBackup($backup["tmp_name"])) {
|
||||
return $this->response(415, $L->get("The passed file is not a valid backup archive."));
|
||||
}
|
||||
|
||||
// File Name
|
||||
$name = $backup["name"];
|
||||
$count = 0;
|
||||
while (file_exists($this->workspace() . $name)) {
|
||||
$name = substr($backup["name"], 0, -4) . "." . ++$count . ".zip";
|
||||
}
|
||||
|
||||
// Move File to Backup Directory
|
||||
Filesystem::mv($backup["tmp_name"], $this->workspace() . $name);
|
||||
return $this->response(200, $L->get("The backup file could be uploaded successfully."));
|
||||
}
|
||||
}
|
7
bl-plugins/canonical/languages/ru.json
Normal file
7
bl-plugins/canonical/languages/ru.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Canonical",
|
||||
"description": "Плагин для использоания канонических URL-адресов. Использование канонических URL-адресов может помочь сообщить поисковым системам, какие URL-адреса имеют идентичный контент."
|
||||
}
|
||||
}
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.14.0",
|
||||
"releaseDate": "2022-08-05",
|
||||
"version": "3.16.2",
|
||||
"releaseDate": "2024-08-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.14.0",
|
||||
"compatible": "3.16.2",
|
||||
"notes": ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.14.0",
|
||||
"releaseDate": "2022-08-05",
|
||||
"version": "3.16.2",
|
||||
"releaseDate": "2024-08-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.14.0",
|
||||
"compatible": "3.16.2",
|
||||
"notes": ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
<?php
|
||||
|
||||
class pluginCategories extends Plugin {
|
||||
class pluginCategories extends Plugin
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
// Fields and default values for the database of this plugin
|
||||
$this->dbFields = array(
|
||||
'label'=>'Categories',
|
||||
'hideCero'=>true
|
||||
'label' => 'Categories',
|
||||
'hideCero' => true
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -21,16 +22,16 @@ class pluginCategories extends Plugin {
|
|||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Label').'</label>';
|
||||
$html .= '<input name="label" type="text" value="'.$this->getValue('label').'">';
|
||||
$html .= '<span class="tip">'.$L->get('This title is almost always used in the sidebar of the site').'</span>';
|
||||
$html .= '<label>' . $L->get('Label') . '</label>';
|
||||
$html .= '<input name="label" type="text" dir="auto" value="' . $this->getValue('label') . '">';
|
||||
$html .= '<span class="tip">' . $L->get('This title is almost always used in the sidebar of the site') . '</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Hide Categories without content').'</label>';
|
||||
$html .= '<label>' . $L->get('Hide Categories without content') . '</label>';
|
||||
$html .= '<select name="hideCero">';
|
||||
$html .= '<option value="true" '.($this->getValue('hideCero')===true?'selected':'').'>'.$L->get('Enabled').'</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('hideCero')===false?'selected':'').'>'.$L->get('Disabled').'</option>';
|
||||
$html .= '<option value="true" ' . ($this->getValue('hideCero') === true ? 'selected' : '') . '>' . $L->get('Enabled') . '</option>';
|
||||
$html .= '<option value="false" ' . ($this->getValue('hideCero') === false ? 'selected' : '') . '>' . $L->get('Disabled') . '</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '</div>';
|
||||
|
||||
|
@ -45,27 +46,27 @@ class pluginCategories extends Plugin {
|
|||
|
||||
// HTML for sidebar
|
||||
$html = '<div class="plugin plugin-categories">';
|
||||
$html .= '<h2 class="plugin-label">'.$this->getValue('label').'</h2>';
|
||||
$html .= '<h2 class="plugin-label">' . $this->getValue('label') . '</h2>';
|
||||
$html .= '<div class="plugin-content">';
|
||||
$html .= '<ul>';
|
||||
|
||||
// By default the database of categories are alphanumeric sorted
|
||||
foreach ($categories->db as $key=>$fields) {
|
||||
foreach ($categories->db as $key => $fields) {
|
||||
$count = count($fields['list']);
|
||||
if (!$this->getValue('hideCero') || $count>0) {
|
||||
if (!$this->getValue('hideCero') || $count > 0) {
|
||||
$html .= '<li>';
|
||||
$html .= '<a href="'.DOMAIN_CATEGORIES.$key.'">';
|
||||
$html .= '<a href="' . DOMAIN_CATEGORIES . $key . '">';
|
||||
$html .= $fields['name'];
|
||||
$html .= ' ('.count($fields['list']).')';
|
||||
$html .= ' (' . count($fields['list']) . ')';
|
||||
$html .= '</a>';
|
||||
$html .= '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
$html .= '</ul>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.14.0",
|
||||
"releaseDate": "2022-08-05",
|
||||
"version": "3.16.2",
|
||||
"releaseDate": "2024-08-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.14.0",
|
||||
"compatible": "3.16.2",
|
||||
"notes": ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.14.0",
|
||||
"releaseDate": "2022-08-05",
|
||||
"version": "3.16.2",
|
||||
"releaseDate": "2024-08-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.14.0",
|
||||
"compatible": "3.16.2",
|
||||
"notes": ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
<?php
|
||||
|
||||
class pluginDisqus extends Plugin {
|
||||
class pluginDisqus extends Plugin
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->dbFields = array(
|
||||
'shortname'=>'',
|
||||
'enablePages'=>true,
|
||||
'enableStatic'=>true,
|
||||
'enableSticky'=>true
|
||||
'shortname' => '',
|
||||
'enablePages' => true,
|
||||
'enableStatic' => true,
|
||||
'enableSticky' => true
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -21,34 +22,34 @@ class pluginDisqus extends Plugin {
|
|||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('disqus-shortname').'</label>';
|
||||
$html .= '<input name="shortname" id="jsshortname" type="text" value="'.$this->getValue('shortname').'">';
|
||||
$html .= '<span class="tip">'.$L->get('Get the shortname from the Disqus general settings').'</span>';
|
||||
$html .= '<label>' . $L->get('disqus-shortname') . '</label>';
|
||||
$html .= '<input name="shortname" id="jsshortname" type="text" dir="auto" value="' . $this->getValue('shortname') . '">';
|
||||
$html .= '<span class="tip">' . $L->get('Get the shortname from the Disqus general settings') . '</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('enable-disqus-on-pages').'</label>';
|
||||
$html .= '<select name="enablePages">';
|
||||
$html .= '<option value="true" '.($this->getValue('enablePages')===true?'selected':'').'>'.$L->get('enabled').'</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('enablePages')===false?'selected':'').'>'.$L->get('disabled').'</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '<div>';
|
||||
$html .= '<label>' . $L->get('enable-disqus-on-pages') . '</label>';
|
||||
$html .= '<select name="enablePages">';
|
||||
$html .= '<option value="true" ' . ($this->getValue('enablePages') === true ? 'selected' : '') . '>' . $L->get('enabled') . '</option>';
|
||||
$html .= '<option value="false" ' . ($this->getValue('enablePages') === false ? 'selected' : '') . '>' . $L->get('disabled') . '</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('enable-disqus-on-static-pages').'</label>';
|
||||
$html .= '<select name="enableStatic">';
|
||||
$html .= '<option value="true" '.($this->getValue('enableStatic')===true?'selected':'').'>'.$L->get('enabled').'</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('enableStatic')===false?'selected':'').'>'.$L->get('disabled').'</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '<div>';
|
||||
$html .= '<label>' . $L->get('enable-disqus-on-static-pages') . '</label>';
|
||||
$html .= '<select name="enableStatic">';
|
||||
$html .= '<option value="true" ' . ($this->getValue('enableStatic') === true ? 'selected' : '') . '>' . $L->get('enabled') . '</option>';
|
||||
$html .= '<option value="false" ' . ($this->getValue('enableStatic') === false ? 'selected' : '') . '>' . $L->get('disabled') . '</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('enable-disqus-on-sticky-pages').'</label>';
|
||||
$html .= '<select name="enableSticky">';
|
||||
$html .= '<option value="true" '.($this->getValue('enableSticky')===true?'selected':'').'>'.$L->get('enabled').'</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('enableSticky')===false?'selected':'').'>'.$L->get('disabled').'</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '</div>';
|
||||
$html .= '<div>';
|
||||
$html .= '<label>' . $L->get('enable-disqus-on-sticky-pages') . '</label>';
|
||||
$html .= '<select name="enableSticky">';
|
||||
$html .= '<option value="true" ' . ($this->getValue('enableSticky') === true ? 'selected' : '') . '>' . $L->get('enabled') . '</option>';
|
||||
$html .= '<option value="false" ' . ($this->getValue('enableSticky') === false ? 'selected' : '') . '>' . $L->get('disabled') . '</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
@ -63,7 +64,7 @@ class pluginDisqus extends Plugin {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($WHERE_AM_I==='page') {
|
||||
if ($WHERE_AM_I === 'page') {
|
||||
global $page;
|
||||
if ($page->published() && $this->getValue('enablePages')) {
|
||||
return $this->javascript();
|
||||
|
@ -86,7 +87,7 @@ class pluginDisqus extends Plugin {
|
|||
$pageID = $page->uuid();
|
||||
$shortname = $this->getValue('shortname');
|
||||
|
||||
$code = <<<EOF
|
||||
$code = <<<EOF
|
||||
<!-- Disqus plugin -->
|
||||
<div id="disqus_thread"></div>
|
||||
<script>
|
||||
|
@ -108,5 +109,4 @@ $code = <<<EOF
|
|||
EOF;
|
||||
return $code;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
900
bl-plugins/easymde/css/easymde.min.css
vendored
900
bl-plugins/easymde/css/easymde.min.css
vendored
File diff suppressed because one or more lines are too long
4
bl-plugins/easymde/js/easymde.min.js
vendored
4
bl-plugins/easymde/js/easymde.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -2,9 +2,9 @@
|
|||
"author": "EasyMDE",
|
||||
"email": "",
|
||||
"website": "https://easymde.tk",
|
||||
"version": "2.12.0",
|
||||
"releaseDate": "2020-09-29",
|
||||
"version": "2.18.0",
|
||||
"releaseDate": "2022-09-20",
|
||||
"license": "MIT",
|
||||
"compatible": "3.14.0",
|
||||
"compatible": "3.16.2",
|
||||
"notes": ""
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
class plugineasyMDE extends Plugin {
|
||||
class plugineasyMDE extends Plugin
|
||||
{
|
||||
|
||||
// The plugin is going to be loaded in this views
|
||||
private $loadOnViews = array(
|
||||
|
@ -11,9 +12,9 @@ class plugineasyMDE extends Plugin {
|
|||
public function init()
|
||||
{
|
||||
$this->dbFields = array(
|
||||
'tabSize'=>'2',
|
||||
'toolbar'=>'"bold", "italic", "heading", "|", "quote", "unordered-list", "|", "link", "image", "code", "horizontal-rule", "|", "preview", "side-by-side", "fullscreen"',
|
||||
'spellChecker'=>true
|
||||
'tabSize' => '2',
|
||||
'toolbar' => '"bold", "italic", "heading", "|", "quote", "unordered-list", "|", "link", "image", "code", "horizontal-rule", "|", "preview", "side-by-side", "fullscreen"',
|
||||
'spellChecker' => true
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -22,20 +23,20 @@ class plugineasyMDE extends Plugin {
|
|||
global $L;
|
||||
|
||||
$html = '<div>';
|
||||
$html .= '<label>'.$L->get('toolbar').'</label>';
|
||||
$html .= '<input name="toolbar" id="jstoolbar" type="text" value="'.$this->getValue('toolbar').'">';
|
||||
$html .= '<label>' . $L->get('toolbar') . '</label>';
|
||||
$html .= '<input name="toolbar" id="jstoolbar" type="text" dir="auto" value="' . $this->getValue('toolbar') . '">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('tab-size').'</label>';
|
||||
$html .= '<input name="tabSize" id="jstabSize" type="text" value="'.$this->getValue('tabSize').'">';
|
||||
$html .= '<label>' . $L->get('tab-size') . '</label>';
|
||||
$html .= '<input name="tabSize" id="jstabSize" type="text" dir="auto" value="' . $this->getValue('tabSize') . '">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('spell-checker').'</label>';
|
||||
$html .= '<label>' . $L->get('spell-checker') . '</label>';
|
||||
$html .= '<select name="spellChecker">';
|
||||
$html .= '<option value="true" '.($this->getValue('spellChecker')===true?'selected':'').'>'.$L->get('enabled').'</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('spellChecker')===false?'selected':'').'>'.$L->get('disabled').'</option>';
|
||||
$html .= '<option value="true" ' . ($this->getValue('spellChecker') === true ? 'selected' : '') . '>' . $L->get('enabled') . '</option>';
|
||||
$html .= '<option value="false" ' . ($this->getValue('spellChecker') === false ? 'selected' : '') . '>' . $L->get('disabled') . '</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '</div>';
|
||||
|
||||
|
@ -64,15 +65,15 @@ class plugineasyMDE extends Plugin {
|
|||
global $L;
|
||||
$langImage = $L->g('Image description');
|
||||
|
||||
$spellCheckerEnable = $this->getValue('spellChecker')?'true':'false';
|
||||
$spellCheckerEnable = $this->getValue('spellChecker') ? 'true' : 'false';
|
||||
$tabSize = $this->getValue('tabSize');
|
||||
$toolbar = Sanitize::htmlDecode($this->getValue('toolbar'));
|
||||
$pageBreak = PAGE_BREAK;
|
||||
|
||||
// Javascript path and file
|
||||
$jsEasyMDE = $this->domainPath().'js/easymde.min.js?version='.BLUDIT_VERSION;
|
||||
$jsEasyMDE = $this->domainPath() . 'js/easymde.min.js?version=' . BLUDIT_VERSION;
|
||||
|
||||
return <<<EOF
|
||||
return <<<EOF
|
||||
<script charset="utf-8" src="$jsEasyMDE"></script>
|
||||
<script>
|
||||
var easymde = null;
|
||||
|
@ -120,4 +121,4 @@ return <<<EOF
|
|||
</script>
|
||||
EOF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.14.0",
|
||||
"releaseDate": "2022-08-05",
|
||||
"version": "3.16.2",
|
||||
"releaseDate": "2024-08-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.14.0",
|
||||
"compatible": "3.16.2",
|
||||
"notes": ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
<?php
|
||||
|
||||
class pluginHitCounter extends Plugin {
|
||||
class pluginHitCounter extends Plugin
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->dbFields = array(
|
||||
'label'=>'Hit Counter',
|
||||
'showUniqueVisitors'=>false
|
||||
'label' => 'Hit Counter',
|
||||
'showUniqueVisitors' => false
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -34,17 +35,17 @@ class pluginHitCounter extends Plugin {
|
|||
|
||||
// Label of the plugin to show in the sidebar
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Label').'</label>';
|
||||
$html .= '<input name="label" type="text" value="'.$this->getValue('label').'">';
|
||||
$html .= '<span class="tip">'.$L->get('This title is almost always used in the sidebar of the site').'</span>';
|
||||
$html .= '<label>' . $L->get('Label') . '</label>';
|
||||
$html .= '<input name="label" type="text" dir="auto" value="' . $this->getValue('label') . '">';
|
||||
$html .= '<span class="tip">' . $L->get('This title is almost always used in the sidebar of the site') . '</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
// Form "select" element for enable or disable Unique visitors properties
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Show unique visitors').'</label>';
|
||||
$html .= '<label>' . $L->get('Show unique visitors') . '</label>';
|
||||
$html .= '<select name="showUniqueVisitors">';
|
||||
$html .= '<option value="true" '.($this->getValue('showUniqueVisitors')===true?'selected':'').'>'.$L->get('Enabled').'</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('showUniqueVisitors')===false?'selected':'').'>'.$L->get('Disabled').'</option>';
|
||||
$html .= '<option value="true" ' . ($this->getValue('showUniqueVisitors') === true ? 'selected' : '') . '>' . $L->get('Enabled') . '</option>';
|
||||
$html .= '<option value="false" ' . ($this->getValue('showUniqueVisitors') === false ? 'selected' : '') . '>' . $L->get('Disabled') . '</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '</div>';
|
||||
|
||||
|
@ -74,12 +75,12 @@ class pluginHitCounter extends Plugin {
|
|||
|
||||
// Show in the sidebar the number of visitors
|
||||
$html = '<div class="plugin plugin-hit-counter">';
|
||||
$html .= '<h2 class="plugin-label">'.$this->getValue('label').'</h2>';
|
||||
$html .= '<h2 class="plugin-label">' . $this->getValue('label') . '</h2>';
|
||||
$html .= '<div class="plugin-content">';
|
||||
$html .= '<div class="counter">'.$counter.'</div>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
$html .= '<div class="counter">' . $counter . '</div>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.14.0",
|
||||
"releaseDate": "2022-08-05",
|
||||
"version": "3.16.2",
|
||||
"releaseDate": "2024-08-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.14.0",
|
||||
"compatible": "3.16.2",
|
||||
"notes": ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.14.0",
|
||||
"releaseDate": "2022-08-05",
|
||||
"version": "3.16.2",
|
||||
"releaseDate": "2024-08-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.14.0",
|
||||
"compatible": "3.16.2",
|
||||
"notes": ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
<?php
|
||||
|
||||
class pluginLinks extends Plugin {
|
||||
class pluginLinks extends Plugin
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
// JSON database
|
||||
$jsondb = json_encode(array(
|
||||
'Bludit'=>'https://www.bludit.com',
|
||||
'Bludit PRO'=>'https://pro.bludit.com'
|
||||
'Bludit' => 'https://www.bludit.com',
|
||||
'Bludit PRO' => 'https://pro.bludit.com'
|
||||
));
|
||||
|
||||
// Fields and default values for the database of this plugin
|
||||
$this->dbFields = array(
|
||||
'label'=>'Links',
|
||||
'jsondb'=>$jsondb
|
||||
'label' => 'Links',
|
||||
'jsondb' => $jsondb
|
||||
);
|
||||
|
||||
// Disable default Save and Cancel button
|
||||
|
@ -32,20 +33,21 @@ class pluginLinks extends Plugin {
|
|||
$links = json_decode($jsondb, true);
|
||||
|
||||
// Check if the user click on the button delete or add
|
||||
if( isset($_POST['deleteLink']) ) {
|
||||
if (isset($_POST['deleteLink'])) {
|
||||
// Values from $_POST
|
||||
$name = $_POST['deleteLink'];
|
||||
|
||||
// Delete the link from the array
|
||||
unset($links[$name]);
|
||||
}
|
||||
elseif( isset($_POST['addLink']) ) {
|
||||
} elseif (isset($_POST['addLink'])) {
|
||||
// Values from $_POST
|
||||
$name = $_POST['linkName'];
|
||||
$url = $_POST['linkURL'];
|
||||
|
||||
// Check empty string
|
||||
if( empty($name) ) { return false; }
|
||||
if (empty($name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Add the link
|
||||
$links[$name] = $url;
|
||||
|
@ -69,52 +71,52 @@ class pluginLinks extends Plugin {
|
|||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Label').'</label>';
|
||||
$html .= '<input name="label" class="form-control" type="text" value="'.$this->getValue('label').'">';
|
||||
$html .= '<span class="tip">'.$L->get('This title is almost always used in the sidebar of the site').'</span>';
|
||||
$html .= '<label>' . $L->get('Label') . '</label>';
|
||||
$html .= '<input name="label" class="form-control" type="text" dir="auto" value="' . $this->getValue('label') . '">';
|
||||
$html .= '<span class="tip">' . $L->get('This title is almost always used in the sidebar of the site') . '</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<button name="save" class="btn btn-primary my-2" type="submit">'.$L->get('Save').'</button>';
|
||||
$html .= '<button name="save" class="btn btn-primary my-2" type="submit">' . $L->get('Save') . '</button>';
|
||||
$html .= '</div>';
|
||||
|
||||
// New link, when the user click on save button this call the method post()
|
||||
// and the new link is added to the database
|
||||
$html .= '<h4 class="mt-3">'.$L->get('Add a new link').'</h4>';
|
||||
$html .= '<h4 class="mt-3">' . $L->get('Add a new link') . '</h4>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Name').'</label>';
|
||||
$html .= '<input name="linkName" type="text" class="form-control" value="" placeholder="Bludit">';
|
||||
$html .= '<label>' . $L->get('Name') . '</label>';
|
||||
$html .= '<input name="linkName" type="text" dir="auto" class="form-control" value="" placeholder="Bludit">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Url').'</label>';
|
||||
$html .= '<input name="linkURL" type="text" class="form-control" value="" placeholder="https://www.bludit.com/">';
|
||||
$html .= '<label>' . $L->get('Url') . '</label>';
|
||||
$html .= '<input name="linkURL" type="text" dir="auto" class="form-control" value="" placeholder="https://www.bludit.com/">';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<button name="addLink" class="btn btn-primary my-2" type="submit">'.$L->get('Add').'</button>';
|
||||
$html .= '<button name="addLink" class="btn btn-primary my-2" type="submit">' . $L->get('Add') . '</button>';
|
||||
$html .= '</div>';
|
||||
|
||||
// Get the JSON DB, getValue() with the option unsanitized HTML code
|
||||
$jsondb = $this->getValue('jsondb', $unsanitized=false);
|
||||
$jsondb = $this->getValue('jsondb', $unsanitized = false);
|
||||
$links = json_decode($jsondb, true);
|
||||
|
||||
$html .= !empty($links) ? '<h4 class="mt-3">'.$L->get('Links').'</h4>' : '';
|
||||
$html .= !empty($links) ? '<h4 class="mt-3">' . $L->get('Links') . '</h4>' : '';
|
||||
|
||||
foreach($links as $name=>$url) {
|
||||
foreach ($links as $name => $url) {
|
||||
$html .= '<div class="my-2">';
|
||||
$html .= '<label>'.$L->get('Name').'</label>';
|
||||
$html .= '<input type="text" class="form-control" value="'.$name.'" disabled>';
|
||||
$html .= '<label>' . $L->get('Name') . '</label>';
|
||||
$html .= '<input type="text" dir="auto" class="form-control" value="' . $name . '" disabled>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Url').'</label>';
|
||||
$html .= '<input type="text" class="form-control" value="'.$url.'" disabled>';
|
||||
$html .= '<label>' . $L->get('Url') . '</label>';
|
||||
$html .= '<input type="text" dir="auto" class="form-control" value="' . $url . '" disabled>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<button name="deleteLink" class="btn btn-secondary my-2" type="submit" value="'.$name.'">'.$L->get('Delete').'</button>';
|
||||
$html .= '<button name="deleteLink" class="btn btn-secondary my-2" type="submit" value="' . $name . '">' . $L->get('Delete') . '</button>';
|
||||
$html .= '</div>';
|
||||
}
|
||||
|
||||
|
@ -129,7 +131,7 @@ class pluginLinks extends Plugin {
|
|||
// HTML for sidebar
|
||||
$html = '<div class="plugin plugin-pages">';
|
||||
if ($this->getValue('label')) {
|
||||
$html .= '<h2 class="plugin-label">'.$this->getValue('label').'</h2>';
|
||||
$html .= '<h2 class="plugin-label">' . $this->getValue('label') . '</h2>';
|
||||
}
|
||||
$html .= '<div class="plugin-content">';
|
||||
$html .= '<ul>';
|
||||
|
@ -139,17 +141,17 @@ class pluginLinks extends Plugin {
|
|||
$links = json_decode($jsondb);
|
||||
|
||||
// By default the database of categories are alphanumeric sorted
|
||||
foreach( $links as $name=>$url ) {
|
||||
foreach ($links as $name => $url) {
|
||||
$html .= '<li>';
|
||||
$html .= '<a href="'.$url.'">';
|
||||
$html .= '<a href="' . $url . '">';
|
||||
$html .= $name;
|
||||
$html .= '</a>';
|
||||
$html .= '</li>';
|
||||
}
|
||||
|
||||
$html .= '</ul>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.14.0",
|
||||
"releaseDate": "2022-08-05",
|
||||
"version": "3.16.2",
|
||||
"releaseDate": "2024-08-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.14.0",
|
||||
"compatible": "3.16.2",
|
||||
"notes": ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
<?php
|
||||
|
||||
class pluginMaintenanceMode extends Plugin {
|
||||
class pluginMaintenanceMode extends Plugin
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->dbFields = array(
|
||||
'enable'=>false,
|
||||
'message'=>'Temporarily down for maintenance.'
|
||||
'enable' => false,
|
||||
'message' => 'Temporarily down for maintenance.'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -19,16 +20,16 @@ class pluginMaintenanceMode extends Plugin {
|
|||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Enable maintenance mode').'</label>';
|
||||
$html .= '<label>' . $L->get('Enable maintenance mode') . '</label>';
|
||||
$html .= '<select name="enable">';
|
||||
$html .= '<option value="true" '.($this->getValue('enable')===true?'selected':'').'>Enabled</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('enable')===false?'selected':'').'>Disabled</option>';
|
||||
$html .= '<option value="true" ' . ($this->getValue('enable') === true ? 'selected' : '') . '>Enabled</option>';
|
||||
$html .= '<option value="false" ' . ($this->getValue('enable') === false ? 'selected' : '') . '>Disabled</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Message').'</label>';
|
||||
$html .= '<input name="message" id="jsmessage" type="text" value="'.$this->getValue('message').'">';
|
||||
$html .= '<label>' . $L->get('Message') . '</label>';
|
||||
$html .= '<input name="message" id="jsmessage" type="text" dir="auto" value="' . $this->getValue('message') . '">';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
|
@ -37,7 +38,7 @@ class pluginMaintenanceMode extends Plugin {
|
|||
public function beforeAll()
|
||||
{
|
||||
if ($this->getValue('enable')) {
|
||||
exit( $this->getValue('message') );
|
||||
exit($this->getValue('message'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.14.0",
|
||||
"releaseDate": "2022-08-05",
|
||||
"version": "3.16.2",
|
||||
"releaseDate": "2024-08-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.14.0",
|
||||
"compatible": "3.16.2",
|
||||
"notes": ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
<?php
|
||||
|
||||
class pluginNavigation extends Plugin {
|
||||
class pluginNavigation extends Plugin
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
// Fields and default values for the database of this plugin
|
||||
$this->dbFields = array(
|
||||
'label'=>'Navigation',
|
||||
'homeLink'=>true,
|
||||
'numberOfItems'=>5
|
||||
'label' => 'Navigation',
|
||||
'homeLink' => true,
|
||||
'numberOfItems' => 5
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -22,24 +23,24 @@ class pluginNavigation extends Plugin {
|
|||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Label').'</label>';
|
||||
$html .= '<input id="jslabel" name="label" type="text" value="'.$this->getValue('label').'">';
|
||||
$html .= '<span class="tip">'.$L->get('This title is almost always used in the sidebar of the site').'</span>';
|
||||
$html .= '<label>' . $L->get('Label') . '</label>';
|
||||
$html .= '<input id="jslabel" name="label" type="text" dir="auto" value="' . $this->getValue('label') . '">';
|
||||
$html .= '<span class="tip">' . $L->get('This title is almost always used in the sidebar of the site') . '</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Home link').'</label>';
|
||||
$html .= '<label>' . $L->get('Home link') . '</label>';
|
||||
$html .= '<select name="homeLink">';
|
||||
$html .= '<option value="true" '.($this->getValue('homeLink')===true?'selected':'').'>'.$L->get('Enabled').'</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('homeLink')===false?'selected':'').'>'.$L->get('Disabled').'</option>';
|
||||
$html .= '<option value="true" ' . ($this->getValue('homeLink') === true ? 'selected' : '') . '>' . $L->get('Enabled') . '</option>';
|
||||
$html .= '<option value="false" ' . ($this->getValue('homeLink') === false ? 'selected' : '') . '>' . $L->get('Disabled') . '</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '<span class="tip">'.$L->get('Show the home link on the sidebar').'</span>';
|
||||
$html .= '<span class="tip">' . $L->get('Show the home link on the sidebar') . '</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
if (ORDER_BY=='date') {
|
||||
if (ORDER_BY == 'date') {
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Amount of items').'</label>';
|
||||
$html .= '<input id="jsnumberOfItems" name="numberOfItems" type="text" value="'.$this->getValue('numberOfItems').'">';
|
||||
$html .= '<label>' . $L->get('Amount of items') . '</label>';
|
||||
$html .= '<input id="jsnumberOfItems" name="numberOfItems" type="text" dir="auto" value="' . $this->getValue('numberOfItems') . '">';
|
||||
$html .= '</div>';
|
||||
}
|
||||
|
||||
|
@ -60,7 +61,7 @@ class pluginNavigation extends Plugin {
|
|||
// Print the label if not empty
|
||||
$label = $this->getValue('label');
|
||||
if (!empty($label)) {
|
||||
$html .= '<h2 class="plugin-label">'.$label.'</h2>';
|
||||
$html .= '<h2 class="plugin-label">' . $label . '</h2>';
|
||||
}
|
||||
|
||||
$html .= '<div class="plugin-content">';
|
||||
|
@ -74,7 +75,7 @@ class pluginNavigation extends Plugin {
|
|||
}
|
||||
|
||||
// Pages order by position
|
||||
if (ORDER_BY=='position') {
|
||||
if (ORDER_BY == 'position') {
|
||||
// Get parents
|
||||
$parents = buildParentPages();
|
||||
foreach ($parents as $parent) {
|
||||
|
@ -116,9 +117,9 @@ class pluginNavigation extends Plugin {
|
|||
}
|
||||
|
||||
$html .= '</ul>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "3.14.0",
|
||||
"releaseDate": "2022-08-05",
|
||||
"version": "3.16.2",
|
||||
"releaseDate": "2024-08-23",
|
||||
"license": "MIT",
|
||||
"compatible": "3.14.0",
|
||||
"compatible": "3.16.2",
|
||||
"notes": ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
<?php
|
||||
|
||||
class pluginOpenGraph extends Plugin {
|
||||
class pluginOpenGraph extends Plugin
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
// Fields and default values for the database of this plugin
|
||||
$this->dbFields = array(
|
||||
'defaultImage'=>'',
|
||||
'fbAppId'=>''
|
||||
'defaultImage' => '',
|
||||
'fbAppId' => ''
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -20,15 +21,15 @@ class pluginOpenGraph extends Plugin {
|
|||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Default image').'</label>';
|
||||
$html .= '<input id="jsdefaultImage" name="defaultImage" type="text" value="'.$this->getValue('defaultImage').'" placeholder="https://">';
|
||||
$html .= '<span class="tip">'.$L->g('set-a-default-image-for-content').'</span>';
|
||||
$html .= '<label>' . $L->get('Default image') . '</label>';
|
||||
$html .= '<input id="jsdefaultImage" name="defaultImage" type="text" dir="auto" value="' . $this->getValue('defaultImage') . '" placeholder="https://">';
|
||||
$html .= '<span class="tip">' . $L->g('set-a-default-image-for-content') . '</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>'.$L->get('Facebook App ID').'</label>';
|
||||
$html .= '<input name="fbAppId" type="text" value="'.$this->getValue('fbAppId').'" placeholder="App ID">';
|
||||
$html .= '<span class="tip">'.$L->g('set-your-facebook-app-id').'</span>';
|
||||
$html .= '<label>' . $L->get('Facebook App ID') . '</label>';
|
||||
$html .= '<input name="fbAppId" type="text" dir="auto" value="' . $this->getValue('fbAppId') . '" placeholder="App ID">';
|
||||
$html .= '<span class="tip">' . $L->g('set-your-facebook-app-id') . '</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
|
@ -43,53 +44,52 @@ class pluginOpenGraph extends Plugin {
|
|||
global $content;
|
||||
|
||||
$og = array(
|
||||
'locale' =>$site->locale(),
|
||||
'type' =>'website',
|
||||
'title' =>$site->title(),
|
||||
'description' =>$site->description(),
|
||||
'url' =>$site->url(),
|
||||
'image' =>'',
|
||||
'siteName' =>$site->title()
|
||||
'locale' => $site->locale(),
|
||||
'type' => 'website',
|
||||
'title' => $site->title(),
|
||||
'description' => $site->description(),
|
||||
'url' => $site->url(),
|
||||
'image' => '',
|
||||
'siteName' => $site->title()
|
||||
);
|
||||
|
||||
switch ($WHERE_AM_I) {
|
||||
// The user filter by page
|
||||
// The user filter by page
|
||||
case 'page':
|
||||
$og['type'] = 'article';
|
||||
$og['title'] = $page->title();
|
||||
$og['description'] = $page->description();
|
||||
$og['url'] = $page->permalink($absolute=true);
|
||||
$og['image'] = $page->coverImage($absolute=true);
|
||||
$og['url'] = $page->permalink($absolute = true);
|
||||
$og['image'] = $page->coverImage($absolute = true);
|
||||
|
||||
$pageContent = $page->content();
|
||||
break;
|
||||
|
||||
// The user is in the homepage
|
||||
// The user is in the homepage
|
||||
default:
|
||||
$pageContent = '';
|
||||
if (Text::isNotEmpty($this->getValue('defaultImage'))) {
|
||||
$og['image'] = $this->getValue('defaultImage');
|
||||
}
|
||||
elseif (isset($content[0]) ) {
|
||||
$og['image'] = $content[0]->coverImage($absolute=true);
|
||||
} elseif (isset($content[0])) {
|
||||
$og['image'] = $content[0]->coverImage($absolute = true);
|
||||
$pageContent = $content[0]->content();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$html = PHP_EOL.'<!-- Open Graph -->'.PHP_EOL;
|
||||
$html .= '<meta property="og:locale" content="'.$og['locale'].'">'.PHP_EOL;
|
||||
$html .= '<meta property="og:type" content="'.$og['type'].'">'.PHP_EOL;
|
||||
$html .= '<meta property="og:title" content="'.$og['title'].'">'.PHP_EOL;
|
||||
$html .= '<meta property="og:description" content="'.$og['description'].'">'.PHP_EOL;
|
||||
$html .= '<meta property="og:url" content="'.$og['url'].'">'.PHP_EOL;
|
||||
$html .= '<meta property="og:site_name" content="'.$og['siteName'].'">'.PHP_EOL;
|
||||
$html = PHP_EOL . '<!-- Open Graph -->' . PHP_EOL;
|
||||
$html .= '<meta property="og:locale" content="' . $og['locale'] . '">' . PHP_EOL;
|
||||
$html .= '<meta property="og:type" content="' . $og['type'] . '">' . PHP_EOL;
|
||||
$html .= '<meta property="og:title" content="' . $og['title'] . '">' . PHP_EOL;
|
||||
$html .= '<meta property="og:description" content="' . $og['description'] . '">' . PHP_EOL;
|
||||
$html .= '<meta property="og:url" content="' . $og['url'] . '">' . PHP_EOL;
|
||||
$html .= '<meta property="og:site_name" content="' . $og['siteName'] . '">' . PHP_EOL;
|
||||
|
||||
// If the page doesn't have a coverImage try to get an image from the HTML content
|
||||
if (empty($og['image'])) {
|
||||
// Get the image from the content
|
||||
$src = DOM::getFirstImage($pageContent);
|
||||
if ($src!==false) {
|
||||
if ($src !== false) {
|
||||
$og['image'] = $src;
|
||||
} else {
|
||||
if (Text::isNotEmpty($this->getValue('defaultImage'))) {
|
||||
|
@ -98,11 +98,10 @@ class pluginOpenGraph extends Plugin {
|
|||
}
|
||||
}
|
||||
|
||||
$html .= '<meta property="og:image" content="'.$og['image'].'">'.PHP_EOL;
|
||||
$html .= '<meta property="og:image" content="' . $og['image'] . '">' . PHP_EOL;
|
||||
if (Text::isNotEmpty($this->getValue('fbAppId'))) {
|
||||
$html .= '<meta property="fb:app_id" content="'. $this->getValue('fbAppId').'">'.PHP_EOL;
|
||||
$html .= '<meta property="fb:app_id" content="' . $this->getValue('fbAppId') . '">' . PHP_EOL;
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue